Exercise - application performance monitoring
In this exercise, with zero configuration, you'll effortlessly monitor data flows for your sample application.
Monitor the Application with Azure Application Insights
Application Map helps you spot performance bottlenecks or failure hot-spots across all components of your distributed application.
Open the Azure portal
Select "Azure Spring Apps" from the list of Azure services
Select your Azure Spring Apps instance
Select Application Insights to jump to the overview page of Application Insights.
On the left, navigate to Application Map where you can see a view of your Azure Spring Apps microservices:
Applications that are operating correctly (green) and those applications with bottlenecks (red). In the Application Map above, each of the names in green boxes are different services of your Azure Spring Apps. You can easily identify issues in their applications and quickly troubleshoot and fix them. Each node on the map represents a microservice or its dependencies with health KPI and alerts status. You can select from any component to more detailed diagnostics, such as Application Insights events.
Performance
On the left, navigate to Performance where you can see response times and request counts for operations exposed by your applications.
Next, on the right, navigate to Dependencies where you can see all your dependencies and their response times and request counts. You can see the performance number for dependencies, particularly SQL calls:
Select a SQL statement in the "Select operation tab" to see the transaction in context:
Next, on the Right tab, select "Drill into" and on the far right tab, and then select a SQL sample to open the transaction detail window:
Finally, in the transaction details view, view the sample sql statement transaction by selecting the sql statement:
Failures/Exceptions
Select Failures in the Application Insights resource menu located in the Investigate section. In this view, you'll see top three failure response codes, top three exception types, and top three failing dependency types.
On the right-hand side, select an exception in the "Top 3 exception types" for meaningful insights and actionable stack trace::
Next, on the right tab, select the "Suggested" exception sample to open the transaction detail window:
Next, view the exception properties in the transaction detail window:
Finally, in the middle of the screen, in the end-to-end transaction tab, select an exception to view its details and stacktrace:
Metrics
Spring Boot registers many core metrics: JVM, CPU, Tomcat, Logback... You can see metrics contributed by Spring Boot apps, Spring Apps modules, and dependencies.
To create a standard metric chart, under the Monitoring section, open the Metrics tab and follow these steps:
Ensure your Azure Spring Apps is selected under Scope and Azure Spring Apps under Metric Namespace. Both will already be populated if you opened the metrics explorer from the resource's menu.
Next, under metrics, select App CPU Usage and under aggregation, select Avg:
Next, save the first metric by selecting the "Tick" icon on the right-hand metric bar.
Next, add another metric by selecting the "Add metric" action on the top left-hand toolbar and add system.cpu.usage under Metric and Avg under Aggregation.
Next, save the second metric by selecting the "Tick" icon on the right-hand metric bar.
Finally, inspect your metrics graph with both the App and System CPU metrics
Custom Metrics
As you deploy resources and applications in Azure, you'll want to start collecting telemetry to gain insights into their performance and health. Azure makes some metrics available to you out of the box. These metrics are called standard or platform. However, they're limited in nature. You might want to collect some custom performance indicators or business-specific metrics to provide deeper insights.
Similarly to standard metric chart, to create a custom metric chart, under the Monitoring section, open the Metrics tab and follow these steps:
Ensure your Azure Spring Apps is selected in the resource scope picker. It will already be populated if you opened metrics explorer from the resource's menu.
Next, under namespaces, select the azure.applicationinsights namespace. The namespace is just a way to organize metrics so that you can easily find them.
Next, under metrics, add the following custom metrics and aggregation:
Next, on the top right-hand side, change the graph type to Area Chart
Your final graph will show the counts in the last 24 hours for each of the pet, vet, and owner microservices:
Live Metrics
When you deploy a new version of your web app, you want to know immediately its effect on performance. Have response times improved or worsened, or is it showing failures? Watch Live Metrics Stream in Application Insights while your deployment is happening, and you’ll see the effect immediately. If there are problems, you could back out the deployment before too many users are affected. Live Metrics Stream enables you to probe the beating heart of your live applications. You can select and filter metrics and performance counters to watch in real time, without any disturbance to your service. You can also inspect stack traces from sample failed requests and exceptions.