All Products
Search
Document Center

Application Real-Time Monitoring Service:Enable tracing for NGINX Ingress Controller

Last Updated:Mar 11, 2026

When troubleshooting latency or errors at the cluster entry point, you need visibility into how requests flow through NGINX Ingress. By enabling tracing, you export trace data from the NGINX Ingress Controller in a Container Service for Kubernetes (ACK) cluster to Managed Service for OpenTelemetry, where the ARMS console displays request traces and service topology for ingress traffic.

Prerequisites

Before you begin, make sure that you have:

Version compatibility

Tracing protocol support depends on your NGINX Ingress controller version:

NGINX Ingress controller versionOpenTelemetryOpenTracing
>= 1.10.2-aliyun.1SupportedNot supported
v1.9.3-aliyun.1SupportedSupported
v1.8.2-aliyun.1SupportedSupported
< v1.8.2-aliyun.1Not supportedSupported

Enable tracing with OpenTelemetry

Use this method if your NGINX Ingress controller version is v1.8.2-aliyun.1 or later.

Step 1: Get the OpenTelemetry endpoint

  1. Log on to the ARMS console. In the left-side navigation pane, click Integration Center.

  2. In the Server-side Applications section, click the OpenTelemetry card.

  3. In the OpenTelemetry panel, select the region from which to report data.

  4. Record the endpoint and authentication token.

    Note

    Use a VPC endpoint when the NGINX Ingress Controller and the Managed Service for OpenTelemetry agent are in the same region. Use a public endpoint when they are in different regions.

    OpenTelemetry endpoint

Step 2: Configure NGINX Ingress Controller

2a. Add the authentication environment variable

  1. Log on to the ACK console. In the left-side navigation pane, click Clusters.

  2. On the Clusters page, find the target cluster and click its name. In the left-side pane, choose Workloads > Deployments.

  3. Select kube-system from the Namespace drop-down list. Search for nginx-ingress-controller, find the deployment, and click Edit in the Actions column.

  4. On the Edit page, select the nginx-ingress-controller container. On the Environments tab, click Add and add the following environment variable: Replace <authentication-token> with the token from Step 1. Example: authentication=bfXXXXXXXe@7bXXXXXXX1_bXXXXXe@XXXXXXX1.

    TypeVariable keyValue
    CustomOTEL_EXPORTER_OTLP_HEADERSauthentication=<authentication-token>

    Environment variable configuration

  5. Click Update, then click Confirm.

2b. Update the nginx-configuration ConfigMap

  1. In the left-side navigation pane, choose Configurations > ConfigMaps.

  2. Select kube-system from the Namespace drop-down list. Search for nginx-configuration, find the ConfigMap, and click Edit in the Actions column.

  3. In the Edit panel, click Add to add the following key-value pairs, then click OK. At minimum, set enable-opentelemetry, main-snippet, otlp-collector-host, and otlp-collector-port. The remaining parameters are optional.

KeyDescriptionExample
enable-opentelemetryEnable OpenTelemetry tracing.true
main-snippetLoad the authentication environment variable into the NGINX main configuration.env OTEL_EXPORTER_OTLP_HEADERS;
otlp-collector-hostgRPC hostname for the OTLP collector. Use the VPC endpoint from Step 1 without the http:// prefix and port number.tracing-analysis-XX-XX-XXXXX.aliyuncs.com
otlp-collector-portgRPC port for the OTLP collector.8090
otel-service-nameThe custom service name.nginx-ingress
opentelemetry-trust-incoming-spanTrust incoming trace context from upstream services, preserving end-to-end traces.true
opentelemetry-operation-nameSpan name format.HTTP $request_method $service_name $uri
otel-samplerSampling rule. For more information about other parameters, see OpenTelemetry.TraceIdRatioBased
otel-sampler-ratioSampling rate. Range: 0 to 1 (with two decimal places). 0: no sampling. 1: sample everything. Takes effect only when otel-sampler-parent-based is false. For more information, see OpenTelemetry.0.1
otel-sampler-parent-basedInherit the sampling decision from the upstream span. false (default): does not inherit, and enables otel-sampler and otel-sampler-ratio. true: inherits, and disables otel-sampler and otel-sampler-ratio. For more information, see OpenTelemetry.false or true

Complete ConfigMap example (YAML)

Copy this YAML template and adjust the values for your environment:

apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-configuration
  namespace: kube-system
