Docker Compose Integration

Add observability to your Docker Compose applications

Overview

Add the OpenTelemetry Collector as a service in your Docker Compose setup to collect and forward telemetry from your containerized applications to Qorrelate.

Quick Start

version: '3.8'

services:
  otel-collector:
    image: otel/opentelemetry-collector-contrib:latest
    command: ["--config=/etc/otel-collector-config.yaml"]
    volumes:
      - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
    environment:
      - QORRELATE_API_KEY=${QORRELATE_API_KEY}
      - QORRELATE_ORG_ID=${QORRELATE_ORG_ID}
    ports:
      - "4317:4317"
      - "4318:4318"

  my-app:
    build: .
    environment:
      - OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
      - OTEL_SERVICE_NAME=my-app
    depends_on:
      - otel-collector

Collector Service Configuration

otel-collector:
  image: otel/opentelemetry-collector-contrib:latest
  container_name: otel-collector
  command: ["--config=/etc/otel-collector-config.yaml"]
  volumes:
    - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml:ro
  environment:
    - QORRELATE_API_KEY=${QORRELATE_API_KEY}
    - QORRELATE_ORG_ID=${QORRELATE_ORG_ID}
  ports:
    - "4317:4317"
    - "4318:4318"
  restart: unless-stopped

Application Configuration

my-app:
  build: .
  environment:
    - OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
    - OTEL_EXPORTER_OTLP_PROTOCOL=grpc
    - OTEL_SERVICE_NAME=my-app
    - OTEL_RESOURCE_ATTRIBUTES=service.version=1.0.0
  depends_on:
    - otel-collector

Collector Configuration File

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318

exporters:
  otlphttp:
    endpoint: https://qorrelate.io
    headers:
      Authorization: Bearer ${QORRELATE_API_KEY}
      X-Organization-Id: ${QORRELATE_ORG_ID}

service:
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [otlphttp]
    metrics:
      receivers: [otlp]
      exporters: [otlphttp]
    logs:
      receivers: [otlp]
      exporters: [otlphttp]

💡 Pro Tip

Store your API key in a .env file: QORRELATE_API_KEY=your_key