BasicGraphiteNamingConvention implements GraphiteNamingConvention { @Override public String getName(Metric metric) { MonitorConfig config = metric.getConfig(); TagList tags = config.getTags(); Tag domainTag = tags.getTag(JMX_DOMAIN_KEY); if (domainTag != null) { return handleJmxMetric(config, tags); } else { return handleMetric(config, tags); } }  @Override String getName(Metric metric);  }
@Test public void testJmxNaming() throws Exception { Metric m = getOSMetric("AvailableProcessors"); GraphiteNamingConvention convention = new BasicGraphiteNamingConvention(); String name = convention.getName(m); assertEquals(name, "java.lang.OperatingSystem.AvailableProcessors"); }
@Test public void testMetricNamingEmptyTags() throws Exception { Metric m = new Metric("simpleMonitor", SortedTagList.EMPTY, 0, 1000.0); GraphiteNamingConvention convention = new BasicGraphiteNamingConvention(); String name = convention.getName(m); assertEquals(name, "simpleMonitor"); }
@Test public void testMetricNamingWithTags() throws Exception { TagList tagList = BasicTagList.of("instance", "GetLogs", DataSourceType.KEY, "HystrixCommand"); Metric m = new Metric("simpleMonitor", tagList, 0, 1000.0); GraphiteNamingConvention convention = new BasicGraphiteNamingConvention(); String name = convention.getName(m); assertEquals(name, "HystrixCommand.GetLogs.simpleMonitor"); }