All Products
Search
Document Center

Function Compute:Configure tracing analysis

Last Updated:Dec 09, 2025

Function Compute supports integration with Managed Service for OpenTelemetry. This service is based on OpenTelemetry, the de facto standard W3C protocol, and helps you identify and diagnose performance bottlenecks in distributed applications. This integration significantly improves developer and O&M efficiency in a serverless architecture. This topic describes how to enable tracing analysis for your functions and view function invocation chain information to perform end-to-end request monitoring and performance analysis.

Background information

In serverless architectures, conventional logging methods are often insufficient for tracing call chains and analyzing performance. This leads to the following pain points:

  • Difficulty locating cold start latency: You must piece together logs, which makes it difficult to distinguish between system and business latency.

  • Disconnected cross-service invocations: A broken context prevents you from reconstructing the complete trace.

  • Lack of visual analytics: It is difficult to accurately identify performance bottlenecks.

To improve system observability and O&M efficiency, Function Compute has enhanced its end-to-end observability capabilities using Managed Service for OpenTelemetry. It uses W3C header pass-through for end-to-end tracing and supports span segmentation. This enables the visualization of invocation paths and the rapid identification of performance issues.

Benefits

  • End-to-end transparency

    Supports the pass-through of Function Compute system-level spans and the automatic concatenation of custom business spans with system spans to form an end-to-end trace view. This process exposes potential performance bottlenecks, such as cold start latency and resource contention.

  • Cross-environment interoperability

    The service is compatible with headers such as traceparent, tracestate, and baggage. This ensures lossless context transmission between functions and downstream services, such as databases and message queues.

    It also supports trace context pass-through across functions, Alibaba Cloud services, and other cloud vendors, which allows for seamless integration with existing OpenTelemetry ecosystem toolchains.

  • Dynamic cost control

    You can adjust the sample rate in the function configuration. You can set the rate from 1% for low-load sampling to 100% for troubleshooting to balance data volume and resource overhead.

Billing

Function Compute does not charge additional fees for enabling tracing analysis. However, Managed Service for OpenTelemetry is billed separately based on the amount of trace data that you report.

Prerequisites

Enable tracing analysis

  1. Log on to the Function Compute console. In the left-side navigation pane, click Functions.

  2. In the top navigation bar, select a region. On the Functions page, click the function that you want to manage.

  3. On the Function Details page, click the Link tracing tab. Turn on the Link tracing switch, configure the Sampling rate, and then click OK.

    image

View function traces

  1. On the Function Details page, click the Code tab and click Test Function.

  2. Click the Link tracing tab to view the detailed trace analysis.

    For example, in a scenario where an MCP client calls the Amap Weather Query MCP server, you can clearly view the complete trace. This information includes the cold start process, SSE connection, message communication, and agent calls.

    As shown in the following figure, on the Call Chain Analysis page, click the target TraceId (trace ID).

    image

    In the panel that appears on the right, check the cold start duration. If the PrepareCode time is longer than expected, you may need to simplify your code package.

    image

    When Function Compute acts as an endpoint in a distributed trace, the tracing analysis feature can connect upstream and downstream services to show the latency of the request at each step. As shown in the following figure, it connects mcp-client and mcp-server.

    image