Skip to content

Self-Hosted Jaeger with Docker Compose

This guide details setting up Jaeger (all-in-one) via Docker Compose for tracing with Gate.

Quick Start: Get the Configs

To get the configuration file for this scenario:

  1. Clone the repository (if you haven't already):
    bash
    git clone https://github.com/minekube/gate.git
  2. Navigate to the directory for this scenario:
    bash
    cd gate/.web/docs/guide/otel/self-hosted/jaeger-config
    (Adjust the cd path if you cloned into a different parent directory or are already inside the gate repo directory, e.g., cd .web/docs/guide/otel/self-hosted/jaeger-config)

Or, view the file directly on GitHub.

Jaeger is a popular open-source, end-to-end distributed tracing system. The all-in-one image is a quick way to get started with Jaeger for development and testing. It includes the Jaeger Collector (which can receive OTLP), Agent, Query service, and UI in a single container.

Gate can send traces directly to Jaeger using the OTLP exporter.

1. Docker Compose Configuration

Create a docker-compose.yml file (e.g., within the jaeger-config directory mentioned in the Quick Start). You can place the following content into this file and, after navigating into that directory, run docker compose up -d:

yaml
version: '3.8'

services:
  jaeger:
    image: jaegertracing/all-in-one:latest
    container_name: jaeger
    environment:
      - COLLECTOR_OTLP_ENABLED=true
      # Add any other Jaeger-specific environment variables if needed
    ports:
      # OTLP receiver ports (gRPC and HTTP)
      - '4317:4317' # OTLP gRPC
      - '4318:4318' # OTLP HTTP
      # Jaeger UI
      - '16686:16686' # Jaeger Query UI
      # Other Jaeger ports (optional, for different protocols)
      # - "6831:6831/udp" # Jaeger agent (jaeger.thrift over compact thrift protocol)
      # - "6832:6832/udp" # Jaeger agent (jaeger.thrift over binary thrift protocol)
      # - "5778:5778"     # Jaeger agent (serve configs)
      # - "14268:14268"   # Jaeger collector (jaeger.thrift directly from clients)
      # - "9411:9411"     # Jaeger collector (Zipkin compatible endpoint)
    networks:
      - otel-jaeger-net # Optional: use a dedicated network or an existing one

networks:
  otel-jaeger-net:
    driver: bridge

2. Configure Gate Environment Variables

To send traces from Gate to Jaeger:

bash
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318" # Or IP of Docker host if Gate is external
export OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf"
export OTEL_TRACES_ENABLED="true"
export OTEL_METRICS_ENABLED="false" # Jaeger does not support metrics
# The following INSECURE flag is necessary when using an http:// endpoint for traces:
export OTEL_EXPORTER_OTLP_TRACES_INSECURE="true"
# OTEL_SERVICE_NAME is highly recommended, e.g., "gate-dev"
export OTEL_SERVICE_NAME="gate-jaeger-example"

Note on Insecure Connection: As with the Tempo setup, if your OTEL_EXPORTER_OTLP_ENDPOINT (e.g., http://localhost:4317) uses an insecure http:// connection, you must explicitly enable insecure connections for traces by setting OTEL_EXPORTER_OTLP_TRACES_INSECURE="true" as shown in the configuration example above. If also sending OTLP metrics via HTTP to Jaeger or a collector, OTEL_EXPORTER_OTLP_METRICS_INSECURE="true" would be needed too. Remember to use secure https:// endpoints and authentication in production.

If Gate is running as a Docker container on the same Docker network (otel-jaeger-net), you can use the service name:

bash
export OTEL_EXPORTER_OTLP_ENDPOINT="http://jaeger:4317"

Note: For this Jaeger setup, metrics collection with Prometheus is not included. Jaeger primarily focuses on tracing. If you need metrics alongside traces sent via OTLP from Gate, you would typically use an OpenTelemetry Collector that can route traces to Jaeger and simultaneously expose metrics for Prometheus (or send them to another metrics backend).

3. Running Jaeger

  1. Save the docker-compose.yml file (e.g. as docker-compose.yml inside your jaeger-config directory).
  2. Open a terminal in that directory (e.g., jaeger-config) and run:
    bash
    docker compose up -d
  3. Access Jaeger UI:

4. Viewing Traces in Jaeger

  • Once Gate is running and configured to send traces to Jaeger, you should be able to see your OTEL_SERVICE_NAME (e.g., "gate-jaeger-example") in the "Service" dropdown in the Jaeger UI.
  • Select your service and click "Find Traces" to see the collected trace data.

Released under the Apache 2.0 License. (web version: 5388a6f7)