use of org.apache.ratis.metrics.MetricRegistryInfo in project incubator-ratis by apache.
the class RaftBasicTests method getStatemachineGaugeWithName.
private static Gauge getStatemachineGaugeWithName(RaftServer.Division server, String gaugeName) {
MetricRegistryInfo info = new MetricRegistryInfo(server.getMemberId().toString(), RATIS_APPLICATION_NAME_METRICS, RATIS_STATEMACHINE_METRICS, RATIS_STATEMACHINE_METRICS_DESC);
Optional<RatisMetricRegistry> metricRegistry = MetricRegistries.global().get(info);
Assert.assertTrue(metricRegistry.isPresent());
RatisMetricRegistry ratisStateMachineMetricRegistry = metricRegistry.get();
SortedMap<String, Gauge> gaugeMap = ratisStateMachineMetricRegistry.getGauges((s, metric) -> s.contains(gaugeName));
return gaugeMap.get(gaugeMap.firstKey());
}
use of org.apache.ratis.metrics.MetricRegistryInfo in project incubator-ratis by apache.
the class RaftSnapshotBaseTest method getTakeSnapshotTimer.
private static Timer getTakeSnapshotTimer(RaftServer.Division leader) {
MetricRegistryInfo info = new MetricRegistryInfo(leader.getMemberId().toString(), RATIS_APPLICATION_NAME_METRICS, RATIS_STATEMACHINE_METRICS, RATIS_STATEMACHINE_METRICS_DESC);
Optional<RatisMetricRegistry> opt = MetricRegistries.global().get(info);
Assert.assertTrue(opt.isPresent());
RatisMetricRegistry metricRegistry = opt.get();
Assert.assertNotNull(metricRegistry);
return metricRegistry.timer(STATEMACHINE_TAKE_SNAPSHOT_TIMER);
}
use of org.apache.ratis.metrics.MetricRegistryInfo in project incubator-ratis by apache.
the class TestRaftSnapshotWithGrpc method verifyInstallSnapshotMetric.
@Override
protected void verifyInstallSnapshotMetric(RaftServer.Division leader) {
MetricRegistryInfo info = new MetricRegistryInfo(leader.getMemberId().toString(), "ratis_grpc", "log_appender", "Metrics for Ratis Grpc Log Appender");
Optional<RatisMetricRegistry> metricRegistry = MetricRegistries.global().get(info);
Assert.assertTrue(metricRegistry.isPresent());
Counter installSnapshotCounter = metricRegistry.get().counter("num_install_snapshot");
Assert.assertNotNull(installSnapshotCounter);
Assert.assertTrue(installSnapshotCounter.getCount() >= 1);
}
Aggregations