TaggedCircuitBreakerMetrics createMetrics(CircuitBreakerRegistry registry, String mappingName) {
String bufferedCallsMetricName = metricName(mappingName, CIRCUIT_BREAKER_METRICS_NAME, "buffered-calls");
String callsMetricName = metricName(mappingName, CIRCUIT_BREAKER_METRICS_NAME, "calls");
String stateMetricName = metricName(mappingName, CIRCUIT_BREAKER_METRICS_NAME, "state");
String failureRateMetricName = metricName(mappingName, CIRCUIT_BREAKER_METRICS_NAME, "failure-rate");
String slowCallRateMetricName = metricName(mappingName, CIRCUIT_BREAKER_METRICS_NAME, "slow-calls-rate");
String slowCallsMetricName = metricName(mappingName, CIRCUIT_BREAKER_METRICS_NAME, "slow-calls");
TaggedCircuitBreakerMetrics.MetricNames metricNames = TaggedCircuitBreakerMetrics.MetricNames.custom()
.bufferedCallsMetricName(bufferedCallsMetricName)
.callsMetricName(callsMetricName)
.stateMetricName(stateMetricName)
.failureRateMetricName(failureRateMetricName)
.slowCallRateMetricName(slowCallRateMetricName)
.slowCallsMetricName(slowCallsMetricName)
.build();
return ofCircuitBreakerRegistry(metricNames, registry);
}
@PostConstruct
public void init() {
if (factory != null) {
TaggedCircuitBreakerMetrics
.ofCircuitBreakerRegistry(factory.getCircuitBreakerRegistry())
.bindTo(meterRegistry);
}
}
@PostConstruct
public void init() {
if (factory != null) {
TaggedCircuitBreakerMetrics
.ofCircuitBreakerRegistry(factory.getCircuitBreakerRegistry())
.bindTo(meterRegistry);
}
}
@Bean
@ConditionalOnProperty(value = "resilience4j.circuitbreaker.metrics.legacy.enabled", havingValue = "true")
@ConditionalOnMissingBean
public TaggedCircuitBreakerMetrics registerCircuitBreakerMetrics(
CircuitBreakerRegistry circuitBreakerRegistry) {
return TaggedCircuitBreakerMetrics.ofCircuitBreakerRegistry(circuitBreakerRegistry);
}