some simple base metrics renamings
diff --git a/geronimo-metrics-common/src/main/java/org/apache/geronimo/microprofile/metrics/common/BaseMetrics.java b/geronimo-metrics-common/src/main/java/org/apache/geronimo/microprofile/metrics/common/BaseMetrics.java
index 7e395dc..5371a9d 100644
--- a/geronimo-metrics-common/src/main/java/org/apache/geronimo/microprofile/metrics/common/BaseMetrics.java
+++ b/geronimo-metrics-common/src/main/java/org/apache/geronimo/microprofile/metrics/common/BaseMetrics.java
@@ -65,20 +65,37 @@
final ClassLoadingMXBean classLoadingMXBean = ManagementFactory.getClassLoadingMXBean();
registry.register(Metadata.builder()
- .withName("classloader.currentLoadedClass.count")
+ .withName("classloader.unloadedClasses.count")
.withDisplayName("Current Loaded Class Count")
.withDescription("Displays the number of classes that are currently loaded in the Java virtual machine.")
- .withType(MetricType.COUNTER).withUnit(MetricUnits.NONE).build(), counter(classLoadingMXBean::getLoadedClassCount));
+ .withType(MetricType.GAUGE)
+ .withUnit(MetricUnits.NONE)
+ .build(),
+ gauge(classLoadingMXBean::getUnloadedClassCount));
registry.register(Metadata.builder()
- .withName("classloader.totalLoadedClass.count")
+ .withName("classloader.unloadedClasses.total")
+ .withDisplayName("Current Loaded Class Total")
+ .withDescription("Displays the number of classes that are currently loaded in the Java virtual machine.")
+ .withType(MetricType.COUNTER)
+ .withUnit(MetricUnits.NONE)
+ .build(),
+ counter(classLoadingMXBean::getUnloadedClassCount));
+ registry.register(Metadata.builder()
+ .withName("classloader.loadedClasses.count")
.withDisplayName("Total Loaded Class Count")
.withDescription("Displays the total number of classes that have been loaded since the Java virtual machine has started execution.")
- .withType(MetricType.COUNTER).withUnit(MetricUnits.NONE).build(), counter(classLoadingMXBean::getTotalLoadedClassCount));
+ .withType(MetricType.GAUGE)
+ .withUnit(MetricUnits.NONE)
+ .build(),
+ gauge(classLoadingMXBean::getTotalLoadedClassCount));
registry.register(Metadata.builder()
- .withName("classloader.totalUnloadedClass.count")
- .withDisplayName("Total Unloaded Loaded Class Count")
- .withDescription("Displays the total number of classes unloaded since the Java virtual machine has started execution.")
- .withType(MetricType.COUNTER).withUnit(MetricUnits.NONE).build(), counter(classLoadingMXBean::getTotalLoadedClassCount));
+ .withName("classloader.loadedClasses.total")
+ .withDisplayName("Total Loaded Class Count")
+ .withDescription("Displays the total number of classes that have been loaded since the Java virtual machine has started execution.")
+ .withType(MetricType.COUNTER)
+ .withUnit(MetricUnits.NONE)
+ .build(),
+ counter(classLoadingMXBean::getTotalLoadedClassCount));
final ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
registry.register(Metadata.builder()
diff --git a/geronimo-metrics-common/src/main/java/org/apache/geronimo/microprofile/metrics/common/jaxrs/MetricsEndpoints.java b/geronimo-metrics-common/src/main/java/org/apache/geronimo/microprofile/metrics/common/jaxrs/MetricsEndpoints.java
index 47f0c40..2dec8e7 100644
--- a/geronimo-metrics-common/src/main/java/org/apache/geronimo/microprofile/metrics/common/jaxrs/MetricsEndpoints.java
+++ b/geronimo-metrics-common/src/main/java/org/apache/geronimo/microprofile/metrics/common/jaxrs/MetricsEndpoints.java
@@ -143,7 +143,8 @@
@Context final SecurityContext securityContext,
@Context final UriInfo uriInfo) {
securityValidator.checkSecurity(securityContext, uriInfo);
- return singleEntry(name, findRegistry(registry), this::map);
+ final MetricRegistry metricRegistry = findRegistry(registry);
+ return singleEntry(name, metricRegistry, this::map);
}
@GET
@@ -191,8 +192,9 @@
private <T> Map<String, T> singleEntry(final String id, final MetricRegistry metricRegistry,
final Function<Metric, T> metricMapper) {
- return ofNullable(metricRegistry.getMetrics().get(new MetricID(id)))
- .map(metric -> singletonMap(id, metricMapper.apply(metric)))
+ final MetricID key = new MetricID(id);
+ return ofNullable(metricRegistry.getMetrics().get(key))
+ .map(metric -> singletonMap(id + formatTags(key), metricMapper.apply(metric)))
.orElseGet(Collections::emptyMap);
}
@@ -274,7 +276,8 @@
}
private MetricRegistry findRegistry(final String registry) {
- switch (Stream.of(MetricRegistry.Type.values()).filter(it -> it.getName().equals(registry)).findFirst()
+ switch (Stream.of(MetricRegistry.Type.values())
+ .filter(it -> it.getName().equalsIgnoreCase(registry)).findFirst()
.orElseThrow(() -> new WebApplicationException(Response.Status.NOT_FOUND))) {
case BASE:
return baseRegistry;