From 7d82b3b2892dcbcd0b666b6dc98e7cfad7f0150c Mon Sep 17 00:00:00 2001 From: Vincent Stuyck Date: Fri, 31 Jul 2026 14:39:44 +0000 Subject: [PATCH] add inital config --- .gitignore | 1 + config/grafana-datasources.yaml | 49 ++++++++++++++++++++++ config/loki.yaml | 35 ++++++++++++++++ config/mimir.yaml | 54 ++++++++++++++++++++++++ config/otel-collector.yaml | 59 ++++++++++++++++++++++++++ config/tempo.yaml | 39 ++++++++++++++++++ docker-compose.yaml | 73 +++++++++++++++++++++++++++++++++ 7 files changed, 310 insertions(+) create mode 100644 .gitignore create mode 100644 config/grafana-datasources.yaml create mode 100644 config/loki.yaml create mode 100644 config/mimir.yaml create mode 100644 config/otel-collector.yaml create mode 100644 config/tempo.yaml create mode 100644 docker-compose.yaml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c49bd7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env diff --git a/config/grafana-datasources.yaml b/config/grafana-datasources.yaml new file mode 100644 index 0000000..bdf84b5 --- /dev/null +++ b/config/grafana-datasources.yaml @@ -0,0 +1,49 @@ +# config/grafana-datasources.yaml +# Auto-provisioned data sources for Grafana + +apiVersion: 1 + +datasources: + # Tempo for traces + - name: Tempo + uid: tempo + type: tempo + access: proxy + url: http://tempo:3200 + isDefault: false + jsonData: + tracesToLogsV2: + datasourceUid: loki + filterByTraceID: true + tracesToMetrics: + datasourceUid: mimir + nodeGraph: + enabled: true + serviceMap: + datasourceUid: mimir + + # Mimir for metrics + - name: Mimir + uid: mimir + type: prometheus + access: proxy + url: http://mimir:9009/prometheus + isDefault: true + jsonData: + exemplarTraceIdDestinations: + - name: traceID + datasourceUid: tempo + + # Loki for logs + - name: Loki + uid: loki + type: loki + access: proxy + url: http://loki:3100 + isDefault: false + jsonData: + derivedFields: + - name: TraceID + datasourceUid: tempo + matcherRegex: "traceID=(\\w+)" + url: "$${__value.raw}" diff --git a/config/loki.yaml b/config/loki.yaml new file mode 100644 index 0000000..957e759 --- /dev/null +++ b/config/loki.yaml @@ -0,0 +1,35 @@ +# config/loki.yaml +# Grafana Loki configuration for local development + +auth_enabled: false + +server: + http_listen_port: 3100 + +# Common configuration shared across components +common: + path_prefix: /loki + storage: + filesystem: + chunks_directory: /loki/chunks + rules_directory: /loki/rules + replication_factor: 1 + ring: + kvstore: + store: inmemory + +# Schema configuration defines how data is stored +schema_config: + configs: + - from: 2020-10-24 + store: tsdb + object_store: filesystem + schema: v13 + index: + prefix: index_ + period: 24h + +# Limits for local development +limits_config: + allow_structured_metadata: true + volume_enabled: true diff --git a/config/mimir.yaml b/config/mimir.yaml new file mode 100644 index 0000000..7c7e65c --- /dev/null +++ b/config/mimir.yaml @@ -0,0 +1,54 @@ +# config/mimir.yaml +# Grafana Mimir configuration for local development + +# Run all components in a single process +target: all + +# Server settings +server: + http_listen_port: 9009 + grpc_listen_port: 9095 + +# Single-tenant mode for simplicity +multitenancy_enabled: false + +# Block storage configuration +blocks_storage: + backend: filesystem + filesystem: + dir: /data/blocks + tsdb: + dir: /data/tsdb + bucket_store: + sync_dir: /data/sync + +# Compactor settings +compactor: + data_dir: /data/compactor + sharding_ring: + kvstore: + store: memberlist + +# Distributor accepts remote write from the Collector +distributor: + ring: + kvstore: + store: memberlist + +# Ingester configuration +ingester: + ring: + kvstore: + store: memberlist + replication_factor: 1 + +# Store gateway for querying blocks +store_gateway: + sharding_ring: + replication_factor: 1 + +# Ruler for alerting rules +ruler_storage: + backend: filesystem + filesystem: + dir: /data/rules diff --git a/config/otel-collector.yaml b/config/otel-collector.yaml new file mode 100644 index 0000000..12257af --- /dev/null +++ b/config/otel-collector.yaml @@ -0,0 +1,59 @@ +# config/otel-collector.yaml +# Collector configuration routing to the LGTM stack + +receivers: + otlp: + protocols: + grpc: + endpoint: 0.0.0.0:4317 + http: + endpoint: 0.0.0.0:4318 + +processors: + # Batch processor for efficient data transfer + batch: + timeout: 5s + send_batch_size: 512 + + # Add resource attributes for better correlation + resource: + attributes: + - key: environment + value: local-dev + action: upsert + +exporters: + # Send traces to Tempo via OTLP + otlp/tempo: + endpoint: tempo:4317 + tls: + insecure: true + + # Send metrics to Mimir via Prometheus remote write + prometheusremotewrite/mimir: + endpoint: http://mimir:9009/api/v1/push + tls: + insecure: true + + # Send logs to Loki via its native OTLP HTTP endpoint + otlphttp/loki: + endpoint: http://loki:3100/otlp + + # Keep debug output for development visibility + debug: + verbosity: basic + +service: + pipelines: + traces: + receivers: [otlp] + processors: [resource, batch] + exporters: [otlp/tempo, debug] + metrics: + receivers: [otlp] + processors: [resource, batch] + exporters: [prometheusremotewrite/mimir, debug] + logs: + receivers: [otlp] + processors: [resource, batch] + exporters: [otlphttp/loki, debug] diff --git a/config/tempo.yaml b/config/tempo.yaml new file mode 100644 index 0000000..7e55685 --- /dev/null +++ b/config/tempo.yaml @@ -0,0 +1,39 @@ +# config/tempo.yaml +# Grafana Tempo configuration for local development + +# Server configuration +server: + http_listen_port: 3200 + +# Distributor receives traces from the Collector +distributor: + receivers: + otlp: + protocols: + grpc: + endpoint: 0.0.0.0:4317 + +# Storage configuration using local filesystem +storage: + trace: + backend: local + local: + path: /var/tempo/blocks + wal: + path: /var/tempo/wal + +# Metrics generator creates span metrics for RED dashboards +metrics_generator: + registry: + external_labels: + source: tempo + storage: + path: /var/tempo/generator/wal + remote_write: + - url: http://mimir:9009/api/v1/push + +# Enable metrics-generator processors for the default tenant +overrides: + defaults: + metrics_generator: + processors: [span-metrics, service-graphs] diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..fc1a6ac --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,73 @@ + +volumes: + tempo-data: + mimir-data: + loki-data: + grafana-data: + +services: + + # OpenTelemetry Collector - receives and routes all telemetry + otel-collector: + image: otel/opentelemetry-collector-contrib + container_name: otel-collector + ports: + - 4317:4317 # gprc + - 4318:4318 # http + volumes: + - ./config/otel-collector.yaml:/etc/otelcol-contrib/config.yaml + depends_on: + - tempo + - mimir + - loki + + # Grafana Tempo - distributed tracing backend + tempo: + image: grafana/tempo:latest + container_name: tempo + volumes: + - ./config/tempo.yaml:/etc/tempo/config.yaml + - tempo-data:/var/tempo + command: ["-config.file=/etc/tempo/config.yaml"] + ports: + - "3200:3200" # Tempo API + + # Grafana Mimir - long-term metrics storage + mimir: + image: grafana/mimir:latest + container_name: mimir + volumes: + - ./config/mimir.yaml:/etc/mimir/config.yaml + - mimir-data:/data + command: ["-config.file=/etc/mimir/config.yaml"] + ports: + - "9009:9009" # Mimir API + + # Grafana Loki - log aggregation + loki: + image: grafana/loki:latest + container_name: loki + volumes: + - ./config/loki.yaml:/etc/loki/config.yaml + - loki-data:/loki + command: ["-config.file=/etc/loki/config.yaml"] + ports: + - "3100:3100" # Loki API + + # Grafana - visualization and dashboards + grafana: + image: grafana/grafana:latest + container_name: grafana + environment: + - GF_AUTH_ANONYMOUS_ENABLED=true + - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin + - GF_AUTH_DISABLE_LOGIN_FORM=true + volumes: + - ./config/grafana-datasources.yaml:/etc/grafana/provisioning/datasources/datasources.yaml + - grafana-data:/var/lib/grafana + ports: + - "3000:3000" # Grafana UI + depends_on: + - tempo + - mimir + - loki