@Test public void testNameOverride() { OpenMetricsExporter exporter = new OpenMetricsExporter(); MetricRegistry registry = MetricRegistries.get(MetricRegistry.Type.APPLICATION); Metadata metadata = new ExtendedMetadata("voltage1", "Voltage", "Measures your electric potential", MetricType.GAUGE, "volts", null, false, Optional.of(true), false, "baz"); Tag tag = new Tag("a", "b"); registry.register(metadata, (Gauge<Long>) () -> 3L, tag); String result = exporter.exportOneScope(MetricRegistry.Type.APPLICATION).toString(); System.out.println(result); assertHasHelpLineExactlyOnce(result, "application_baz", "Measures your electric potential"); assertHasTypeLineExactlyOnce(result, "application_baz", "gauge"); assertHasValueLineExactlyOnce(result, "application_baz", "3.0", tag); }
@Override public StringBuilder exportOneScope(MetricRegistry.Type scope) { alreadyExportedNames.set(new HashSet<>()); StringBuilder sb = new StringBuilder(); getEntriesForScope(scope, sb); alreadyExportedNames.set(null); return sb; }
OpenMetricsExporter implements Exporter { @Override public StringBuilder exportOneScope(MetricRegistry.Type scope) { alreadyExportedNames.set(new HashSet<>()); StringBuilder sb = new StringBuilder(); getEntriesForScope(scope, sb); alreadyExportedNames.set(null); return sb; } }
OpenMetricsExporter implements Exporter { @Override public StringBuilder exportOneScope(MetricRegistry.Type scope) { alreadyExportedNames.set(new HashSet<>()); StringBuilder sb = new StringBuilder(); getEntriesForScope(scope, sb); alreadyExportedNames.set(null); return sb; } OpenMetricsExporter(); }
OpenMetricsExporter implements Exporter { @Override public StringBuilder exportOneScope(MetricRegistry.Type scope) { alreadyExportedNames.set(new HashSet<>()); StringBuilder sb = new StringBuilder(); getEntriesForScope(scope, sb); alreadyExportedNames.set(null); return sb; } OpenMetricsExporter(); @Override StringBuilder exportOneScope(MetricRegistry.Type scope); @Override StringBuilder exportAllScopes(); @Override StringBuilder exportOneMetric(MetricRegistry.Type scope, MetricID metricID); @Override StringBuilder exportMetricsByName(MetricRegistry.Type scope, String name); @Override String getContentType(); static String quoteHelpText(String value); static String quoteValue(String value); }
OpenMetricsExporter implements Exporter { @Override public StringBuilder exportOneScope(MetricRegistry.Type scope) { alreadyExportedNames.set(new HashSet<>()); StringBuilder sb = new StringBuilder(); getEntriesForScope(scope, sb); alreadyExportedNames.set(null); return sb; } OpenMetricsExporter(); @Override StringBuilder exportOneScope(MetricRegistry.Type scope); @Override StringBuilder exportAllScopes(); @Override StringBuilder exportOneMetric(MetricRegistry.Type scope, MetricID metricID); @Override StringBuilder exportMetricsByName(MetricRegistry.Type scope, String name); @Override String getContentType(); static String quoteHelpText(String value); static String quoteValue(String value); static final String SMALLRYE_METRICS_USE_PREFIX_FOR_SCOPE; }