All Products
Search
Document Center

API Gateway:Configure tracing analysis

Last Updated:Dec 14, 2022

This topic describes how to configure tracing analysis in the API Gateway console to upload tracing logs to Alibaba Cloud Tracing Analysis. Tracing Analysis provides a complete set of tools for you to map complete traces of calling services, calculate the number of requests, offer trace topologies, and analyze application dependencies. These tools help you efficiently develop applications and troubleshoot issues. This feature is available to only dedicated instances.

Prerequisites

1. Authorize Tracing Analysis

1.1 Log on to the Tracing Analysis console.

1.2 On the Overview page, click Authorize Now to authorize Tracing Analysis to read and write your Log Service data.

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

1.4 After authorization, navigate through Overview > Access process > View access point information > Show Token to view the endpoint details. 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 Open API > API Groups. Then, click the API group that you want to manage. The Group Details page appears. On the Group Details page, configure the settings.

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

  • Tracing Field Name: Specify the name of the traced field. This custom field is generated by a client. API Gateway passes it to the backend service and records it in the CustomTraceId of the user. API Gateway also uses the value of this field to report logs to Tracing Analysis. The value of this field must be specified in the standard TraceId format, which is a 16-bit or 32-bit hexadecimal number. If the client did not generate this field, API Gateway sets this field to the generated RequestId field and uses a random TraceId to report logs to Tracing Analysis.

  • Transparently Pass or Generate EagleEye-related Header (Eagleeye-Rpcid, Eagleeye-Traceid, or Eagleeye-Sampled): After you select this option, API Gateway passes the EagleEye-related header parameters sent from a client to the backend service. If no such header parameters are sent from the client, API Gateway generates those parameters and pass them to the backend service. This option is available to both 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 this option, API Gateway passes the B3-related header parameters sent from a client to the backend service. If no such header parameters are sent from the client, API Gateway generates those parameters and pass them to the backend service. This option is available to both shared and dedicated instances.

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

    • App Name: Specify the name of the app for tracing analysis.

    • Arms Endpoint: Enter the endpoint that you obtained in step 1.4. We recommend that you use the private network endpoint for higher efficiency if the services are deployed in the same region.

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

In the Tracing Analysis console, you can view the traces of the requests that are sent after tracing analysis is configured in the API Gateway console.

For more information about how to use Tracing Analysis, see View the details of span calls.

Note

This feature is available to dedicated instances purchased after December 3, 2020. If your dedicated instance was purchased before December 3, 2020 and you want to use this feature, submit a ticket to upgrade your instance to the latest version.