Troubleshoot application exceptions using failed and slow traces

Updated at:

In a production environment, application exceptions, such as sudden increases in latency or error rates, can have many causes. Common causes include uneven traffic distribution, single-server failures, program errors, and faults in dependent components. Before you launch a new application or prepare for a major promotional event, we recommend that you perform systematic performance tuning. Analyze the performance bottlenecks of your system and identify the interfaces and components that frequently fail or have high latency. This topic describes how to use the Wrong/slow Trace analysis feature of ARMS Trace Explorer to locate the causes of failed and slow calls, troubleshoot issues, and identify system performance bottlenecks.

Prerequisite

You have installed an ARMS agent for the application. For more information, see Integration Center.

Troubleshoot failed calls

Step 1: Identify failed call time

  1. Log on to the Cloud Monitor 2.0 console, and select a workspace. In the navigation pane on the left, select Application Insights > Application List.

  2. In the top navigation bar, click Trace Explorer.

    The sample application mall-gateway experienced several HTTP errors between 15:20 and 15:28.

    image

  3. Adjust the time range to the period when the HTTP errors occurred.

    On the ARMS Trace Explorer page, review monitoring metrics for the mall-gateway application within the 8-minute window, such as the number of calls, HTTP 500 errors, and time percentiles, to confirm when the abnormal calls occurred.

Step 2: Pinpoint the error source

On the Wrong/slow Trace analysis tab, the failed traces are concentrated in the /components/api/v1/mall/product interface, and all returned 500 errors.

Investigate /components/api/v1/mall/product

  1. In the chart below, click spanName: /components/api/v1/mall/product.

    image

    Trace Explorer automatically sets the filter condition to serviceName="mall-gateway" AND spanName="/components/api/v1/mall/product".

    All traces for the /components/api/v1/mall/product interface have failed.

    A total of 1,440 calls are retrieved, all of which returned HTTP 500 errors. Click the Wrong/slow Trace analysis tab. A message indicates that all traces under the current filter conditions failed and that the root cause has been located.

  2. On the List tab, click Details next to any trace.

    The trace details page shows a total duration of 35 ms for this trace, containing three spans: mall-gateway (/components/api/v1/mall/product, status code 500, duration 30 ms) calls mall-user-server (/components/api/v1/http/success, status code 500, duration 5 ms) and mall-kafka-producer (/components/api/v1/mall/save_order_info, status code 200, duration 1 ms). Select the mall-user-server span. In the Additional Information section, the attribute details show that http.status_code is 500, confirming the error originated from the mall-user-server interface.

Identify slow interfaces

Step 1: Identify slow call time

  1. Log on to the Cloud Monitor 2.0 console, and select a workspace. In the navigation pane on the left, select Application Insights > Application List.

  2. In the top navigation bar, click Trace Explorer.

    The sample application mall-user-server experienced numerous calls exceeding 5s between 15:40 and 15:49.

    image

  3. Adjust the time range to the period when the slow calls occurred.

    Use the time selector in the upper-right corner of the Trace Explorer page for this adjustment.

  4. On the Wrong/slow Trace analysis tab, set the time-consuming threshold to 5000 ms.

    The analysis reveals the following key contributors to slow calls: The top contributor (Contribution: 0.65) is the interface name /components/api/v1/http/success, which accounts for 100.0% of slow traces but only 35.4% of normal traces. The second contributor (Contribution: 0.78) is the HTTP response status code 200, which accounts for 100.0% of slow traces but only 22.4% of normal traces. The third contributor (Contribution: 0.52) is the namespace arms-test, which accounts for 100.0% of slow traces but only 47.9% of normal traces.

Step 2: Pinpoint the slow call source

On the Wrong/slow Trace analysis tab, the slow traces are primarily associated with spans that have the interface name /components/api/v1/http/success, use the EagleEye reporting protocol, and belong to the arms-test namespace. Investigate each one.

Investigate /components/api/v1/http/success

In the chart below, click spanName: /components/api/v1/http/success.

image

Trace Explorer automatically sets the filter condition to serviceName="mall-user-server" AND spanName="/components/api/v1/http/success".

Under this filter condition, every call takes more than 5s, confirming that the /components/api/v1/http/success interface is the root cause of the slow calls.

In the Time Percentile section, you can also see that the average call duration exceeds 5s.

image

Investigate spans with attributes._arms.trace.protocol.type=EagleEye

In the chart below, click attributes._arms.trace.protocol.type: EagleEye.

image

Trace Explorer automatically sets the filter condition to serviceName="mall-user-server" AND attributes._arms.trace.protocol.type="EagleEye".

Under this filter condition, the slow traces also point to the /components/api/v1/http/success interface.

If you add the /components/api/v1/http/success interface to the filter conditions, every call takes more than 5 seconds.

In the Time Percentile area (with the filter condition serviceName="mall-user-server" AND attributes._arms.trace.protocol.type="EagleEye" AND spanName="/components/api/v1/http/success"), you can also see that the average call duration exceeds 5s, and all percentile latencies are over 5000 ms.

Investigate spans in arms-test namespace

With the filter condition serviceName="mall-user-server" AND attributes.namespace="arms-test", the slow traces still point to the /components/api/v1/http/success interface.

On the Wrong/slow Trace analysis tab, based on a random sample analysis of 54 slow traces and 312 normal traces (with a slow trace threshold of ≥5s), the top key characteristic shows that this interface accounts for 100.0% of slow traces and 0.0% of normal traces.

If you add the /components/api/v1/http/success interface to the filter conditions, every call takes more than 5 seconds.

This investigation concludes that all slow calls originate from the /components/api/v1/http/success interface. The attributes._arms.trace.protocol.type="EagleEye" and arms-test namespace are not the root cause. They appear in the analysis because the /components/api/v1/http/success service is deployed in the arms-test namespace and reports traces using the EagleEye protocol.