OTel
OpenTelemetry (OTel) is an open-source project aimed at providing a vendor-neutral standard for collecting, processing, and exporting telemetry data in distributed systems, such as microservices architectures. It helps developers analyze the performance and behavior of software more easily, thus facilitating the diagnosis and resolution of application issues.
TOC
Terminology
Prerequisites
-
Ensure that an operable ALB exists: Create or use an existing ALB, where the name of the ALB is replaced with
<otel-alb>in this document. For instructions on creating an ALB, refer to Configure ALB. -
Ensure that there is an OTel data reporting server address: This address will hereinafter be referred to as
<jaeger-server>.
Procedure
Update ALB Configuration
-
On the Master node of the cluster, use the CLI tool to execute the following command to edit the ALB configuration.
-
Add the following fields under the
spec.configsection.Example configuration once completed:
-
Execute the following command to save the updates. After the update, the ALB will default to enabling OpenTelemetry, and all request Trace information will be reported to the Jaeger Server.
Related Operations
Configuring OTel in Ingress
-
Enable or Disable OTel on Ingress
By configuring whether to enable OTel on Ingress, you can better monitor and debug the request flow of applications, identifying performance bottlenecks or errors by tracing requests as they propagate between different services.
Procedure
Add the following configuration under the metadata.annotations field of Ingress:
Parameter Explanation:
- nginx.ingress.kubernetes.io/enable-opentelemetry: When set to
true, it indicates that the Ingress controller enables OpenTelemetry functionality while processing requests through this Ingress, which means request Trace information will be collected and reported. When set tofalseor this annotation is removed, it means that request Trace information will not be collected or reported.
- nginx.ingress.kubernetes.io/enable-opentelemetry: When set to
-
Enable or Disable OTel Trust on Ingress
OTel Trust determines whether Ingress trusts and uses the Trace information (e.g., trace ID) from incoming requests.
Procedure
Add the following configuration under the metadata.annotations field of Ingress:
Parameter Explanation:
- nginx.ingress.kubernetes.io/opentelemetry-trust-incoming-span: When set to
true, the Ingress continues to use already existing Trace information, helping maintain consistency in cross-service tracing, allowing the entire request chain to be fully traced and analyzed in the distributed tracing system. When set tofalse, it will generate new tracing information for the request, which may cause the request to be treated as part of a new tracing chain after entering the Ingress, interrupting cross-service trace continuity.
- nginx.ingress.kubernetes.io/opentelemetry-trust-incoming-span: When set to
-
Add Different OTel Configurations on Ingress
This configuration allows you to customize OTel's behavior and data export methodology for different Ingress resources, enabling fine-grained control over each service's tracing strategy or target.
Procedure
Add the following configuration under the metadata.annotations field of Ingress:
Parameter Explanation:
- exporter: Specifies how the collected Trace data is sent to the OTel Collector (the OTel data reporting server).
- address: Specifies the address of the OTel Collector.
- request_timeout: Specifies the request timeout.
Using OTel in Applications
The following configuration shows the complete OTel configuration structure, which can be used to define how to enable and use OTel features in applications.
On the cluster Master node, use the CLI tool to execute the following command to get the complete OTel configuration structure.
Echoed Result:
Parameter Explanation:
Inheritance
By default, if the ALB configures certain OTel parameters and FT is not configured, FT will inherit the parameters from the ALB as its own configuration; that is, FT inherits the ALB configuration, while Rule can inherit configurations from both ALB and FT.
-
ALB: The configuration on the ALB is typically global and default. You can configure global parameters such as Collector addresses here, which will be inherited by the lower-level FT and Rule.
-
FT: FT can inherit configurations from ALB, meaning that certain OTel parameters that are not configured on FT will use the configuration from ALB. However, FT can also be refined further; for instance, you can choose to selectively enable or disable OTel on FT without affecting other FT or the global settings of ALB.
-
Rule: Rule can inherit configurations from both ALB and FT. However, Rule can also be refined further; for instance, a specific Rule can choose not to trust the incoming OTel Trace information or to adjust the sampling strategies.
Procedure
By configuring the spec.config.otel field in the YAML files of ALB, FT, and Rule, you can add OTel-related configuration.
Additional Notes
Sampling Strategies
Attributes
-
Resource Attributes
These attributes are reported by default.
-
Span Attributes
-
Attributes reported by default:
-
Attributes reported by default but can be excluded by modifying the flag.hide_upstream_attrs field:
-
Attributes not reported by default but can be reported by modifying the flag.report_http_request_header field:
-
Attributes not reported by default but can be reported by modifying the flag.report_http_response_header field:
-
Configuration Example
The following YAML configuration deploys an ALB and uses Jaeger as the OTel server, with Hotrod-proxy as the demonstration backend. By configuring Ingress rules, when clients request the ALB, the traffic will be forwarded to HotROD. Additionally, the communication between internal microservices of HotROD is also routed through the ALB.
-
Save the following YAML as a file named all.yaml.
-
In the CLI tool, execute the following command to deploy Jaeger, ALB, HotROD, and all necessary CRs for testing.
-
Execute the following command to get the access address of Jaeger.
-
Execute the following command to obtain the access address of otel-alb.
-
Execute the following command to send a request to HotROD via ALB. Here, ALB will report the Trace to Jaeger.
-
Open the access address of Jaeger obtained in Step 3 to view the results.

