Deploy OpenTelemetry Collector
OTLP gateway for traces, metrics and logs, with token auth and disk queue
otel-collector
Just deployed
/var/lib/otelcol
Deploy and Host OpenTelemetry Collector on Railway
The OpenTelemetry Collector is the CNCF's vendor-neutral agent and gateway for telemetry. It receives traces, metrics and logs over OTLP from any OpenTelemetry SDK, batches and filters them, and exports them to one or more backends. This template runs the contrib distribution, version 0.165.0.
About Hosting OpenTelemetry Collector
Hosting the Collector means running one long-lived service that your applications can reach, and deciding where the data goes next. This template builds the official otel/opentelemetry-collector-contrib image from a GitHub repo and puts OTLP/HTTP on a public Railway domain and OTLP/gRPC on the private network. Both require a bearer token, which Railway generates at deploy time. Railway's health check probes the collector's health extension. By default everything received is printed to the deploy logs. Set three variables to forward it to Grafana Cloud, Honeycomb, Axiom or any OTLP backend, with a disk-backed retry queue on a volume.
Common Use Cases
- Give every service in a Railway project one OTLP endpoint for traces, metrics and logs
- Forward telemetry to a SaaS backend while keeping the vendor's API key in one place
- Buffer telemetry on disk so it survives backend outages and collector redeploys
Dependencies for OpenTelemetry Collector Hosting
- The template's repo, aalfath/opentelemetry-collector-railway-template (Dockerfile pinned to the official image, plus
config.yaml) - A Railway volume at
/var/lib/otelcolfor the persistent export queue
Deployment Dependencies
- OpenTelemetry Collector documentation
- Collector releases
- otel/opentelemetry-collector-contrib on Docker Hub
Implementation Details
Send data from any OpenTelemetry SDK:
OTEL_EXPORTER_OTLP_ENDPOINT=https://YOUR-DOMAIN
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_EXPORTER_OTLP_HEADERS=Authorization=Bearer%20YOUR-OTEL_AUTH_TOKEN
Services in the same project can use http://otel-collector.railway.internal:4318 (HTTP) or port 4317 (gRPC), with the same token.
To forward to a backend, set these on the otel-collector service:
OTEL_EXPORTERS=[debug, otlphttp/upstream]
OTLP_UPSTREAM_ENDPOINT=https://YOUR-BACKEND/otlp
OTLP_UPSTREAM_HEADERS={"Authorization":"Basic YOUR-KEY"}
Other optional variables: OTEL_DEBUG_VERBOSITY (basic, normal or detailed) and OTEL_MEMORY_LIMIT_MIB (default 1024). Updates arrive as new commits to the repo, listed in its CHANGELOG.md.
Why Deploy OpenTelemetry Collector on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying OpenTelemetry Collector on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
otel-collector
aalfath/opentelemetry-collector-railway-template
