Skip to content

Instantly share code, notes, and snippets.

@inigohu
Created October 13, 2021 10:34
Show Gist options
  • Save inigohu/655244b158b052d85ec9b3754b627185 to your computer and use it in GitHub Desktop.
Save inigohu/655244b158b052d85ec9b3754b627185 to your computer and use it in GitHub Desktop.
opentelemetry-collector example
version: "3.7"
services:
otel-collector:
container_name: otel-collector
image: otel/opentelemetry-collector-contrib:0.36.0
command: ["--config=/etc/otel-collector-config.yaml"]
volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
network_mode: "host"
ports:
- "4317:4317" # OpenTelemetry receiver
- "1888:1888" # pprof extension
- "8888:8888" # Prometheus metrics
- "8889:8889" # Prometheus exporter metrics
- "13133:13133" # health_check extension
- "55679:55679" # zpages extension
zipkin:
container_name: zipkin
image: openzipkin/zipkin:latest
network_mode: "host"
ports:
- "9411:9411"
prometheus:
container_name: prometheus
image: prom/prometheus:latest
volumes:
- ./prometheus.yaml:/etc/prometheus/prometheus.yml
network_mode: "host"
ports:
- "9090:9090"
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
processors:
exporters:
zipkin:
endpoint: "http://localhost:9411/api/v2/spans"
format: proto
default_service_name: "observability service"
prometheus:
endpoint: "0.0.0.0:8889"
extensions:
health_check:
endpoint: 0.0.0.0:13133
pprof:
endpoint: :1888
zpages:
endpoint: :55679
service:
extensions: [pprof, zpages, health_check]
pipelines:
traces:
receivers: [otlp]
processors: []
exporters: [zipkin]
metrics:
receivers: [otlp]
processors: []
exporters: [prometheus]
scrape_configs:
- job_name: 'otel'
scrape_interval: 5s
static_configs:
- targets: ['localhost:8889']
@inigohu
Copy link
Author

inigohu commented Oct 13, 2021

Run: docker-compose up -d

Traces: http://localhost:9411/zipkin
Metrics: http://localhost:9090/

Remember to set your opentelemetry-collector exporter (insutrumentation-host) to localhost:4317

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment