RetryMetricsCollector extends Collector { public static RetryMetricsCollector ofRetryRegistry(MetricNames names, RetryRegistry retryRegistry) { return new RetryMetricsCollector(names, retryRegistry); } private  RetryMetricsCollector(MetricNames names, RetryRegistry retryRegistry); static RetryMetricsCollector ofRetryRegistry(MetricNames names,
        RetryRegistry retryRegistry); static RetryMetricsCollector ofRetryRegistry(RetryRegistry retryRegistry); @Override List<MetricFamilySamples> collect();  }
@Test public void customMetricNamesOverrideDefaultOnes() { CollectorRegistry registry = new CollectorRegistry(); RetryMetricsCollector.ofRetryRegistry( RetryMetricsCollector.MetricNames.custom() .callsMetricName("custom_resilience4j_retry_calls") .build(), retryRegistry).register(registry); assertThat(registry.getSampleValue( "custom_resilience4j_retry_calls", new String[]{"name", "kind"}, new String[]{"backendA", "successful_without_retry"} )).isNotNull(); assertThat(registry.getSampleValue( "custom_resilience4j_retry_calls", new String[]{"name", "kind"}, new String[]{"backendA", "failed_with_retry"} )).isNotNull(); }