All Products
Search
Document Center

Alibaba Cloud Service Mesh:Configure ASM to report tracing data

Last Updated:Mar 11, 2026

Service Mesh (ASM) exports distributed tracing data from its sidecar proxies to Managed Service for OpenTelemetry. This gives you end-to-end visibility into request flows, service dependencies, and latency across your microservices.

Prerequisites

Before you begin, make sure that you have:

Set up tracing

The setup differs by ASM instance version. Select the tab that matches yours.

Set up tracing for ASM 1.18 or later

This version requires an OpenTelemetry Collector deployed in your ACK cluster. The Collector receives traces from ASM sidecar proxies and forwards them to Managed Service for OpenTelemetry over gRPC.

Step 1: Deploy the OpenTelemetry Operator

  1. Connect to your ACK cluster with kubectl and create the namespace:

       kubectl create namespace opentelemetry-operator-system
  2. Install the OpenTelemetry Operator with Helm: This skips cert-manager and auto-generates certificates for the admission webhooks.

       helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
       helm install --namespace=opentelemetry-operator-system opentelemetry-operator open-telemetry/opentelemetry-operator \
         --set "manager.collectorImage.repository=otel/opentelemetry-collector-k8s" \
         --set admissionWebhooks.certManager.enabled=false \
         --set admissionWebhooks.autoGenerateCert.enabled=true
  3. Verify the Operator pod is running: Expected output: Both containers in the pod should show Running status.

       kubectl get pod -n opentelemetry-operator-system
       NAME                                      READY   STATUS    RESTARTS   AGE
       opentelemetry-operator-854fb558b5-pvllj   2/2     Running   0          1m

Step 2: Create an OpenTelemetry Collector

  1. Create a collector.yaml file with the following content.

    Replace the placeholders with your actual values:

    PlaceholderDescriptionReference
    ${ENDPOINT}VPC endpoint that supports gRPCConnect to Managed Service for OpenTelemetry and authenticate clients
    ${TOKEN}Authentication tokenConnect to Managed Service for OpenTelemetry and authenticate clients

    collector.yaml

       apiVersion: opentelemetry.io/v1alpha1
       kind: OpenTelemetryCollector
       metadata:
         labels:
           app.kubernetes.io/managed-by: opentelemetry-operator
         name: default
         namespace: opentelemetry-operator-system
         annotations:
           sidecar.istio.io/inject: "false"
       spec:
         config: |
           extensions:
             zpages:
               endpoint: 0.0.0.0:55679
           receivers:
             otlp:
               protocols:
                 grpc:
                   endpoint: 0.0.0.0:4317
           exporters:
             debug:
               verbosity: detailed
             otlp:
               endpoint: ${ENDPOINT}
               tls:
                 insecure: true
               headers:
                 Authentication: ${TOKEN}
           service:
             extensions: [zpages]
             pipelines:
               traces:
                 receivers: [otlp]
                 processors: []
                 exporters: [otlp, debug]
         ingress:
           route: {}
         managementState: managed
         mode: deployment
         observability:
           metrics: {}
         podDisruptionBudget:
           maxUnavailable: 1
         replicas: 1
         resources: {}
         targetAllocator:
           prometheusCR:
             scrapeInterval: 30s
           resources: {}
         upgradeStrategy: automatic

    Key configuration details:

    • The sidecar.istio.io/inject: "false" annotation prevents ASM from injecting a sidecar into the Collector pod, which would cause a routing loop.

    • The debug exporter logs trace data to stdout for troubleshooting. Remove it after verifying the setup.

    • The trace pipeline routes spans from the OTLP receiver to both the OTLP exporter (Managed Service for OpenTelemetry) and the debug exporter.

  2. Deploy the Collector:

       kubectl apply -f collector.yaml
  3. Verify the Collector pod is running: Expected output:

       kubectl get pod -n opentelemetry-operator-system
       NAME                                      READY   STATUS    RESTARTS   AGE
       opentelemetry-operator-854fb558b5-pvllj   2/2     Running   0          3m
       default-collector-5cbb4497f4-2hjqv        1/1     Running   0          30s
  4. Verify the Collector service exists: Expected output: The default-collector service on port 4317 receives trace data from ASM.

       kubectl get svc -n opentelemetry-operator-system
       opentelemetry-operator           ClusterIP   172.16.138.165   <none>        8443/TCP,8080/TCP   3m
       opentelemetry-operator-webhook   ClusterIP   172.16.127.0     <none>        443/TCP             3m
       default-collector              ClusterIP   172.16.145.93    <none>        4317/TCP   30s
       default-collector-headless     ClusterIP   None             <none>        4317/TCP   30s
       default-collector-monitoring   ClusterIP   172.16.136.5     <none>        8888/TCP   30s

