This topic shows you how to configure Tracing Analysis, use custom Tracing Analysis endpoints, and view the trace information of a function in the Function Compute console.

Background information

Overview

Configure Tracing Analysis when you create a service

  1. Log on to the Function Compute console.
  2. In the left-side navigation pane, click Services and Functions.
  3. In the top navigation bar, select the region where your Kubernetes cluster is deployed.
  4. On the Services page, click Create Service.
    create_service_new
  5. In the Create Service panel, set Service Name, select Enable next to Tracing Analysis Features, and then click OK.
    Note When Enable Tracing Analysis is selected, Tracing Analysis is enabled for all functions in the service.
    lianluzhuizongpeizhichuangjianfuwu

Configure Tracing Analysis after a service is created

  1. Log on to the Function Compute console.
  2. In the left-side navigation pane, click Services and Functions.
  3. In the top navigation bar, select the region where your Kubernetes cluster is deployed.
  4. On the Services page, find the target service. In the Actions column, click Configure.
  5. In the Tracing Analysis Configuration section of the Edit Service page, select Enable, and then click Save.
    lianzluzhuizongpeizhiqiyong

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.
  2. In the left-side navigation pane, click Services and Functions.
  3. In the top navigation bar, select the region where your Kubernetes cluster is deployed.
  4. On the Services page, click the name of the target service.
  5. On the target service page, click the name of the target function.
  6. On the Function Details page, click Tracing Analysis to view the function call chain information. For more information, see Analyze traces.
    Trace information
  7. On the Traces tab, click a specific trace to view the detailed information.
    cold-start

    Field description:

    Note If a request does not encounter a cold start, the trace does not contain the ColdStart and Initializer spans.
    • 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.