Docker Swarm Collector - Install
Prerequisites
Before installing the OpenTelemetry Collector, ensure you have:
- Docker Engine 20.10+ installed and running
- Docker Swarm initialized (run
docker swarm init
if not already) - Administrative access to the Docker host/cluster
Installation
Step 1: Create Configuration Directory
Creates a dedicated directory to organize the OpenTelemetry Collector configuration file.
mkdir -p ~/opentelemetry-collector
cd ~/opentelemetry-collector
Step 2: Create Collector Configuration
Defines how the OpenTelemetry Collector receives, processes, and exports telemetry data to SigNoz.
Create config.yaml
:
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
processors:
batch:
exporters:
otlp:
endpoint: "ingest.<YOUR_REGION>.signoz.cloud:443"
tls:
insecure: false
headers:
"signoz-ingestion-key": "<YOUR_INGESTION_KEY>"
debug:
verbosity: normal
extensions:
health_check:
pprof:
zpages:
service:
extensions: [health_check, pprof, zpages]
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [otlp]
metrics:
receivers: [otlp]
processors: [batch]
exporters: [otlp]
logs:
receivers: [otlp]
processors: [batch]
exporters: [otlp]
- Set your ingestion endpoint according to your SigNoz Cloud region. Refer to the SigNoz Cloud ingestion endpoint guide to find the correct endpoint for your deployment.
- Replace
<SIGNOZ_INGESTION_KEY>
with the one provided by SigNoz.
Step 3: Create a Docker Swarm Config
Adds the collector configuration to Swarm as a config object.
docker config create otelcol_config ./config.yaml
If you need to update it later, create a new config (for example otelcol_config_v2
) and update the service to use the new one.
Step 4: Deploy the OpenTelemetry Collector Service
Starts the OpenTelemetry Collector as a Swarm service to receive and forward telemetry data to SigNoz.
docker service create \
--name opentelemetry-collector \
--detach=true \
--restart-condition any \
--publish target=4317,published=4317,protocol=tcp \
--publish target=4318,published=4318,protocol=tcp \
--config source=otelcol_config,target=/etc/otelcol-contrib/config.yaml,mode=0444 \
otel/opentelemetry-collector-contrib:0.130.1
Optional: attach to an existing overlay network if your apps send data over that network:
docker service create \
--name opentelemetry-collector \
--network your_overlay_network \
--publish target=4317,published=4317,protocol=tcp \
--publish target=4318,published=4318,protocol=tcp \
--config source=otelcol_config,target=/etc/otelcol-contrib/config.yaml,mode=0444 \
otel/opentelemetry-collector-contrib:0.130.1
Verification
Check Collector Status
Verify that the OpenTelemetry Collector service is running and healthy.
List the service
docker service ls | grep opentelemetry-collector
Inspect tasks (replicas and placement)
docker service ps opentelemetry-collector
Check collector logs (from a task/container)
docker service logs -f opentelemetry-collector
You should see logs indicating successful startup and readiness to process data.