use of com.signalfx.codahale.reporter.SignalFxReporter in project riposte by Nike-Inc.
the class SignalFxEndpointMetricsHandlerTest method three_arg_constructor_sets_fields_as_expected.
@Test
public void three_arg_constructor_sets_fields_as_expected() {
// given
SignalFxReporter reporterMock = mock(SignalFxReporter.class);
MetricMetadata expectedMetricMetadata = wireUpReporterForConstructor(reporterMock);
Pair<Long, TimeUnit> reportingFrequency = Pair.of(42L, TimeUnit.DAYS);
// when
SignalFxEndpointMetricsHandler instance = new SignalFxEndpointMetricsHandler(reporterMock, reportingFrequency, metricRegistryMock);
// then
assertThat(instance.metricMetadata).isSameAs(expectedMetricMetadata);
assertThat(instance.metricRegistry).isSameAs(metricRegistryMock);
assertThat(instance.requestTimerBuilder).isInstanceOf(RollingWindowTimerBuilder.class);
RollingWindowTimerBuilder rwtb = (RollingWindowTimerBuilder) instance.requestTimerBuilder;
assertThat(rwtb.amount).isEqualTo(reportingFrequency.getLeft());
assertThat(rwtb.timeUnit).isEqualTo(reportingFrequency.getRight());
assertThat(instance.requestTimerDimensionConfigurator).isSameAs(DEFAULT_REQUEST_LATENCY_TIMER_DIMENSION_CONFIGURATOR);
}
use of com.signalfx.codahale.reporter.SignalFxReporter in project riposte by Nike-Inc.
the class SignalFxReporterFactoryTest method getReporter_caches_result_and_reuses_it_for_subsequent_calls.
@Test
public void getReporter_caches_result_and_reuses_it_for_subsequent_calls() {
// given
SignalFxReporter initialResult = factory.getReporter(metricRegistryMock);
verify(configuratorMock).apply(any(Builder.class));
// when
SignalFxReporter subsequentResult = factory.getReporter(metricRegistryMock);
// then
verifyNoMoreInteractions(configuratorMock);
assertThat(subsequentResult).isSameAs(initialResult);
}
Aggregations