Collect Spring Cloud Resilience4J Circuit Breaker Metrics with Micrometer (Preview)

This document explains how to collect Spring Cloud Resilience4j Circuit Breaker Metrics with Application Insights java in-process agent. With this feature you can monitor metrics of resilience4j circuit breaker from Application Insights with Micrometer.

We use the spring-cloud-circuit-breaker-demo to show how it works.


Build and deploy apps

The following procedure builds and deploys apps.

  1. Clone and build the demo repository.
git clone
cd spring-cloud-circuitbreaker-demo && mvn clean package -DskipTests
  1. Create applications with endpoints
az spring-cloud app create --name resilience4j --assign-endpoint \
    -s ${asc-service-name} -g ${asc-resource-group}
az spring-cloud app create --name reactive-resilience4j --assign-endpoint \
    -s ${asc-service-name} -g ${asc-resource-group}
  1. Deploy applications.
az spring-cloud app deploy -n resilience4j \
    --jar-path ./spring-cloud-circuitbreaker-demo-resilience4j/target/spring-cloud-circuitbreaker-demo-resilience4j-0.0.1.BUILD-SNAPSHOT.jar \
    -s ${service_name} -g ${resource_group}
az spring-cloud app deploy -n reactive-resilience4j \
    --jar-path ./spring-cloud-circuitbreaker-demo-reactive-resilience4j/target/spring-cloud-circuitbreaker-demo-reactive-resilience4j-0.0.1.BUILD-SNAPSHOT.jar \
    -s ${service_name} -g ${resource_group}


  • Include the required dependency for Resilience4j:

  • The customer code must use the API of CircuitBreakerFactory, which is implemented as a bean automatically created when you include a Spring Cloud Circuit Breaker starter. For details see Spring Cloud Circuit Breaker.

  • The following 2 dependencies have conflicts with resilient4j packages above. Be sure the customer does not include them.


Navigate to the URL provided by gateway applications, and access the endpoint from spring-cloud-circuit-breaker-demo as follows:


Locate Resilence4j Metrics from Portal

  1. Select the Application Insights Blade from Azure Spring Cloud portal, and select Application Insights.

    resilience4J 0

  2. Select Metrics from the Application Insights page. Select azure.applicationinsights from Metrics Namespace. Also select resilience4j_circuitbreaker_buffered_calls metrics with Average.

    resilience4J 1

  3. Select resilience4j_circuitbreaker_calls metrics and Average.

    resilience4J 2

  4. Select resilience4j_circuitbreaker_calls metrics and Average. Select Add filter, and then select name as createNewAccount.

    resilience4J 3

  5. Select resilience4j_circuitbreaker_calls metrics and Average. Then select Apply splitting, and select kind.

    resilience4J 4

  6. Select resilience4j_circuitbreaker_calls, `resilience4j_circuitbreaker_buffered_calls, and resilience4j_circuitbreaker_slow_calls metrics with Average.

    resilience4J 5

See also