data:
  enable-opentelemetry: "true"
  main-snippet: "env OTEL_EXPORTER_OTLP_HEADERS;"
  otlp-collector-host: "tracing-analysis-XX-XX-XXXXX.aliyuncs.com"
  otlp-collector-port: "8090"
  otel-service-name: "nginx-ingress"
  opentelemetry-trust-incoming-span: "true"
  opentelemetry-operation-name: "HTTP $request_method $service_name $uri"
  otel-sampler: "TraceIdRatioBased"
  otel-sampler-ratio: "0.1"
  otel-sampler-parent-based: "false"

Replace the otlp-collector-host value with the hostname extracted from your endpoint.

Note

For additional tuning parameters, see the upstream OpenTelemetry addon documentation.

Step 3: Verify trace data in the ARMS console

  1. Log on to the ARMS console. In the left-side navigation pane, choose Application Monitoring > Applications.

  2. In the top navigation bar, select the region and click the nginx-ingress application (or the service name set in otel-service-name).

  3. Verify the following on the application details page:

    • Overview tab: Check request counts and error counts. Application overview

    • Trace Explorer tab: Browse traces and review average duration. Trace Explorer

    • Click a trace ID to inspect the full trace waterfall. Trace details

(Optional) Change the trace context propagation format

By default, OpenTelemetry propagates trace context using the W3C Trace Context specification. If your frontend or backend applications use a different protocol (such as Jaeger or Zipkin B3), change the propagation format so that traces flow end-to-end across NGINX Ingress and your application services.

  1. Return to the Deployment edit page from Step 2a. Add the following environment variable alongside OTEL_EXPORTER_OTLP_HEADERS, then click Update and Confirm to redeploy:

    TypeVariable keyValueDescription
    CustomOTEL_PROPAGATORStracecontext,baggage,b3,jaegerComma-separated propagation formats. For details, see Specify the format to pass trace data.
  2. Update the main-snippet key in the nginx-configuration ConfigMap to load both environment variables:

    KeyUpdated value
    main-snippetenv OTEL_EXPORTER_OTLP_HEADERS; env OTEL_PROPAGATORS

Enable tracing with OpenTracing (legacy)

Use this method only if your NGINX Ingress controller version is earlier than v1.8.2-aliyun.1 and does not support OpenTelemetry.

Step 1: Get the Zipkin endpoint

  1. Log on to the ARMS console. In the left-side navigation pane, click Integration Center.

  2. In the Server-side Applications section, click the Zipkin card.

    Note

    OpenTracing uses a Zipkin-compatible client for data collection.

  3. In the Zipkin panel, select the region from which to report data.

  4. Record the endpoint.

    Note

    Use a VPC endpoint when the NGINX Ingress Controller and the agent are in the same region. Use a public endpoint when they are in different regions.

    Zipkin endpoint

Step 2: Configure the nginx-configuration ConfigMap

  1. Log on to the ACK console. In the left-side navigation pane, click Clusters.

  2. On the Clusters page, click the target cluster name. In the left-side navigation pane, choose Configurations > ConfigMaps.

  3. Select kube-system from the Namespace drop-down list. Search for nginx-configuration, find the ConfigMap, and click Edit in the Actions column.

  4. In the Edit panel, click Add and set the following two keys: Endpoint format example:

    • Original: http://tracing-analysis-dc-hz-internal.aliyuncs.com/adapt_******_******/api/v1/spans

    • After modification: tracing-analysis-dc-hz-internal.aliyuncs.com/adapt_******_******/api/v1/spans?

    Important

    The trailing ? is required. Without it, trace data submission fails.

    KeyValueDescription
    zipkin-collector-hostEndpoint from Step 1Remove http:// from the beginning and append ? at the end.
    enable-opentracingtrueEnable OpenTracing.
  5. Click OK.

    OpenTracing ConfigMap

Step 3: Verify trace data in the ARMS console

  1. Log on to the ARMS console. In the left-side navigation pane, choose Application Monitoring > Applications.

  2. In the top navigation bar, select the region and click the nginx application.

  3. In the left-side navigation pane, click Interface Calls. On the right side, verify the following:

    • Overview tab: Check the trace topology. Trace topology

    • Traces tab: Review the top 100 time-consuming traces. For more information, see Interface calls. Traces list

    • Click a trace ID to inspect the trace details. Trace details

References