Carlos Aguni

Highly motivated self-taught IT analyst. Always learning and ready to explore new skills. An eternal apprentice.


Otel Collector Study

18 Sep 2022 »

start otel stack

git clone https://github.com/open-telemetry/opentelemetry-collector-contrib.git
cd opentelemetry-collector-contrib/examples/demo/

.env

OTELCOL_IMG=otel/opentelemetry-collector-contrib-dev:latest
OTELCOL_ARGS=
version: "2"
services:

  # Jaeger
  jaeger-all-in-one:
    image: jaegertracing/all-in-one:latest
    ports:
      - "16686:16686"
      - "14268"
      - "14250"

  # Collector
  otel-collector:
    image: ${OTELCOL_IMG}
    command: ["--config=/etc/otel-collector-config.yaml", "${OTELCOL_ARGS}"]
    volumes:
      - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
    ports:
      - "1888:1888"   # pprof extension
      - "8888:8888"   # Prometheus metrics exposed by the collector
      - "8889:8889"   # Prometheus exporter metrics
      - "13133:13133" # health_check extension
      - "4317:4317"   # OTLP gRPC receiver
      - "4318:4318"   # OTLP HTTP receiver
      - "55679:55679" # zpages extension
    depends_on:
      - jaeger-all-in-one

otel-collector-config.yml

receivers:
  otlp:
    protocols:
      grpc:
      http:
        cors:
           allowed_origins:
             - http://django-max:8080

exporters:
    #prometheus:
    #  endpoint: "0.0.0.0:8889"
    #  const_labels:
    #    label1: value1

  logging:

    #zipkin:
    #  endpoint: "http://zipkin-all-in-one:9411/api/v2/spans"
    #  format: proto

  jaeger:
    endpoint: jaeger-all-in-one:14250
    tls:
      insecure: true

processors:
  batch:

extensions:
  health_check:
  pprof:
    endpoint: :1888
  zpages:
    endpoint: :55679

service:
  extensions: [pprof, zpages, health_check]
  pipelines:
    traces:
      receivers: [otlp]
      processors: [batch]
      #exporters: [logging, zipkin, jaeger]
      exporters: [jaeger, logging]
      #exporters: [logging]
      #metrics:
      #  receivers: [otlp]
      #  processors: [batch]
      #  exporters: [logging, prometheus]

jaeger collector

docker-compose.yaml

version: "2"
services:

  # Jaeger
  jaeger-all-in-one:
    image: jaegertracing/all-in-one:latest
    ports:
      - "16686:16686"
      #- "14268:14268"
      - "14250"

  # Collector
  otel-collector:
    image: ${OTELCOL_IMG}
    command: ["--config=/etc/otel-collector-config.yaml", "${OTELCOL_ARGS}"]
    volumes:
      - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
    ports:
      - "1888:1888"   # pprof extension
      - "8888:8888"   # Prometheus metrics exposed by the collector
      - "8889:8889"   # Prometheus exporter metrics
      - "13133:13133" # health_check extension
      - "4317:4317"   # OTLP gRPC receiver
      - "4318:4318"   # OTLP HTTP receiver
      - "14268:14268"   # Jaeger HTTP receiver
      - "55679:55679" # zpages extension
    depends_on:
      - jaeger-all-in-one

otel-collector-config.yaml

receivers:
  jaeger:
    protocols:
      thrift_http: # 14268
  otlp:
    protocols:
      grpc:
      http:
        cors:
           allowed_origins:
             - '*'

exporters:
    #prometheus:
    #  endpoint: "0.0.0.0:8889"
    #  const_labels:
    #    label1: value1

  logging:

    #zipkin:
    #  endpoint: "http://zipkin-all-in-one:9411/api/v2/spans"
    #  format: proto

  jaeger:
    endpoint: jaeger-all-in-one:14250
    tls:
      insecure: true

processors:
  batch:

extensions:
  health_check:
  pprof:
    endpoint: :1888
  zpages:
    endpoint: :55679

service:
  extensions: [pprof, zpages, health_check]
  pipelines:
    traces:
      receivers: [jaeger,otlp]
      processors: [batch]
      #exporters: [logging, zipkin, jaeger]
      exporters: [jaeger, logging]
      #exporters: [logging]
      #metrics:
      #  receivers: [otlp]
      #  processors: [batch]
      #  exporters: [logging, prometheus]