@Test public void metricNames() { assertEquals("event-type-thing", MetricsCollectorDropwizard.scrubEventTypeName("event:type:thing")); assertEquals("event-type-thing", MetricsCollectorDropwizard.scrubEventTypeName("event type thing")); assertEquals("event-type-thing", MetricsCollectorDropwizard.scrubEventTypeName("event.type.thing")); assertEquals("event--type--thing--is", MetricsCollectorDropwizard.scrubEventTypeName("event::type..thing is")); }
@SuppressWarnings("WeakerAccess") @VisibleForTesting static String scrubEventTypeName(String eventType) { if(!eventNames.containsKey(eventType)) { eventNames.put(eventType, eventType.replaceAll("[.:\\s]", "-")); } return eventNames.get(eventType); }
MetricsCollectorDropwizard implements MetricCollector { @SuppressWarnings("WeakerAccess") @VisibleForTesting static String scrubEventTypeName(String eventType) { if(!eventNames.containsKey(eventType)) { eventNames.put(eventType, eventType.replaceAll("[.:\\s]", "-")); } return eventNames.get(eventType); } }
MetricsCollectorDropwizard implements MetricCollector { @SuppressWarnings("WeakerAccess") @VisibleForTesting static String scrubEventTypeName(String eventType) { if(!eventNames.containsKey(eventType)) { eventNames.put(eventType, eventType.replaceAll("[.:\\s]", "-")); } return eventNames.get(eventType); } MetricsCollectorDropwizard(String namespace, MetricRegistry metricRegistry); }
MetricsCollectorDropwizard implements MetricCollector { @SuppressWarnings("WeakerAccess") @VisibleForTesting static String scrubEventTypeName(String eventType) { if(!eventNames.containsKey(eventType)) { eventNames.put(eventType, eventType.replaceAll("[.:\\s]", "-")); } return eventNames.get(eventType); } MetricsCollectorDropwizard(String namespace, MetricRegistry metricRegistry); @Override void mark(MetricCollector.Meter meter); @Override void mark(MetricCollector.Meter event, long count); @Override void duration(MetricCollector.Timer metric, long duration, TimeUnit unit); }
MetricsCollectorDropwizard implements MetricCollector { @SuppressWarnings("WeakerAccess") @VisibleForTesting static String scrubEventTypeName(String eventType) { if(!eventNames.containsKey(eventType)) { eventNames.put(eventType, eventType.replaceAll("[.:\\s]", "-")); } return eventNames.get(eventType); } MetricsCollectorDropwizard(String namespace, MetricRegistry metricRegistry); @Override void mark(MetricCollector.Meter meter); @Override void mark(MetricCollector.Meter event, long count); @Override void duration(MetricCollector.Timer metric, long duration, TimeUnit unit);  }