This example demonstrates how to run the OpenTelemetry Collector in Docker and send spans to it.
- Docker installed on your machine
- A Dash0 account with API credentials
-
Copy the
.env.templatefile to.envin the project root:cp ../../.env.template ../../.env
-
Update the
.envfile with your Dash0 credentials:DASH0_AUTH_TOKEN- Your Dash0 API tokenDASH0_DATASET- The dataset to send telemetry data to- Other environment variables can be left as their defaults or customized
Run the OpenTelemetry Collector in a Docker container:
./00_run.shThis will:
- Start the OpenTelemetry Collector in Docker
- Expose ports 4317 (gRPC) and 4318 (HTTP) for receiving telemetry
- Mount the local
config.yamlinto the container - Pass environment variables from your
.envfile to the container
To test the collector, you can send two sample spans (one of which will be dropped):
./01_send-spans.shThis script sends a sample trace span to the collector using the HTTP endpoint (port 4318). The collector will:
- Process the span with the configured batch processor
- Filter matching spans
- Output the span to the debug exporter (visible in logs)
- Forward the span to Dash0 using the OTLP exporter
The collector is also configured to transform logs using the transform processor:
./02_send-logs.shThis script sends a sample log to the collector using the HTTP endpoint (port 4318). The collector will:
- Process the log with the configured batch processor
- Set the missing timestamp fields
- Output the span to the debug exporter (visible in logs)
- Forward the span to Dash0 using the OTLP exporter