Step 3: Configure tracing in the ASM console

  1. Log on to the ASM console. In the left-side navigation pane, choose Service Mesh > Mesh Management.

  2. On the Mesh Management page, click your ASM instance name. In the left-side navigation pane, choose Observability Management Center > Observability Settings.

  3. In the Tracing Analysis Settings section, set Sampling Percentage to 100 and click Submit.

  4. In the left-side navigation pane, choose Observability Management Center > Tracing Analysis. Configure the following fields:

    FieldValue
    OpenTelemetry Service Address/Domain Namedefault-collector.opentelemetry-operator-system.svc.cluster.local
    OpenTelemetry Service Port4317
  5. Click Collect ASM Tracing Data to Managed Service for OpenTelemetry.

Step 4: Verify the setup

  1. Deploy the Bookinfo and sleep test applications. For more information, see Deploy an application in an ACK cluster that is added to an ASM instance.

    • bookinfo.yaml

    • sleep.yaml

      sleep.yaml

         apiVersion: v1
         kind: ServiceAccount
         metadata:
           name: sleep
         ---
         apiVersion: v1
         kind: Service
         metadata:
           name: sleep
           labels:
             app: sleep
             service: sleep
         spec:
           ports:
           - port: 80
             name: http
           selector:
             app: sleep
         ---
         apiVersion: apps/v1
         kind: Deployment
         metadata:
           name: sleep
         spec:
           replicas: 1
           selector:
             matchLabels:
               app: sleep
           template:
             metadata:
               labels:
                 app: sleep
             spec:
               terminationGracePeriodSeconds: 0
               serviceAccountName: sleep
               containers:
               - name: sleep
                 image: registry.cn-hangzhou.aliyuncs.com/acs/curl:8.1.2
                 command: ["/bin/sleep", "infinity"]
                 imagePullPolicy: IfNotPresent
                 volumeMounts:
                 - mountPath: /etc/sleep/tls
                   name: secret-volume
               volumes:
               - name: secret-volume
                 secret:
                   secretName: sleep-secret
                   optional: true
  2. Send a test request through the mesh:

       kubectl exec -it deploy/sleep -c sleep -- curl productpage:9080/productpage?u=normal
  3. Check the Collector logs for exported spans: This confirms the Collector received and exported trace data.

       2023-11-20T08:44:27.531Z	info	TracesExporter	{"kind": "exporter", "data_type": "traces", "name": "debug", "resource spans": 1, "spans": 3}
  4. View traces in the Application Real-Time Monitoring Service (ARMS) console:

    1. Log on to the ARMS console.

    2. In the left-side navigation pane, choose Application Monitoring > Trace Explorer. Select your region in the upper-left corner.

    3. In the Service Name section, select the sleep application. Tracing data appears on the right. ASM injects a sidecar proxy into the sleep application. When the application sends a request, the sidecar acts as the egress gateway and generates a span for each outbound call. Trace data for the sleep application

    4. Find a trace ID and click Details in the Actions column to view the full trace with span-level latency. Trace details view

Set up tracing for ASM 1.17.2.35 to 1.18.0.124

  1. Log on to the ASM console. In the left-side navigation pane, choose Service Mesh > Mesh Management.

  2. On the Mesh Management page, click your ASM instance name. In the left-side navigation pane, choose Observability Management Center > Tracing Analysis.

  3. On the Tracing Analysis page, click Collect ASM Tracing Data to Managed Service for OpenTelemetry. In the Submit dialog, click OK.

  4. Click Open the Managed Service for OpenTelemetry Console to view tracing data.

    Tracing Analysis page

For more information about Managed Service for OpenTelemetry, see What is Managed Service for OpenTelemetry?

Note To disable tracing, click Disable Collection on the Tracing Analysis page. In the Submit dialog, click OK.

Set up tracing for ASM earlier than 1.17.2.35

  1. Log on to the ASM console. In the left-side navigation pane, choose Service Mesh > Mesh Management.

  2. On the Mesh Management page, click your ASM instance name. In the left-side navigation pane, choose ASM Instance > Base Information.

  3. On the Base Information page, click Settings. In the Settings Update panel:

    1. Select Enable Tracing Analysis.

    2. Set Sampling Percentage to your desired value.

    3. Select Enable Managed Service for OpenTelemetry for Sampling Method.

    4. Click OK.

  4. In the left-side navigation pane, choose Observability Management Center > Tracing Analysis to view tracing data in the Managed Service for OpenTelemetry console.

    Tracing Analysis page

For more information about Managed Service for OpenTelemetry, see What is Managed Service for OpenTelemetry?

Note To disable tracing, clear Enable Tracing Analysis in the Settings Update panel and click OK.