use of com.nike.riposte.metrics.codahale.CodahaleMetricsListener.DefaultMetricNamingStrategy in project riposte by Nike-Inc.
the class CodahaleMetricsListenerTest method verifyServerStatisticMetrics.
private void verifyServerStatisticMetrics(CodahaleMetricsListener instance) {
String prefix = ((DefaultMetricNamingStrategy) instance.serverStatsMetricNamingStrategy).prefix;
assertThat(instance.getInflightRequests()).isSameAs(instance.inflightRequests);
verify(metricRegistryMock).counter(name(prefix, "inflight_requests"));
assertThat(instance.inflightRequests).isSameAs(registeredCounterMocks.get(name(prefix, "inflight_requests")));
assertThat(instance.getProcessedRequests()).isSameAs(instance.processedRequests);
verify(metricRegistryMock).counter(name(prefix, "processed_requests"));
assertThat(instance.processedRequests).isSameAs(registeredCounterMocks.get(name(prefix, "processed_requests")));
assertThat(instance.getFailedRequests()).isSameAs(instance.failedRequests);
verify(metricRegistryMock).counter(name(prefix, "failed_requests"));
assertThat(instance.failedRequests).isSameAs(registeredCounterMocks.get(name(prefix, "failed_requests")));
assertThat(instance.getResponseWriteFailed()).isSameAs(instance.responseWriteFailed);
verify(metricRegistryMock).counter(name(prefix, "response_write_failed"));
assertThat(instance.responseWriteFailed).isSameAs(registeredCounterMocks.get(name(prefix, "response_write_failed")));
assertThat(instance.getResponseSizes()).isSameAs(instance.responseSizes);
verify(metricRegistryMock).register(name(prefix, "response_sizes"), instance.responseSizes);
assertThat(instance.responseSizes).isSameAs(registeredHistogramMocks.get(name(prefix, "response_sizes")));
assertThat(instance.getRequestSizes()).isSameAs(instance.requestSizes);
verify(metricRegistryMock).register(name(prefix, "request_sizes"), instance.requestSizes);
assertThat(instance.requestSizes).isSameAs(registeredHistogramMocks.get(name(prefix, "request_sizes")));
}
use of com.nike.riposte.metrics.codahale.CodahaleMetricsListener.DefaultMetricNamingStrategy in project riposte by Nike-Inc.
the class CodahaleMetricsListenerTest method metricNamingStrategy_defaultImpl_with_args_method_works_as_expected.
@Test
public void metricNamingStrategy_defaultImpl_with_args_method_works_as_expected() {
// given
String prefix = UUID.randomUUID().toString();
String wordDelimiter = UUID.randomUUID().toString();
// when
MetricNamingStrategy result = MetricNamingStrategy.defaultImpl(prefix, wordDelimiter);
// then
assertThat(result).isInstanceOf(DefaultMetricNamingStrategy.class);
DefaultMetricNamingStrategy defStrat = (DefaultMetricNamingStrategy) result;
assertThat(defStrat.prefix).isEqualTo(prefix);
assertThat(defStrat.wordDelimiter).isEqualTo(wordDelimiter);
}
Aggregations