use of com.codahale.metrics.newrelic.transformer.interfaces.CountingTransformer in project dropwizard-metrics-newrelic by newrelic.
the class HistogramTransformerTest method testRemove.
@Test
void testRemove() {
CountingTransformer counting = mock(CountingTransformer.class);
HistogramTransformer testClass = new HistogramTransformer(counting, null);
testClass.onHistogramRemoved("jim");
verify(counting).remove("jim");
}
use of com.codahale.metrics.newrelic.transformer.interfaces.CountingTransformer in project dropwizard-metrics-newrelic by newrelic.
the class MeterTransformerTest method testRemoveWithNameCustomization.
@Test
void testRemoveWithNameCustomization() {
CountingTransformer counting = mock(CountingTransformer.class);
MeterTransformer testClass = new MeterTransformer(null, counting, MetricCustomizerTestUtils.NAME_TAG_STRIPPER, null);
testClass.onMeterRemoved("something[tag:value]");
verify(counting).remove("something");
}
use of com.codahale.metrics.newrelic.transformer.interfaces.CountingTransformer in project dropwizard-metrics-newrelic by newrelic.
the class TimerTransformerTest method testTransformWithAttributeAndNameCustomization.
@Test
void testTransformWithAttributeAndNameCustomization() {
Attributes otherTags = new Attributes().put("tag", "value").put("otherTag", "otherValue");
long now = System.currentTimeMillis();
Gauge result1 = new Gauge(baseName, 55d, now, otherTags);
Gauge result2 = new Gauge(baseName, 999d, now, otherTags);
Count expectedCount = createExpectedCountMetric(otherTags);
Timer timer = mock(Timer.class);
SamplingTransformer samplingTransformer = mock(SamplingTransformer.class);
MeteredTransformer meteredTransformer = mock(MeteredTransformer.class);
CountingTransformer countingTransformer = mock(CountingTransformer.class);
when(samplingTransformer.transform(eq(baseName), eq(timer), notNull())).thenReturn(singleton(result1));
when(meteredTransformer.transform(eq(baseName), eq(timer), notNull())).thenReturn(singleton(result2));
when(countingTransformer.transform(eq(baseName), eq(timer), notNull())).thenReturn(singleton(expectedCount));
TimerTransformer timerTransformer = new TimerTransformer(samplingTransformer, meteredTransformer, countingTransformer, MetricCustomizerTestUtils.NAME_TAG_STRIPPER, MetricCustomizerTestUtils.ATTRIBUTES_FROM_TAGGED_NAME);
Collection<Metric> results = timerTransformer.transform(baseName + "[tag:value,otherTag:otherValue]", timer);
Collection<Metric> expected = Sets.newSet(result1, result2, expectedCount);
assertEquals(expected, results);
}
use of com.codahale.metrics.newrelic.transformer.interfaces.CountingTransformer in project dropwizard-metrics-newrelic by newrelic.
the class TimerTransformerTest method testRemove.
@Test
void testRemove() throws Exception {
CountingTransformer counting = mock(CountingTransformer.class);
TimerTransformer testClass = new TimerTransformer(null, null, counting);
testClass.onTimerRemoved("money");
verify(counting).remove("money");
}
use of com.codahale.metrics.newrelic.transformer.interfaces.CountingTransformer in project dropwizard-metrics-newrelic by newrelic.
the class TimerTransformerTest method testRemoveWithNameCustomization.
@Test
void testRemoveWithNameCustomization() {
CountingTransformer counting = mock(CountingTransformer.class);
TimerTransformer testClass = new TimerTransformer(null, null, counting, MetricCustomizerTestUtils.NAME_TAG_STRIPPER, null);
testClass.onTimerRemoved("money[tag:value]");
verify(counting).remove("money");
}
Aggregations