Tutorial: Use Circuit Breaker Dashboard with Azure Spring Apps
Bài viết
Cảnh báo
Hystrix is no longer in active development and is currently in maintenance mode.
Lưu ý
The Basic, Standard, and Enterprise plans will be deprecated starting from mid-March, 2025, with a 3 year retirement period. We recommend transitioning to Azure Container Apps. For more information, see the Azure Spring Apps retirement announcement.
This article applies to: ✅ Basic/Standard ✅ Enterprise
This article shows you how to use Netflix Turbine and Netflix Hystrix on Azure Spring Apps. Spring Cloud Netflix Turbine is widely used to aggregate multiple Netflix Hystrix metrics streams so that streams can be monitored in a single view using Hystrix dashboard.
Lưu ý
Netflix Hystrix is widely used in many existing Spring apps but it's no longer in active development. If you're developing a new project, you should use Spring Cloud Circuit Breaker implementations like resilience4j instead. Different from Turbine shown in this tutorial, the new Spring Cloud Circuit Breaker framework unifies all implementations of its metrics data pipeline into Micrometer, which is also supported by Azure Spring Apps. For more information, see Collect Spring Cloud Resilience4J Circuit Breaker Metrics with Micrometer (Preview).
These apps don't use Config Server, so there's no need to set up Config Server for Azure Spring Apps. Create and deploy as follows:
Azure CLI
az configure --defaults \
group=<resource-group-name> \
spring=<Azure-Spring-Apps-instance-name>az spring app create --name user-service--assign-endpointaz spring app create --name recommendation-serviceaz spring app create --name hystrix-turbine--assign-endpointaz spring app deploy \
--name user-service \
--artifact-path user-service/target/user-service.jar
az spring app deploy \
--name recommendation-service \
--artifact-path recommendation-service/target/recommendation-service.jar
az spring app deploy \
--name hystrix-turbine \
--artifact-path hystrix-turbine/target/hystrix-turbine.jar
Verify your apps
After all the apps are running and discoverable, access user-service with the path https://<Azure-Spring-Apps-instance-name>-user-service.azuremicroservices.io/personalized/1 from your browser. If the user-service can access recommendation-service, you should get the following output. Refresh the web page a few times if it doesn't work.
Verify using public endpoints or private test endpoints.
Using public endpoints
Access hystrix-turbine with the path https://<SERVICE-NAME>-hystrix-turbine.azuremicroservices.io/hystrix from your browser. The following figure shows the Hystrix dashboard running in this app.
Copy the Turbine stream url https://<SERVICE-NAME>-hystrix-turbine.azuremicroservices.io/turbine.stream?cluster=default into the text box, and select Monitor Stream. This action displays the dashboard. If nothing shows in the viewer, hit the user-service endpoints to generate streams.
Lưu ý
In production, the Hystrix dashboard and metrics stream should not be exposed to the Internet.
Using private test endpoints
Hystrix metrics streams are also accessible from test-endpoint. As a backend service, we didn't assign a public end-point for recommendation-service, but we can show its metrics with test-endpoint at https://primary:<KEY>@<SERVICE-NAME>.test.azuremicroservices.io/recommendation-service/default/actuator/hystrix.stream
As a web app, Hystrix dashboard should be working on test-endpoint. If it isn't working properly, there may be two reasons: first, using test-endpoint changed the base URL from / to /<APP-NAME>/<DEPLOYMENT-NAME>, or, second, the web app is using absolute path for static resource. To get it working on test-endpoint, you might need to manually edit the <base> in the front-end files.
Tham gia chuỗi buổi gặp gỡ để xây dựng các giải pháp AI có thể mở rộng dựa trên các trường hợp sử dụng trong thế giới thực với các nhà phát triển và chuyên gia đồng nghiệp.