use of com.datastax.oss.driver.internal.core.metrics.MetricId in project java-driver by datastax.
the class MicroProfileMetricsIT method nodeMetricIds.
private List<MetricID> nodeMetricIds(InternalDriverContext context, Node node) {
List<MetricID> ids = new ArrayList<>();
for (DefaultNodeMetric metric : ENABLED_NODE_METRICS) {
MetricId id = context.getMetricIdGenerator().nodeMetricId(node, metric);
ids.add(new MetricID(id.getName(), MicroProfileTags.toMicroProfileTags(id.getTags())));
}
return ids;
}
use of com.datastax.oss.driver.internal.core.metrics.MetricId in project java-driver by datastax.
the class MicrometerMetricUpdater method initializeGauge.
protected void initializeGauge(MetricT metric, DriverExecutionProfile profile, Supplier<Number> supplier) {
if (isEnabled(metric, profile.getName())) {
metrics.computeIfAbsent(metric, m -> {
MetricId id = getMetricId(m);
Iterable<Tag> tags = MicrometerTags.toMicrometerTags(id.getTags());
return Gauge.builder(id.getName(), supplier).tags(tags).register(registry);
});
}
}
use of com.datastax.oss.driver.internal.core.metrics.MetricId in project java-driver by datastax.
the class MicroProfileMetricUpdater method clearMetrics.
@Override
protected void clearMetrics() {
for (MetricT metric : metrics.keySet()) {
MetricId id = getMetricId(metric);
Tag[] tags = MicroProfileTags.toMicroProfileTags(id.getTags());
registry.remove(new MetricID(id.getName(), tags));
}
metrics.clear();
}
use of com.datastax.oss.driver.internal.core.metrics.MetricId in project java-driver by datastax.
the class MicroProfileMetricUpdater method initializeGauge.
protected void initializeGauge(MetricT metric, DriverExecutionProfile profile, Gauge<Number> supplier) {
if (isEnabled(metric, profile.getName())) {
metrics.computeIfAbsent(metric, m -> {
MetricId id = getMetricId(m);
String name = id.getName();
Tag[] tags = MicroProfileTags.toMicroProfileTags(id.getTags());
Metadata metadata = Metadata.builder().withName(name).withType(MetricType.GAUGE).build();
return registry.register(metadata, supplier, tags);
});
}
}
use of com.datastax.oss.driver.internal.core.metrics.MetricId in project java-driver by datastax.
the class DropwizardMetricsIT method nodeMetricIds.
private List<String> nodeMetricIds(InternalDriverContext context, Node node) {
List<String> ids = new ArrayList<>();
for (DefaultNodeMetric metric : ENABLED_NODE_METRICS) {
MetricId id = context.getMetricIdGenerator().nodeMetricId(node, metric);
ids.add(id.getName());
}
return ids;
}
Aggregations