Skip to content

Instantly share code, notes, and snippets.

@sjparkinson
Created January 4, 2024 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjparkinson/5c2ac4909d5475cffdc77557ad9a3356 to your computer and use it in GitHub Desktop.
Save sjparkinson/5c2ac4909d5475cffdc77557ad9a3356 to your computer and use it in GitHub Desktop.
OTel Collector carbon receiver with Prometheus remote write exporter.
version: '3.8'
services:
prometheus:
image: prom/prometheus
ports:
- 9090:9090
volumes:
- ./prometheus.yml:/prometheus/prometheus.yml
command:
- '--web.enable-remote-write-receiver'
otel-collector:
image: otel/opentelemetry-collector-contrib
volumes:
- ./otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml
ports:
- 8888:8888 # Prometheus metrics exposed by the Collector
- 2003:2003 # carbon receiver
receivers:
carbon:
endpoint: 0.0.0.0:2003
transport: tcp
processors:
memory_limiter:
check_interval: 1s
limit_percentage: 70
spike_limit_percentage: 20
batch: ~
exporters:
debug: ~
prometheusremotewrite:
endpoint: "http://prometheus:9090/api/v1/write"
tls:
insecure: true
extensions:
health_check: ~
zpages: ~
service:
extensions:
- health_check
- zpages
pipelines:
metrics:
receivers:
- carbon
processors:
- memory_limiter
- batch
exporters:
- debug
- prometheusremotewrite
global:
scrape_interval: 15s # By default, scrape targets every 15 seconds.
evaluation_interval: 15s # By default, scrape targets every 15 seconds.
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
- job_name: "otel-collector"
static_configs:
- targets: ["otel-collector:8888"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment