public PolledEvent poll(long secondInterval) { long msNow = clock.wallTime(); List<Meter> meters = new ArrayList<>(); List<Measurement> measurements = new ArrayList<>(); for (Registry registry : registries) { SpectatorUtils.removeExpiredMeters(registry); for (Meter meter : registry) { if (meter instanceof PeriodMeter) { ((PeriodMeter) meter).calcMeasurements(msNow, secondInterval); } meters.add(meter); meter.measure().forEach(measurements::add); } } return new PolledEvent(meters, measurements); } }
private List<InfluxDbResult> queryInfluxdb(InfluxDbRemoteService remoteService, String metricSetName, String query) { long startTime = registry.clock().monotonicTime(); List<InfluxDbResult> influxDbResults; try { influxDbResults = remoteService.query(metricSetName, query); } finally { long endTime = registry.clock().monotonicTime(); Id influxDbFetchTimerId = registry.createId("influxdb.fetchTime"); registry.timer(influxDbFetchTimerId).record(endTime - startTime, TimeUnit.NANOSECONDS); } return influxDbResults; }
/** Create a new instance. */ AtlasMeter(Id id, Clock clock, long ttl) { this.id = id; this.clock = clock; this.ttl = ttl; lastUpdated = clock.wallTime(); }
long startTime = registry.clock().monotonicTime(); List<PrometheusResults> prometheusResultsList; canaryScope.getStep()); } finally { long endTime = registry.clock().monotonicTime();
/** * Updates the last updated timestamp for the meter to indicate it is active and should * not be considered expired. */ void updateLastModTime() { lastUpdated = clock.wallTime(); }
@Override public long monotonicTime() { return impl.monotonicTime(); } }
/** Create a new instance. */ StatelessMeter(Id id, Clock clock, long ttl) { this.id = id; this.clock = clock; this.ttl = ttl; lastUpdated = clock.wallTime(); }
private long getLatency() { if (startNanos >= 0L && latency < 0L) { // If latency was not explicitly set but the start time was, then compute the // time since the start. The field is updated so subsequent calls will return // a consistent value for the latency. latency = clock.monotonicTime() - startNanos; } return latency; }
/** * Updates the last updated timestamp for the meter to indicate it is active and should * not be considered expired. */ void updateLastModTime() { lastUpdated = clock.wallTime(); }
long startTime = registry.clock().monotonicTime(); ListTimeSeriesResponse response; response = list.execute(); } finally { long endTime = registry.clock().monotonicTime(); Id stackdriverFetchTimerId = registry.createId("stackdriver.fetchTime").withTag("project", projectId);
public void onInvocationFinish(InvocationFinishEvent event) { lastUpdated = registry.clock().wallTime(); InvocationStageTrace stageTrace = event.getInvocation().getInvocationStageTrace(); totalTimer.record((long) stageTrace.calcTotalTime()); handlersRequestTimer.record((long) stageTrace.calcHandlersRequestTime()); handlersResponseTimer.record((long) stageTrace.calcHandlersResponseTime()); prepareTimer.record((long) stageTrace.calcInvocationPrepareTime()); }
@Override public long monotonicTime() { return impl.monotonicTime(); } }
/** * Return the number of seconds since the last time the counter was incremented. */ public double secondsSinceLastUpdate() { final long now = clock.wallTime(); return (now - lastUpdated.get()) / MILLIS_PER_SECOND; }
String isoStep = Duration.of(atlasCanaryScope.getStep(), SECONDS) + ""; long start = registry.clock().monotonicTime(); List <AtlasResults> atlasResultsList; try { MAX_RETRIES, RETRY_BACKOFF); } finally { long end = registry.clock().monotonicTime(); registry.timer("atlas.fetchTime").record(end - start, TimeUnit.NANOSECONDS);
/** * Return the number of seconds since the last time the counter was incremented. */ public double secondsSinceLastUpdate() { final long now = clock.wallTime(); return (now - lastUpdated.get()) / MILLIS_PER_SECOND; }
@Override public long duration() { long now = clock.monotonicTime(); long sum = 0L; for (long startTime : tasks.values()) { sum += now - startTime; } return sum; }
/** Create a new instance. */ public StepLong(long init, Clock clock, long step) { this.init = init; this.clock = clock; this.step = step; previous = init; current = new AtomicLong(init); lastInitPos = new AtomicLong(clock.wallTime() / step); }
@Override public long duration() { long now = clock.monotonicTime(); long sum = 0L; for (long startTime : tasks.values()) { sum += now - startTime; } return sum; }
/** Create a new instance. */ public StepLong(long init, Clock clock, long step) { this.init = init; this.clock = clock; this.step = step; previous = init; current = new AtomicLong(init); lastInitPos = new AtomicLong(clock.wallTime() / step); }
@Override public long start() { long task = nextTask.getAndIncrement(); tasks.put(task, clock.monotonicTime()); return task; }