Sending Telemetry Data to the OpenTelemetry Collector without Sidecar Injection

Instead of injecting a sidecar, you can deploy the OpenTelemetry Collector as a standalone deployment. Applications send telemetry data to the Collector service endpoint over the network. This approach allows a centralized Collector instance to receive data from multiple applications.

Prerequisites

  • Alauda build of OpenTelemetry v2 Operator is installed.
  • Alauda Build of Jaeger v2 is installed and deployed.
  • An active ACP CLI (kubectl) session by a cluster administrator with the cluster-admin role.
  • Enable Automatic RBAC creation by following the instructions in Procedure.

Procedure

  1. Deploy the OpenTelemetry Collector instance with the deployment mode by running the following command:

    kubectl apply -f - <<EOF
    apiVersion: opentelemetry.io/v1beta1
    kind: OpenTelemetryCollector
    metadata:
      name: otel
      namespace: observability
    spec:
      mode: deployment
      replicas: 1
      config:
        receivers:
          jaeger:
            protocols:
              grpc: {}
              thrift_binary: {}
              thrift_compact: {}
              thrift_http: {}
          otlp:
            protocols:
              grpc:
                endpoint: 0.0.0.0:4317
              http:
                endpoint: 0.0.0.0:4318
          zipkin: {}
        processors:
          batch: {}
          k8sattributes: {}
          memory_limiter:
            check_interval: 1s
            limit_percentage: 80
            spike_limit_percentage: 20
        exporters:
          otlp/traces:
            endpoint: "<jaeger-instance-name>-collector:4317"
            tls:
              insecure: true
        service:
          pipelines:
            traces:
              receivers: [jaeger, otlp, zipkin]
              processors: [memory_limiter, k8sattributes, batch]
              exporters: [otlp/traces]
    EOF
    1. The namespace determines where the Collector resources are created.
    2. The exporter endpoint must point to the Jaeger collector service. Replace <jaeger-instance-name>-collector:4317 with the actual service name of your Jaeger deployment.
  2. Set the environment variables in the container with your instrumented application to send telemetry data to the Collector:

    kubectl apply -f - <<EOF
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: my-app
      namespace: observability
    spec:
      selector:
        matchLabels:
          app: my-app
      replicas: 1
      template:
        metadata:
          labels:
            app: my-app
        spec:
          containers:
          - name: app
            image: myapp:latest
            env:
            - name: OTEL_SERVICE_NAME
              value: "my-application"
            - name: OTEL_EXPORTER_OTLP_ENDPOINT
              value: "http://otel-collector.observability.svc.cluster.local:4318"
            - name: OTEL_EXPORTER_OTLP_PROTOCOL
              value: "http/protobuf"
            - name: OTEL_TRACES_SAMPLER
              value: "parentbased_traceidratio"
            - name: OTEL_EXPORTER_OTLP_TIMEOUT
              value: "20000"
            - name: OTEL_EXPORTER_OTLP_INSECURE
              value: "true"
    EOF

Environment Variables

The following table describes the environment variables used to configure the OpenTelemetry SDK in your application:

Environment VariableDescriptionDefault Value
OTEL_SERVICE_NAMESets the value of the service.name resource attribute.""
OTEL_EXPORTER_OTLP_ENDPOINTThe base endpoint URL for the OTLP exporter.http://localhost:4317
OTEL_EXPORTER_OTLP_CERTIFICATEThe path to the TLS certificate file for verifying the server's identity.""
OTEL_TRACES_SAMPLERThe sampler to be used for traces.parentbased_always_on
OTEL_EXPORTER_OTLP_PROTOCOLThe transport protocol for OTLP exporter. Supported values: grpc, http/protobuf.grpc
OTEL_EXPORTER_OTLP_TIMEOUTThe maximum waiting time (in milliseconds) for the OTLP exporter.10000
OTEL_EXPORTER_OTLP_INSECUREWhether to disable TLS verification for the OTLP exporter.false