Files
ophion/deploy/docker/otel-collector-config.yaml
bigtux 6f9657a3a8 feat: Universal auto-instrumentation for all languages
## New Features

### Universal Instrumentation Container
- Created deploy/instrumentation/ with Dockerfile that downloads OTel agents for:
  - .NET (glibc and musl/Alpine versions)
  - Node.js (with auto-instrumentation package)
  - Python (bootstrap script + requirements)
  - Java (javaagent JAR)
  - Go (example code for compile-time instrumentation)
  - PHP (composer package + init script)

### Universal instrument.sh Script
- Auto-detects application language from running processes
- Generates docker-compose snippets for each language
- Supports: dotnet, nodejs, python, java, go, php
- Usage: ./instrument.sh <container> [language] [otlp_endpoint]

### Improved docker-compose.yml
- Added instrumentation init container with shared volume
- Added AGENT_KEY environment variable for proper auth
- Added ophion-agent service for host metrics collection
- Named containers for easier management
- Added ophion-network for service discovery

### Documentation
- Created docs/QUICK_START.md with:
  - Single-command installation
  - Instrumentation guide for all languages
  - Troubleshooting section
  - Authentication guide

### Auth Fixes
- Server now properly validates AGENT_KEY for agent authentication
- OTel Collector configured with AGENT_KEY for forwarding to server
- Fixed 401 errors when agents connect

## Files Changed
- docker-compose.yml: Complete stack with all services
- deploy/instrumentation/*: Universal OTel agent container
- deploy/docker/otel-collector-config.yaml: Fixed auth headers
- instrument.sh: Universal instrumentation script
- docs/QUICK_START.md: Complete quick start guide
- README.md: Updated with new features
- .env.example: Added AGENT_KEY

## Testing
- Go code compiles successfully
- Docker images build correctly
- All changes are backwards compatible
2026-02-06 19:28:43 -03:00

144 lines
3.5 KiB
YAML

# ═══════════════════════════════════════════════════════════
# 🐍 OPHION - OpenTelemetry Collector Configuration
# Central collector for all instrumented applications
# ═══════════════════════════════════════════════════════════
receivers:
# OTLP receiver - accepts data from any OTLP-compatible SDK
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
cors:
allowed_origins:
- "*"
allowed_headers:
- "*"
# Prometheus receiver for scraping metrics
prometheus:
config:
scrape_configs:
- job_name: 'otel-collector'
scrape_interval: 15s
static_configs:
- targets: ['localhost:8888']
processors:
# Batch processor for better performance
batch:
timeout: 5s
send_batch_size: 512
send_batch_max_size: 1024
# Memory limiter to prevent OOM
memory_limiter:
check_interval: 1s
limit_percentage: 80
spike_limit_percentage: 25
# Resource processor to add common attributes
resource:
attributes:
- key: collector.name
value: ophion-collector
action: upsert
# Transform processor for data enrichment
transform:
trace_statements:
- context: span
statements:
- set(attributes["ophion.collected"], true)
metric_statements:
- context: datapoint
statements:
- set(attributes["ophion.collected"], true)
exporters:
# Export traces to Ophion server via HTTP
otlphttp/traces:
endpoint: http://server:8080
headers:
Authorization: "Bearer ${env:AGENT_KEY}"
X-Ophion-Source: otel-collector
compression: gzip
retry_on_failure:
enabled: true
initial_interval: 5s
max_interval: 30s
max_elapsed_time: 300s
# Export metrics to Ophion server
otlphttp/metrics:
endpoint: http://server:8080
headers:
Authorization: "Bearer ${env:AGENT_KEY}"
X-Ophion-Source: otel-collector
compression: gzip
# Export logs to Ophion server
otlphttp/logs:
endpoint: http://server:8080
headers:
Authorization: "Bearer ${env:AGENT_KEY}"
X-Ophion-Source: otel-collector
compression: gzip
# Debug exporter for troubleshooting
debug:
verbosity: basic
sampling_initial: 5
sampling_thereafter: 200
# Prometheus exporter for collector's own metrics
prometheus:
endpoint: 0.0.0.0:8889
namespace: ophion_collector
extensions:
# Health check extension
health_check:
endpoint: 0.0.0.0:13133
path: /health
# Performance profiler
pprof:
endpoint: 0.0.0.0:1777
# zPages for debugging
zpages:
endpoint: 0.0.0.0:55679
service:
extensions: [health_check, pprof, zpages]
pipelines:
# Traces pipeline
traces:
receivers: [otlp]
processors: [memory_limiter, batch, resource, transform]
exporters: [otlphttp/traces, debug]
# Metrics pipeline
metrics:
receivers: [otlp, prometheus]
processors: [memory_limiter, batch, resource]
exporters: [otlphttp/metrics, debug]
# Logs pipeline
logs:
receivers: [otlp]
processors: [memory_limiter, batch, resource]
exporters: [otlphttp/logs, debug]
telemetry:
logs:
level: info
encoding: json
metrics:
level: detailed
address: 0.0.0.0:8888