use of io.mantisrx.common.metrics.spectator.MetricId in project mantis by Netflix.
the class SchedulingService method setupSchedulingServiceWatcherMetric.
private void setupSchedulingServiceWatcherMetric() {
logger.info("Setting up SchedulingServiceWatcher metrics");
lastSchedulingResultCallback.set(System.currentTimeMillis());
final String metricGroup = "SchedulingServiceWatcher";
final GaugeCallback timeSinceLastSchedulingRunGauge = new GaugeCallback(new MetricId(metricGroup, "timeSinceLastSchedulingRunMs"), () -> (double) (System.currentTimeMillis() - lastSchedulingResultCallback.get()), SpectatorRegistryFactory.getRegistry());
final Metrics schedulingServiceWatcherMetrics = new Metrics.Builder().id(metricGroup).addGauge(timeSinceLastSchedulingRunGauge).build();
MetricsRegistry.getInstance().registerAndGet(schedulingServiceWatcherMetrics);
}
use of io.mantisrx.common.metrics.spectator.MetricId in project mantis by Netflix.
the class HttpRequestMetrics method incrementEndpointMetrics.
public void incrementEndpointMetrics(String endpoint, final Tag... tags) {
Preconditions.checkArgument(Endpoints.endpointSet.contains(endpoint), String.format("endpoint %s is not valid", endpoint));
MetricId id = new MetricId(METRIC_GROUP_ID, endpoint, tags);
registry.counter(id.getSpectatorId(registry)).increment();
}
Aggregations