Skip to content

Commit

Permalink
Merge pull request #73 from ambud/master
Browse files Browse the repository at this point in the history
Add a metric to measure singer startup latency
  • Loading branch information
ambud authored Aug 6, 2020
2 parents ea3cd9c + 418cd53 commit 637936d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class SingerMetrics {
public static final String FILE_LOOKUP_FAILURE = "singer.file_lookup.failure";

public static final String SINGER_START_INDICATOR = "singer.starting";
public static final String SINGER_STARTUP_LATENCY = "singer.startup.latency";

public static final String NO_SUCH_FILE_EXCEPTION = "singer.singer_log.nosuchfileexception";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public static void initialize(SingerConfig config)
NoSuchMethodException,
SingerLogException {
setSingerConfig(config);

long startTs = System.currentTimeMillis();
// mark metric if Singer is running in shadowMode
if (config.isShadowModeEnabled()) {
Stats.setGauge(SingerMetrics.SHADOW_MODE_ENABLED, 1);
Expand Down Expand Up @@ -216,7 +216,9 @@ public static void initialize(SingerConfig config)
logMonitor = (LogMonitor) getInstanceMethod.invoke(null, monitorIntervalInSecs, singerConfig);
logMonitor.start();
}

long startupLatency = System.currentTimeMillis() - startTs;
Stats.setGauge(SingerMetrics.SINGER_STARTUP_LATENCY, startupLatency);

globalFsm.start();
}

Expand Down

0 comments on commit 637936d

Please sign in to comment.