Skip to content

Commit

Permalink
Setting initialization time (Netflix#603)
Browse files Browse the repository at this point in the history
Co-authored-by: Sundaram Ananthanarayanan <[email protected]>
  • Loading branch information
sundargates and sundargates authored Dec 13, 2023
1 parent d6aca28 commit 368b2c2
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import akka.actor.ActorRef;
import akka.util.Timeout;
import io.mantisrx.common.metrics.Metrics;
import io.mantisrx.common.metrics.Timer;
import io.mantisrx.master.jobcluster.proto.BaseResponse;
import io.mantisrx.master.jobcluster.proto.JobClusterManagerProto;
import io.mantisrx.server.core.BaseService;
Expand All @@ -36,6 +38,7 @@ public class JobClustersManagerService extends BaseService {
private final ActorRef jobClustersManagerActor;
private final MantisSchedulerFactory schedulerFactory;
private final boolean loadJobsFromStore;
private final Timer initializationTimeTracker;

public JobClustersManagerService(final ActorRef jobClustersManagerActor,
final MantisSchedulerFactory schedulerFactory,
Expand All @@ -44,6 +47,13 @@ public JobClustersManagerService(final ActorRef jobClustersManagerActor,
this.jobClustersManagerActor = jobClustersManagerActor;
this.schedulerFactory = schedulerFactory;
this.loadJobsFromStore = loadJobsFromStore;
Metrics metrics =
new Metrics.Builder()
.name("JobClustersManagerService")
.addTimer("initializationTime")
.build();

this.initializationTimeTracker = metrics.getTimer("initializationTime");
}

@Override
Expand Down Expand Up @@ -80,6 +90,7 @@ public void start() {

logger.info("JobClustersManager initialize took {} sec",
TimeUnit.SECONDS.convert(System.currentTimeMillis() - startTime, TimeUnit.MILLISECONDS));
initializationTimeTracker.record(System.currentTimeMillis() - startTime, TimeUnit.MILLISECONDS);
});
}
}

0 comments on commit 368b2c2

Please sign in to comment.