๐ก OpenTelemetry Collector
The OTEL Collector is the bridge between your apps and SigNoz. Your app sends raw telemetry data to the collector, the collector processes it, and then sends it to SigNoz.
๐๏ธ Architecture Overviewโ
Your Node.js App
โ (sends via gRPC port 4317 or HTTP port 4318)
OTEL Collector (running as service or Docker)
โ (forwards to SigNoz backend)
SigNoz ClickHouse DB
โ
SigNoz Dashboard (your browser)
๐ง The Three Parts of OTELโ
| Part | What It Does | Where It Runs |
|---|---|---|
| SDK (in your app) | Generates trace/metric/log data | Inside your Node.js / Python code |
| Collector | Receives, processes, and forwards data | As a system service (otelcol-contrib) |
| Backend (SigNoz) | Stores and displays the data | Docker container |
๐ฆ Install the OTEL Collectorโ
On Linux (Ubuntu/Debian) โ Recommendedโ
Download and install otelcol-contrib (the full-featured version):
๐ Versioning note: Use the latest stable collector release for new deployments. Keep one tested version pinned in your internal runbook so upgrades are controlled.
# Check latest version at https://github.com/open-telemetry/opentelemetry-collector-releases
# Download (replace version as needed)
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.97.0/otelcol-contrib_0.97.0_linux_amd64.deb
# Install
sudo dpkg -i otelcol-contrib_0.97.0_linux_amd64.deb
# Verify
otelcol-contrib --version
On Windowsโ
Download the .exe from:
https://github.com/open-telemetry/opentelemetry-collector-releases/releases
Choose: otelcol-contrib_X.X.X_windows_amd64.tar.gz
Extract and run:
.\otelcol-contrib.exe --config config.yaml
Via Docker (alternative)โ
docker run -d \
--name otel-collector \
-p 4317:4317 \
-p 4318:4318 \
-v $(pwd)/otel-config.yaml:/etc/otelcol-contrib/config.yaml \
otel/opentelemetry-collector-contrib:latest
๐ Collector Config Fileโ
The config file tells the collector:
- What data to receive (from your apps)
- How to process it (batching, filtering)
- Where to export it (SigNoz)
Location on Linux: /etc/otelcol-contrib/config.yaml
Here is the full config used in this project:
receivers:
# Receive traces and metrics from your apps via OTLP protocol
otlp:
protocols:
grpc: # port 4317 โ for Node.js, Python etc.
http: # port 4318 โ alternative HTTP protocol
# Collect host-level metrics (CPU, RAM) every 30 seconds
hostmetrics:
collection_interval: 30s
scrapers:
cpu: {}
memory: {}
# Read log files from PM2-managed apps
filelog/healthtune:
include:
- /home/youruser/.pm2/logs/healthtune-dev-api-out.log
- /home/youruser/.pm2/logs/healthtune-dev-api-error.log
filelog/trackx:
include:
- /home/youruser/.pm2/logs/trackx-dev-api-out.log
- /home/youruser/.pm2/logs/trackx-dev-api-error.log
processors:
# Batch data before sending โ better performance, fewer requests
batch:
exporters:
# Send everything to SigNoz
otlp:
endpoint: "YOUR_SIGNOZ_VM_IP:4317" # โ Change this to your SigNoz server IP
tls:
insecure: true # Dev/internal only. Use TLS certs for internet-facing traffic.
service:
pipelines:
# Traces pipeline: receive โ batch โ send to SigNoz
traces:
receivers: [otlp]
processors: [batch]
exporters: [otlp]
# Logs pipeline: read log files โ batch โ send to SigNoz
logs:
receivers: [filelog/healthtune, filelog/trackx]
processors: [batch]
exporters: [otlp]
โ๏ธ Customize the Config for Your Setupโ
Replace placeholders before startโ
YOUR_SIGNOZ_VM_IP: IP/DNS where SigNoz OTLP endpoint is reachable/home/youruser/.pm2/logs/...: replace with your PM2 log directory and filenames
Change the SigNoz endpointโ
exporters:
otlp:
endpoint: "34.31.206.197:4317" # Replace with YOUR SigNoz server IP
If SigNoz is on the same server as the collector:
endpoint: "localhost:4317"
Add your own log filesโ
receivers:
filelog/myapp:
include:
- /home/youruser/.pm2/logs/myapp-out.log
- /home/youruser/.pm2/logs/myapp-error.log
Then add it to the logs pipeline:
service:
pipelines:
logs:
receivers: [filelog/healthtune, filelog/trackx, filelog/myapp]
processors: [batch]
exporters: [otlp]
๐ก๏ธ Fix Log File Permissionsโ
The collector runs as the otelcol-contrib system user and may not have permission to read your PM2 log files. Fix this:
# Install ACL tools
sudo apt install -y acl
# Grant read access to otelcol-contrib user for all PM2 logs
sudo setfacl -m u:otelcol-contrib:r /home/youruser/.pm2/logs/*
# Verify the permission was set
getfacl /home/youruser/.pm2/logs/healthtune-dev-api-out.log
โถ๏ธ Start the Collectorโ
# Enable auto-start on reboot
sudo systemctl enable otelcol-contrib
# Start now
sudo systemctl start otelcol-contrib
# Or restart if already running
sudo systemctl restart otelcol-contrib
Check if It's Runningโ
sudo systemctl status otelcol-contrib
Expected output includes Active: active (running).
View Collector Logs (Useful for Debugging)โ
sudo journalctl -u otelcol-contrib -f
Press Ctrl+C to stop following logs.
๐งช How Tracing Works Inside Your Appโ
When your app receives a request, the OTEL SDK:
- Creates a trace (a unique ID for this entire request)
- Creates spans for each step (database query, external API call, etc.)
- Measures the time for each span
- Sends everything to the OTEL Collector
Example of a trace:
Trace: user-login-request
โโโ span: parse-jwt-token [3ms]
โโโ span: query-users-table [45ms]
โโโ span: hash-password-check [12ms]
โโโ span: send-response [2ms]
Total: 62ms
In SigNoz, you can click on any trace and see exactly this breakdown.
๐งช Test the Collector Is Receiving Dataโ
Send a test trace manually:
# Install grpcurl
sudo apt install -y grpcurl # or download from https://github.com/fullstorydev/grpcurl
# Send a test to the collector
grpcurl -plaintext localhost:4317 opentelemetry.proto.collector.trace.v1.TraceService/Export
Or just make some real API calls to your app and check the SigNoz dashboard within 30โ60 seconds.
โ Collector Checklistโ
# Is the collector running?
sudo systemctl status otelcol-contrib
# Is it listening on the right ports?
sudo ss -ltnp | grep ':4317'
sudo ss -ltnp | grep ':4318'
# Any errors?
sudo journalctl -u otelcol-contrib --since "5 minutes ago"
Expected result:
- Collector service is
active (running) - Port
4317is listening - No repeated export errors in recent logs
Next: Connect Your Production Apps โ
Official Documentation Linksโ
- SigNoz OTEL collector docs
- SigNoz logs guide
- OpenTelemetry collector docs
- OpenTelemetry collector configuration
- OpenTelemetry collector receivers/processors/exporters
- OpenTelemetry collector releases
Read in Sequenceโ
- Previous: 4-installation.md
- Next: 6-production-integration.md