All Products
Search
Document Center

Application Real-Time Monitoring Service:Identify business exceptions by analyzing traces and logs

Last Updated:Feb 22, 2024

To decrease the difficulty and improve the efficiency in identifying business exceptions, you can use the Application Monitoring sub-service of Application Real-Time Monitoring Service (ARMS) together with traces and logs to efficiently and accurately identify business exceptions. This improves the efficiency of development and diagnostics in a microservices framework.

Prerequisites

Background information

Before you identify business exceptions by analyzing traces and logs, you must understand the following terms: metric, tracing, and logging.

  • Metric: The key metrics of an application include Application Service Request, Application Service Average Response Time, and Application Dependent Service Request.

  • Tracing: All activities of an application, such as interface calls and responses, are recorded in traces.

  • Logging: All activities of an application, such as interface calls and responses, are recorded in business logs.

When a business exception occurs, the statistical chart for an application metric shows obvious fluctuations. You can roughly analyze the business exception based on the chart. You can also analyze the complete traces and business logs to accurately identify the business exception.

Associate business logs with trace IDs

  1. Log on to the ARMS console. In the left-side navigation pane, choose Application Monitoring > Applications.

  2. On the Applications page, select a region in the top navigation bar and click the name of the application that you want to manage.

    Note

    If the Java图标 icon is displayed in the Language column, the application is connected to Application Monitoring. If a hyphen (-) is displayed, the application is connected to Managed Service for OpenTelemetry.

  3. In the left-side navigation pane, click Application Settings. On the page that appears, click the Custom Configuration tab.

  4. In the Log Collect Configuration section of the Custom Configuration tab, set the log source to Associated Log, turn on Link Business Logs with TraceId, select the region where Simple Log Service resources are deployed, and then select the project and Logstore that you created.

    Link Business Logs with TraceId

  5. On the Custom Configuration tab, click Save.

Troubleshoot business exceptions from the perspective of application metrics

  1. Log on to the ARMS console. In the left-side navigation pane, choose Application Monitoring > Applications.

  2. On the Applications page, select a region in the top navigation bar and click the name of the application that you want to manage.

    Note

    If the Java图标 icon is displayed in the Language column, the application is connected to Application Monitoring. If a hyphen (-) is displayed, the application is connected to Managed Service for OpenTelemetry.

  3. In the left-side navigation pane, click Application Overview. On the page that appears, click the Overview tab in the upper part and select or set a time range to query in the upper-right corner.

    The Overview tab displays key metrics of the application, including Application Service Request, Application Service Average Response Time, and Application Dependent Service Request.

  4. On the Overview tab of the Application Overview page, select a time range in the chart of an application metric.

    In this example, the Application Service Average Response Time metric is used.Application Service Average Response Time

  5. View the traces that were generated in the time range selected in Step 4.

    1. Click View CallChain selected time.

    2. In the panel that appears, find the trace record whose status is 报错 and click the trace ID in the TraceId column.

      You can also click View Logs in the Actions column to view the business logs that were generated at the specified point in time and analyze the cause of the business exception.EXception-Traceid

    3. Click the Traces tab and then click the 放大图标 icon in the Details column.

    4. In the Details panel, click the Method Stack tab. Error messages are displayed. You can move the pointer over the error message to view the cause of the exception.

      Exception

  6. View the business logs that were generated in the time range selected in Step 4.

    1. Click View Log selected time.

    2. On the log analysis page, find the error message of the business exception and identify the cause of the business exception.

      Log Analysis

Troubleshoot business exceptions from the perspective of interface calls

  1. Log on to the ARMS console. In the left-side navigation pane, choose Application Monitoring > Applications.

  2. On the Applications page, select a region in the top navigation bar and click the name of the application that you want to manage.

    Note

    If the Java图标 icon is displayed in the Language column, the application is connected to Application Monitoring. If a hyphen (-) is displayed, the application is connected to Managed Service for OpenTelemetry.

  3. In the left-side navigation pane, click Interface Invocation.

  4. On the Interface Invocation page, click the interface whose traces you want to query in the interface list and click the Interface Snapshot tab on the right.

  5. On the Interface Snapshot tab, find the trace whose status is 报错.

    Interface Snapshot-Exception

  6. View the trace of the interface.

    1. Find the trace, and click the trace ID in the TraceId column.

    2. Click the Traces tab and then click the 放大图标 icon in the Details column.

    3. In the Details panel, click the Method Stack tab. Error messages are displayed. You can move the pointer over the error message to view the cause of the exception.

      Exception

  7. View the logs for the interface.

    1. Find the interface record, and click View Logs in the Actions column.

    2. On the log analysis page, find the error message of the business exception and identify the cause of the business exception.

      Log Analysis

References

You can create alert rules to detect anomalies for metrics. For more information, see Application Monitoring alert rules.