This topic describes how to enable Tracing Analysis and view the trace information about a function in the Function Compute console.

Background information

Overview

Enable Tracing Analysis

  1. Log on to the Function Compute console. In the left-side navigation pane, click Services & Functions.
  2. In the top navigation bar, select a region. On the Services page, find the desired service and click Configure in the Actions column.
  3. In the Tracing Analysis Settings section of the Modify Service page, set the Tracing Analysis parameter to Enable, and click Save.

You can enable Tracing Analysis when you create a service. For more information, see Create a service.

Note After you enable Tracing Analysis, Tracing Analysis is enabled for all functions in the service.

View the trace information of a function

After Tracing Analysis is enabled for your service, Function Compute automatically records the trace information of all functions in the service.

  1. Log on to the Function Compute console. In the left-side navigation pane, click Services & Functions.
  2. In the top navigation bar, select a region. On the Services page, click the desired service.
  3. On the Functions page, click the name of the desired function. On the Function Details page that appears, click the Tracing tab.
    You can view the trace information of the function. For more information, see Analyze traces. Tracing Analysis tab
  4. On the Tracing tab, click a trace ID on the Invocation Trace tab to view the detailed information.
    cold-start

    The following items describe the parameters:

    Note If a request does not encounter a cold start, the trace does not contain the cold start and Initializer durations.
    • TracingService/TracingFunction: the total stay time of the current request in Function Compute. By default, this span is named in the format of serviceName/functionName.
    • ColdStart: the cold start time of the system for the function. A cold start does not occur every time you invoke a function, and occurs only when you reapply for the execution environment.
      • PrepareCode: the time that is taken to download code or a custom image for the function. If the time indicated by the PrepareCode span is too long, simplify the code package to reduce the time that is taken to prepare code.
      • RuntimeInitialization: the time that is taken to start the execution environment, including the time that is taken to start an instance and the time that is taken to perform health check on the instance. In a custom runtime and a custom image, if the time indicated by the RuntimeInitialization span is too long, check the startup behavior of the corresponding HTTP server and image.
    • Initializer: the time that is taken to execute the initialization function. The initialization function is executed only when the container is cold started.
    • Invocation: the time that is taken to execute the function. You can check the context of Invocation in the function to obtain the execution time.