All Products
Search
Document Center

API Gateway:Configure tracing analysis

Last Updated:Apr 03, 2024

This topic describes how to configure tracing analysis in the API Gateway console to upload tracing logs to Alibaba Cloud Managed Service for OpenTelemetry. Managed Service for OpenTelemetry provides a set of tools that you can use to map complete traces of service calls, calculate the number of requests, obtain trace topologies, and analyze application dependencies. The tools help you efficiently develop services and troubleshoot issues. The tracing analysis feature is available only to dedicated instances.

Prerequisites

1. Grant permissions to Managed Service for OpenTelemetry

1.1 Log on to the Managed Service for OpenTelemetry console.

1.2 On the Overview page, click Authorize Now to authorize Managed Service for OpenTelemetry to read and write your Simple Log Service data.

1.3 On the Cloud Resource Access Authorization page, select the required permissions and click Confirm Authorization Policy.

1.4 After the permissions are granted, perform the following operations to view endpoints: On the Overview page, click the Access process tab. On this tab, click View access point information. Turn on Show Token and select Jaeger for the Client parameter. Save the endpoints that are displayed in the Reporting through HTTP section.

2. Configure tracing analysis in the API Gateway console

2.1 Log on to the API Gateway console.

2.2 In the left-side navigation pane, choose Manage APIs > API Groups. Click the name of the API group that you want to manage to go to the Group Details page. In the Custom Log Tracing section, configure the relevant parameters.

  • Tracing Field Position: Specify the location of the traced field. Valid values: Header and Query.

  • Tracing Field Name: Specify the name of the traced field. The traced field is generated by a client. API Gateway passes the traced field to the backend service and records the traced field in the CustomTraceId field. API Gateway uses the value of the traced field as a trace ID to report logs to Tracing Analysis. The value of the traced field must be in the standard TraceId format, which is a 16-bit or 32-bit hexadecimal number. If the client does not generate the traced field, API Gateway sets the field to the generated request ID and uses a random trace ID to report logs to Tracing Analysis.

  • Transparently Pass or Generate EagleEye-related Header (Eagleeye-Rpcid, Eagleeye-Traceid, or Eagleeye-Sampled): After you select the check box, API Gateway passes the EagleEye-related headers that are sent from a client to the backend service. If no such headers are sent from the client, API Gateway generates the headers and passes them to the backend service. This parameter takes effect for shared and dedicated instances.

  • Transparently Pass or Generate B3 Propagation Header (X-B3-traceid, X-B3-Parentspanid, X-B3-Spanid, or X-B3-Sampled): After you select the check box, API Gateway passes the B3-related header parameters that are sent from a client to the backend service. If no such header parameters are sent from the client, API Gateway generates the parameters and pass them to the backend service. This parameter takes effect for shared and dedicated instances.

  • Upload Trace Logs to Alibaba Cloud Tracing Analysis (For dedicated instances only):

    • App Name: Specify the name of the application for which you want to configure tracing analysis.

    • Arms Endpoint: Enter an endpoint that you obtained in "Section 1.4" of this topic. If the services are deployed in the same region, we recommend that you use the private endpoint for higher efficiency.

    • Log Sampling Strategy: Select an option based on your requirements. Valid values: Upload all, Percentage upload, and Fixed number of uploads per second.

After tracing analysis is configured in the API Gateway console, you can view the traces of requests in the Tracing Analysis console.

For more information about how to use Tracing Analysis, see API calls.