Search in sources :

Example 6 with RetryRegistry

use of io.github.resilience4j.retry.RetryRegistry in project resilience4j by resilience4j.

the class RetryMetricsTest method shouldRegisterMetrics.

@Test
public void shouldRegisterMetrics() {
    RetryRegistry retryRegistry = RetryRegistry.ofDefaults();
    retryRegistry.retry("testName");
    RetryMetrics retryMetrics = RetryMetrics.ofRetryRegistry(retryRegistry);
    retryMetrics.bindTo(meterRegistry);
    final List<String> metricNames = meterRegistry.getMeters().stream().map(Meter::getId).map(Meter.Id::getName).collect(Collectors.toList());
    final List<String> expectedMetrics = newArrayList("resilience4j.retry.testName.successful_calls_with_retry", "resilience4j.retry.testName.failed_calls_with_retry", "resilience4j.retry.testName.successful_calls_without_retry", "resilience4j.retry.testName.failed_calls_without_retry");
    assertThat(metricNames).hasSameElementsAs(expectedMetrics);
}
Also used : Meter(io.micrometer.core.instrument.Meter) RetryRegistry(io.github.resilience4j.retry.RetryRegistry) Test(org.junit.Test)

Aggregations

RetryRegistry (io.github.resilience4j.retry.RetryRegistry)6 Retry (io.github.resilience4j.retry.Retry)4 Test (org.junit.Test)4 RetryConfig (io.github.resilience4j.retry.RetryConfig)2 IntervalFunction (io.github.resilience4j.core.IntervalFunction)1 Meter (io.micrometer.core.instrument.Meter)1 Duration (java.time.Duration)1 WebServiceException (javax.xml.ws.WebServiceException)1 RetryExtension (org.apache.servicecomb.governance.handler.ext.RetryExtension)1 GovernanceRequest (org.apache.servicecomb.governance.marker.GovernanceRequest)1 RetryPolicy (org.apache.servicecomb.governance.policy.RetryPolicy)1 RetryProperties (org.apache.servicecomb.governance.properties.RetryProperties)1 GovernanceUtils (org.apache.servicecomb.governance.utils.GovernanceUtils)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 Component (org.springframework.stereotype.Component)1