77import dev .aikido .agent_api .background .cloud .api .events .Started ;
88import dev .aikido .agent_api .helpers .env .BlockingEnv ;
99import dev .aikido .agent_api .helpers .env .Token ;
10+ import dev .aikido .agent_api .helpers .logging .LogManager ;
11+ import dev .aikido .agent_api .helpers .logging .Logger ;
1012import dev .aikido .agent_api .storage .ServiceConfigStore ;
1113
1214import java .util .Optional ;
@@ -22,6 +24,7 @@ public class BackgroundProcess extends Thread {
2224 private final static int API_TIMEOUT = 10 ; // 10 seconds
2325 private final Token token ;
2426 private final ScheduledExecutorService scheduler = Executors .newScheduledThreadPool (3 );
27+ private static final Logger logger = LogManager .getLogger (BackgroundProcess .class );
2528
2629 public BackgroundProcess (String name , Token token ) {
2730 super (name );
@@ -33,6 +36,8 @@ public void run() {
3336 if (!Thread .currentThread ().isDaemon () && token == null ) {
3437 return ; // Can only run if thread is daemon and token needs to be defined.
3538 }
39+ logger .trace ("Starting agent thread: %s" , Thread .currentThread ());
40+
3641 ServiceConfigStore .updateBlocking (new BlockingEnv ().getValue ());
3742 ReportingApiHTTP api = new ReportingApiHTTP (getAikidoAPIEndpoint (), API_TIMEOUT , token );
3843 RealtimeAPI realtimeApi = new RealtimeAPI (token );
@@ -53,4 +58,4 @@ public void run() {
5358 // one time check to report initial stats
5459 scheduler .schedule (new HeartbeatTask (api , true ), 60 , TimeUnit .SECONDS );
5560 }
56- }
61+ }
0 commit comments