Skip to content

Commit ac198b2

Browse files
Merge pull request #228446 from brhamilton529/screens-resilience4j
Screenshot update: Collect Spring Cloud Resilience4j
2 parents d2fa6c2 + a0c0675 commit ac198b2

File tree

14 files changed

+59
-51
lines changed

14 files changed

+59
-51
lines changed

articles/spring-apps/how-to-circuit-breaker-metrics.md

Lines changed: 59 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -16,54 +16,58 @@ ms.custom: devx-track-java, devx-track-azurecli, event-tier1-build-2022
1616
1717
**This article applies to:** ✔️ Basic/Standard tier ✔️ Enterprise tier
1818

19-
This article shows you 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.
19+
This article shows you how to collect Spring Cloud Resilience4j Circuit Breaker Metrics with Application Insights Java in-process agent. With this feature, you can monitor the metrics of Resilience4j circuit breaker from Application Insights with Micrometer.
2020

21-
We use the [spring-cloud-circuit-breaker-demo](https://github.com/spring-cloud-samples/spring-cloud-circuitbreaker-demo) to show how it works.
21+
The demo [spring-cloud-circuit-breaker-demo](https://github.com/spring-cloud-samples/spring-cloud-circuitbreaker-demo) shows how the monitoring works.
2222

2323
## Prerequisites
2424

2525
* Enable Java In-Process agent from the [Java In-Process Agent for Application Insights guide](./how-to-application-insights.md#manage-application-insights-using-the-azure-portal).
2626
* Enable dimension collection for resilience4j metrics from the [Application Insights guide](../azure-monitor/app/pre-aggregated-metrics-log-metrics.md#custom-metrics-dimensions-and-pre-aggregation).
27-
* Install git, Maven, and Java, if not already in use by the development computer.
27+
* Install Git, Maven, and Java, if not already installed on the development computer.
2828

2929
## Build and deploy apps
3030

31-
The following procedure builds and deploys apps.
31+
Use the following steps to build and deploy the sample applications.
3232

3333
1. Clone and build the demo repository.
3434

35-
```bash
36-
git clone https://github.com/spring-cloud-samples/spring-cloud-circuitbreaker-demo.git
37-
cd spring-cloud-circuitbreaker-demo && mvn clean package -DskipTests
38-
```
39-
40-
2. Create applications with endpoints
41-
42-
```azurecli
43-
az spring app create
44-
--resource-group ${resource-group-name} \
45-
--name resilience4j \
46-
--service ${Azure-Spring-Apps-instance-name} \
47-
--assign-endpoint
48-
az spring app create \
49-
--resource-group ${resource-group-name} \
50-
--service ${Azure-Spring-Apps-instance-name} \
51-
--name reactive-resilience4j \
52-
--assign-endpoint
53-
```
54-
55-
3. Deploy applications.
56-
57-
```azurecli
58-
az spring app deploy -n resilience4j \
59-
--jar-path ./spring-cloud-circuitbreaker-demo-resilience4j/target/spring-cloud-circuitbreaker-demo-resilience4j-0.0.1.BUILD-SNAPSHOT.jar \
60-
-s ${service_name} -g ${resource_group}
61-
az spring app deploy -n reactive-resilience4j \
62-
--jar-path ./spring-cloud-circuitbreaker-demo-reactive-resilience4j/target/spring-cloud-circuitbreaker-demo-reactive-resilience4j-0.0.1.BUILD-SNAPSHOT.jar \
63-
-s ${service_name} -g ${resource_group}
64-
```
65-
66-
> [!Note]
35+
```bash
36+
git clone https://github.com/spring-cloud-samples/spring-cloud-circuitbreaker-demo.git
37+
cd spring-cloud-circuitbreaker-demo && mvn clean package -DskipTests
38+
```
39+
40+
1. Create applications with endpoints.
41+
42+
```azurecli
43+
az spring app create \
44+
--resource-group ${resource-group-name} \
45+
--service ${Azure-Spring-Apps-instance-name} \
46+
--name resilience4j \
47+
--assign-endpoint
48+
az spring app create \
49+
--resource-group ${resource-group-name} \
50+
--service ${Azure-Spring-Apps-instance-name} \
51+
--name reactive-resilience4j \
52+
--assign-endpoint
53+
```
54+
55+
1. Deploy applications.
56+
57+
```azurecli
58+
az spring app deploy \
59+
--resource-group ${resource-group-name} \
60+
--service ${Azure-Spring-Apps-instance-name} \
61+
--name resilience4j \
62+
--jar-path ./spring-cloud-circuitbreaker-demo-resilience4j/target/spring-cloud-circuitbreaker-demo-resilience4j-0.0.1.BUILD-SNAPSHOT.jar
63+
az spring app deploy \
64+
--resource-group ${resource-group-name} \
65+
--service ${Azure-Spring-Apps-instance-name} \
66+
--name reactive-resilience4j \
67+
--jar-path ./spring-cloud-circuitbreaker-demo-reactive-resilience4j/target/spring-cloud-circuitbreaker-demo-reactive-resilience4j-0.0.1.BUILD-SNAPSHOT.jar
68+
```
69+
70+
> [!NOTE]
6771
>
6872
> * Include the required dependency for Resilience4j:
6973
>
@@ -78,9 +82,9 @@ az spring app deploy -n reactive-resilience4j \
7882
> </dependency>
7983
> ```
8084
>
81-
> * 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](https://spring.io/projects/spring-cloud-circuitbreaker#overview).
85+
> * Your code must use the `CircuitBreakerFactory` API, which is implemented as a `bean` automatically created when you include a Spring Cloud Circuit Breaker starter. For more information, see [Spring Cloud Circuit Breaker](https://spring.io/projects/spring-cloud-circuitbreaker#overview).
8286
>
83-
> * The following 2 dependencies have conflicts with resilient4j packages above. Be sure the customer does not include them.
87+
> * The following two dependencies have conflicts with Resilient4j packages. Be sure you don't include them.
8488
>
8589
> ```xml
8690
> <dependency>
@@ -102,31 +106,35 @@ az spring app deploy -n reactive-resilience4j \
102106
> /get/fluxdelay/{seconds}
103107
> ```
104108
105-
## Locate Resilence4j Metrics from Portal
109+
## Locate Resilence4j Metrics on the Azure portal
110+
111+
1. In your Azure Spring Apps instance, select **Application Insights** in the navigation pane and then select **Application Insights** on the page.
112+
113+
:::image type="content" source="media/how-to-circuit-breaker-metrics/application-insights.png" alt-text="Screenshot of the Azure portal showing the Azure Spring Apps Application Insights page with the Application Insights on the button bar highlighted." lightbox="media/how-to-circuit-breaker-metrics/application-insights.png":::
106114
107-
1. Select the **Application Insights** Blade from Azure Spring Apps portal, and select **Application Insights**.
115+
1. Select **Metrics** in the navigation pane. The **Metrics** page provides dropdown menus and options to define the charts in this procedure. For all charts, set **Metric Namespace** to **azure.applicationinsights**.
108116
109-
[ ![resilience4J 0](media/spring-cloud-resilience4j/resilience4J-0.png)](media/spring-cloud-resilience4j/resilience4J-0.png#lightbox)
117+
:::image type="content" source="media/how-to-circuit-breaker-metrics/chart-menus.png" alt-text="Screenshot of the Azure portal Application Insights Metrics page, with Metrics highlighted in the navigation pane, and with azure-applicationinsights highlighted in the Metric Namespace dropdown menu." lightbox="media/how-to-circuit-breaker-metrics/chart-menus.png":::
110118
111-
2. Select **Metrics** from the **Application Insights** page. Select **azure.applicationinsights** from **Metrics Namespace**. Also select **resilience4j_circuitbreaker_buffered_calls** metrics with **Average**.
119+
1. Set **Metric** to **resilience4j_circuitbreaker_buffered_calls**, and then set **Aggregation** to **Avg**.
112120
113-
[ ![resilience4J 1](media/spring-cloud-resilience4j/resilience4J-1.png)](media/spring-cloud-resilience4j/resilience4J-1.png#lightbox)
121+
:::image type="content" source="media/how-to-circuit-breaker-metrics/buffered-calls.png" alt-text="Screenshot of the Azure portal Application Insights Metrics page showing a chart with Metric set to circuit breaker buffered calls and Aggregation set to Average." lightbox="media/how-to-circuit-breaker-metrics/buffered-calls.png":::
114122
115-
3. Select **resilience4j_circuitbreaker_calls** metrics and **Average**.
123+
1. Set **Metric** to **resilience4j_circuitbreaker_calls**, and then set **Aggregation** to **Avg**.
116124
117-
[ ![resilience4J 2](media/spring-cloud-resilience4j/resilience4J-2.png)](media/spring-cloud-resilience4j/resilience4J-2.png#lightbox)
125+
:::image type="content" source="media/how-to-circuit-breaker-metrics/calls.png" alt-text="Screenshot of the Azure portal Application Insights Metrics page showing a chart with Metric set to circuit breaker calls and Aggregation set to Average." lightbox="media/how-to-circuit-breaker-metrics/calls.png":::
118126
119-
4. Select **resilience4j_circuitbreaker_calls** metrics and **Average**. Select **Add filter**, and then select name as **createNewAccount**.
127+
1. Set **Metric** to **resilience4j_circuitbreaker_calls**, and then set **Aggregation** to **Avg**. Select **Add filter** and set **Name** to **Delay**.
120128
121-
[ ![resilience4J 3](media/spring-cloud-resilience4j/resilience4J-3.png)](media/spring-cloud-resilience4j/resilience4J-3.png#lightbox)
129+
:::image type="content" source="media/how-to-circuit-breaker-metrics/calls-filter.png" alt-text="Screenshot of the Azure portal Application Insights Metrics page showing a chart with Metric set to circuit breaker calls and Aggregation set to Average, and with Filter set to the name Delay." lightbox="media/how-to-circuit-breaker-metrics/calls-filter.png":::
122130
123-
5. Select **resilience4j_circuitbreaker_calls** metrics and **Average**. Then select **Apply splitting**, and select **kind**.
131+
1. Set **Metric** to **resilience4j_circuitbreaker_calls**, and then set **Aggregation** to **Avg**. Select **Apply splitting** and set **Split by** to **kind**.
124132
125-
[ ![resilience4J 4](media/spring-cloud-resilience4j/resilience4J-4.png)](media/spring-cloud-resilience4j/resilience4J-4.png#lightbox)
133+
:::image type="content" source="media/how-to-circuit-breaker-metrics/calls-splitting.png" alt-text="Screenshot of the Azure portal Application Insights Metrics page showing a chart with Metric set to circuit breaker calls and Aggregation set to Average, and with Apply splitting selected with Split by set to kind." lightbox="media/how-to-circuit-breaker-metrics/calls-splitting.png":::
126134
127-
6. Select **resilience4j_circuitbreaker_calls**, `**resilience4j_circuitbreaker_buffered_calls**, and **resilience4j_circuitbreaker_slow_calls** metrics with **Average**.
135+
1. Set **Metric** to **resilience4j_circuitbreaker_calls**, and then set **Aggregation** to **Avg**. Select **Add metric** and set **Metric** to **resilience4j_circuitbreaker_buffered_calls**, and then set **Aggregation** to **Avg**. Select **Add metric** again and set **Metric** to **resilience4j_circuitbreaker_slow_calls**, and then set **Aggregation** set to **Avg**.
128136
129-
[ ![resilience4J 5](media/spring-cloud-resilience4j/resilience4j-5.png)](media/spring-cloud-resilience4j/resilience4j-5.png#lightbox)
137+
:::image type="content" source="media/how-to-circuit-breaker-metrics/slow-calls.png" alt-text="Screenshot of the Azure portal Application Insights Metrics page showing three charts: A chart with Metric set to circuit breaker calls and Aggregation set to Average. A chart with Metric set to circuit breaker calls buffered and Aggregation set to Average. A chart with Metric set to circuit breaker slow calls and Aggregation set to Average." lightbox="media/how-to-circuit-breaker-metrics/slow-calls.png":::
130138
131139
## Next steps
132140
75.1 KB
Loading
86.2 KB
Loading
108 KB
Loading
142 KB
Loading
104 KB
Loading
81.7 KB
Loading
109 KB
Loading
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)