Send trace data from the Jaeger platform to Simple Log Service (SLS) by forwarding the data directly or using an OpenTelemetry Collector.
Prerequisites
A Trace instance must be created. For more information, see Create a Trace instance.
Direct forwarding
To send trace data directly to SLS using the Jaeger protocol, you must configure the endpoint and authentication information on the Jaeger platform. The following information is required:
Endpoint information
The endpoint for the HTTPS protocol is ${endpoint}/jaeger/api/traces. For example, https://test-project.cn-hangzhou-intranet.log.aliyuncs.com/jaeger/api/traces.
The endpoint for the gRPC protocol is ${endpoint}:10010. For example, test-project.cn-hangzhou-intranet.log.aliyuncs.com:10010.
WarningFor security reasons, enable Transport Layer Security (TLS) when you use the gRPC protocol.
Replace ${endpoint} with your actual endpoint. The following table describes the variable.
Table 1. Variable description
Variable
Description
Example
${endpoint}
The endpoint of the SLS project. The format is ${project}.${region-endpoint}. In this format:
${project} is the name of the SLS project.
${region-endpoint} is the endpoint of the region where the SLS project resides. Endpoints for the Internet, classic network, and VPC are supported. For more information, see Endpoints.
test-project.cn-hangzhou.log.aliyuncs.com
Authentication information
You can configure authentication information in the header of the gRPC or HTTPS protocol, or in the tag field of the Jaeger protocol. The following table describes the required fields.
Jaeger Tag
gRPC/HTTPS Header Key
Description
Example
sls.otel.project
x-sls-otel-project
The SLS project.
test-project
sls.otel.instanceid
x-sls-otel-instance-id
The ID of the Trace service instance. For more information, see Create a Trace instance.
test-traces
sls.otel.akid
x-sls-otel-ak-id
The AccessKey ID of your Alibaba Cloud account.
Use the AccessKey pair (AccessKey ID and AccessKey secret) of a Resource Access Management (RAM) user that has only write permissions on the SLS project. For information about how to grant a RAM user the permissions to write data to a specified project, see Authorization. For information about how to obtain an AccessKey pair, see AccessKey pair.
None
sls.otel.aksecret
x-sls-otel-ak-secret
The AccessKey secret of your Alibaba Cloud account.
Use the AccessKey pair of a RAM user that has only write permissions on the SLS project.
None
Forward data using an OpenTelemetry Collector
Install the OpenTelemetry Collector.
Configure the OpenTelemetry Collector.
Create a config.yaml file.
Add the following code to the config.yaml file.
Replace the variables in the following code based on your requirements. For more information about the variables, see Variable description.
receivers: jaeger: protocols: grpc: endpoint: 0.0.0.0:6831 thrift_binary: endpoint: 0.0.0.0:6832 thrift_compact: endpoint: 0.0.0.0:6833 thrift_http: endpoint: 0.0.0.0:6834 exporters: logging/detail: loglevel: debug alibabacloud_logservice/sls-traces: endpoint: "${endpoint}" project: "${project}" logstore: "${instance}-traces" access_key_id: "${access-key-id}" access_key_secret: "${access-key-secret}" service: pipelines: traces: receivers: [jaeger] # Set the receiver to jaeger. exporters: [alibabacloud_logservice/sls-traces] # Set the exporter to alibabacloud_logservice/sls-traces. # For debugging #exporters: [logging/detail,alibabacloud_logservice/sls-traces]Table 2. Variable description
Variable
Description
Example
${endpoint}
The endpoint of the SLS project. The format is ${region-endpoint}. ${region-endpoint} is the endpoint of the region where the SLS project resides. Endpoints for the Internet, classic network, and VPC are supported. For more information, see Endpoints.
cn-hangzhou.log.aliyuncs.com:10010
${project}
The name of the SLS project.
test-project
${instance}
The ID of the Trace service instance. For more information, see Create a Trace instance.
test-traces
${access-key-id}
The AccessKey ID of your Alibaba Cloud account.
Use the AccessKey pair of a RAM user that has only write permissions on the SLS project. For information about how to grant a RAM user the permissions to write data to a specified project, see Authorization. For information about how to obtain an AccessKey pair, see AccessKey pair.
None
${access-key-secret}
The AccessKey secret of your Alibaba Cloud account.
Use the AccessKey pair of a RAM user that has only write permissions on the SLS project.
None
Start the OpenTelemetry Collector.
./otelcontribcol_linux_amd64 --config="./config.yaml"
Configure Jaeger.
Change the output endpoint of Jaeger to the listener address of the OpenTelemetry Collector. For example, if the address of the OpenTelemetry Collector is ${collector-host}, set the output address of Jaeger to ${collector-host}:${port}/api/traces.
NoteIf the OpenTelemetry Collector reports a parsing error, troubleshoot the issue by switching between the four receiving modes of the Jaeger Receiver.