Use ALB Tracing to Analyze End-to-End Business Transactions
Alibaba Cloud ALB supports tracing analysis. This feature provides complete request tracing data for ALB, including the request source, nodes traversed, and response time. Use this data to quickly locate and resolve business issues.
Background information
Tracing analysis gives developers of distributed applications tools such as full call chain reconstruction, request volume statistics, topology visualization, and application dependency analysis. These tools help you quickly identify and diagnose performance bottlenecks in distributed architectures. ALB supports tracing analysis. When you enable ALB tracing, your ALB access traces are automatically connected to Alibaba Cloud Managed Service for OpenTelemetry. For more information, see What is Managed Service for OpenTelemetry?.
Trace data records processing details for a single request, including service invocations and processing durations.
A trace corresponds to one call chain (Trace). Broadly speaking, a call chain represents the execution path of a transaction or workflow through a (distributed) system. Under the OpenTracing standard, a trace is a directed acyclic graph (DAG) composed of multiple spans. Each span represents a named, timed segment of continuous execution within the call chain. For more information, see What is a trace?.
Important notes
-
Only Standard Edition and WAF Enhanced Edition ALB instances support tracing analysis. Basic Edition ALB instances do not support this feature.
-
When you use tracing analysis, Alibaba Cloud automatically activates Managed Service for OpenTelemetry and Simple Log Service. After activation, you incur charges for data reporting, trace storage, and log services. For billing details, see Managed Service for OpenTelemetry billing and Simple Log Service billing.
-
The following table lists regions where ALB tracing is available.
Area
Region
Chinese mainland
China (Hangzhou), China (Shanghai), China (Shenzhen), China (Chengdu), China (Qingdao), China (Beijing), China (Zhangjiakou), China (Ulanqab), China (Hong Kong), China (Guangzhou), China (Heyuan)
Asia Pacific
Singapore, Malaysia (Kuala Lumpur), Japan (Tokyo), Indonesia (Jakarta)
Europe & Americas
UK (London), Germany (Frankfurt), US (Virginia), US (Silicon Valley)
-
Notes about disabling tracing:
-
After you disable tracing for a listener, access logs remain enabled. If you no longer need access logs, disable them manually.
-
If you are using tracing, disabling access logs makes tracing unavailable. Proceed with caution.
-
When tracing is disabled for all listeners under an ALB instance, ALB stops shipping trace data to Managed Service for OpenTelemetry.
-
Prerequisites
-
You have created an ALB instance and a server group for that ALB. For more information, see Create and manage ALB instances and Create and manage server groups.
-
You have configured a listener for the ALB instance and associated it with a server group. For more information, see Add an HTTP listener.
-
You have created an ECS instance as a backend server, deployed Nginx on it, and added the ECS instance to the server group.
-
To create an ECS instance, see Purchase an instance.
-
To deploy Nginx, see Manually deploy an LNMP environment (CentOS 7).
-
To add backend servers to a server group, see Add or remove backend servers.
This topic uses the following example to deploy a test application on the ECS instance:
-
Step 1: Enable tracing
Log on to the ALB console.
-
In the top menu bar, select the region of your ALB instance.
-
On the Instances page, find your target ALB instance and click its instance ID.
-
Click the Listener tab, find your target listener, and click its listener ID.
-
In the Listener Details tab, go to the Tracing section and turn on the Tracing switch.
-
In the Enable Tracing dialog box, configure the parameters as needed.
Configuration
Description
Activate Service
NoteIf you have already activated Managed Service for OpenTelemetry, skip this step.
Activate Managed Service for OpenTelemetry
Check the service agreement to confirm activation.
Create Access Log
NoteIf you have already created an access log, skip this step.
Project
A resource management unit in Simple Log Service used for resource isolation and control.
-
Select Project: Select an existing project from the drop-down list.
-
Create Project: Enter a project name in the field.
Logstore
A unit in Simple Log Service for log data collection, storage, and query.
-
Select Logstore: Select an existing Logstore from the drop-down list.
-
Create Logstore: Enter a Logstore name in the field. If you select Create Project, you must also select Create Logstore.
Enable Tracing Analysis
Tracing Type
Select the tracing type.
Only Zipkin(B3) is supported. This option indicates that Alibaba Cloud Managed Service for OpenTelemetry has been activated and tracing is enabled.
Sampling Rate
Valid values: 1 to 100. Default value: 100.
Adjust the sample rate to control the volume of trace data reported.
Notes on Creating Service-linked Role
The system automatically creates a service-linked role to enable this feature.
-
Step 2: View trace data
-
From any client terminal, test connectivity between the client and server. For more information, see Quickly implement IPv4 load balancing with ALB and Quickly implement IPv6 load balancing with ALB.
Log on to the ALB console.
-
On the Instances page, find your target ALB instance and click its instance ID.
-
Click the Listener tab, find your target listener, and click its listener ID.
-
In the Listener Details tab, go to the Tracing section and click View next to Trace Analysis to go to the Managed Service for OpenTelemetry console.
On the Trace Analysis page, analyze trace data for calls from ALB to your backend application. You can view the trace list, invocation counts, and end-to-end aggregated data. For more information, see Trace analysis.
The query bar at the top of the page automatically includes the
attributes.app_lb_idandattributes.slb_vportfilters. The quick filter panel on the left lets you filter by status, duration range, and application name.