OpenTelemetry Collector
The OpenTelemetry Collector is a vendor-agnostic implementation for receiving, processing, and exporting telemetry data. This infrastructure uses a custom-built OTel Collector with specific receivers, processors, and exporters tailored for the observability stack.Purpose
The OTel Collector serves as the central aggregation point for all observability data:- Traces → Tempo (via OTLP/gRPC)
- Metrics → Prometheus (via Remote Write)
- Logs → Loki (via OTLP/HTTP)
Custom Build
The OTel Collector is built using Nix to include only the required components, reducing image size and attack surface.Build Configuration
Fromflake.nix:67-86:
Components
- Receivers: OTLP (gRPC on :4317, HTTP on :4318)
- Processors: Batch processor for performance optimization
- Exporters:
otlp- For traces to Tempootlphttp- For logs to Lokiprometheusremotewrite- For metrics to Prometheus
Deployment Configuration
Fromnixidy/env/local/otel-collector.nix:
Endpoints
| Protocol | Port | Purpose |
|---|---|---|
| gRPC | 4317 | OTLP/gRPC endpoint for all telemetry |
| HTTP | 4318 | OTLP/HTTP endpoint (alternative) |
Resource Limits
Image Build and Caching
The collector image is built with Nix and cached in Cloudflare R2 for fast bootstrap times.Build Process
R2 Cache
CI automatically builds and uploads the OTel Collector image to R2 whenflake.nix or flake.lock changes:
- URL:
$R2_BUCKET_URL/{arch}/{hash}.tar - Architectures:
x86_64-linux,aarch64-linux - Hash: Based on
flake.nix+flake.lockcontent
Integration with Services
Istio
Istio sidecars (or ztunnel in ambient mode) send traces to the OTel Collector:Traefik
Traefik forwards traces via OTLP:Application Code
Applications can send telemetry directly to the OTel Collector:Data Flow
Related Components
Tempo
Distributed tracing backend
Prometheus
Metrics storage and query engine
Loki
Log aggregation system
Observability Architecture
Complete observability stack