Updated on 2023-11-21 GMT+08:00

Tracing

Overview

After enabling tracing on the Monitoring tab, you can view details on the Tracing page, or go to the APM console and choose Application Monitoring > Tracing. This feature is available only for Java 8 and 11 functions.

Prerequisites

  • Only functions with 512 MB or larger memory can be traced. For functions whose memory is less than 512 MB, increase the memory on the Configuration > Basic Settings page.
  • You have obtained the permission to use APM. For details, see section "APM Permissions Management". If tracing is not enabled, no trace data can be obtained.

Enabling Tracing

  1. Log in to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
  2. Click the name of the desired function.
  3. Choose Monitoring > Tracing.
  4. Click enable tracing.

    Figure 1 Enabling tracing

  5. The system automatically obtains an access key (AK/SK) from APM, as shown in Figure 2.

    Figure 2 Obtaining an access key
    • If an access key already exists, select an AK from the AK drop-down list and click OK.
    • If you do not have an access key, click Create AK/SK to create one on the APM console. For details, see . Then the new AK/SK will be synchronized to the FunctionGraph console.

  6. Manage tracing.

    • Click in the upper right corner. In this case, you cannot view function traces.
    • If the AK/SK has been changed on the APM console, you need to go to the FunctionGraph console and click in the upper right corner.

Querying Trace Details

  1. Return to the FunctionGraph console, choose Functions > Function List in the navigation pane, and click the name of a function with tracing enabled. The function details page is displayed.
  2. On the Monitoring tab page, choose Tracing.
  3. Set search criteria and click Search.

    Figure 3 Setting search criteria
    • Time: Set a time range to query traces. It can be up to 24 hours.
    • Response Time: Set the response time.
    • Execution Result: Select All, Successful, or Failed.
    • Trace ID: If you specify this parameter, all other search criteria become invalid and only the trace with the specified ID will be searched.

  4. View the trace details on the right.

    Viewing details about a trace: In the query result, click the trace name and view details on the APM console.

    Figure 4 Clicking a trace name
    Figure 5 Details about a trace
    Viewing information about all traces: Click go to APM to perform complete path analysis and other operations.
    Figure 6 Going to APM

    Example

    1. The following shows how function A (DemoTestA) invokes function B (DemoTestB) by sending an HTTP request.
      Figure 7 Function invocation details

      1. Total time consumed by a method of function A

      2. Invoking function B by sending an HTTP request

      3. Accessing function B

      4. Executing executeQuery

      5. Executing a SELECT statement to query data

    2. The following shows a complete function execution process that contains cold start.

      Spans are described as follows:

      • load: time for downloading and decompressing the function code package and dependency package
      • preload: time for loading function code and initializing the execution environment
      • init: execution duration of the initializer. The initializer is executed only during cold start.
      • processInvoke: execution duration of the function