From 5249c86ee80816d8630b9628522e7c472be688aa Mon Sep 17 00:00:00 2001 From: Maksim Syomochkin Date: Wed, 18 Dec 2024 23:20:25 +0300 Subject: [PATCH] inital commit --- README.md | 26 ++++++++++++++++++++ TODO.md | 3 +++ compose.yaml | 42 +++++++++++++++++++++++++++++++++ grafana/datasource.yml | 14 +++++++++++ otel/otel-collector-config.yaml | 28 ++++++++++++++++++++++ prometheus/prometheus.yml | 39 ++++++++++++++++++++++++++++++ 6 files changed, 152 insertions(+) create mode 100644 README.md create mode 100644 TODO.md create mode 100644 compose.yaml create mode 100644 grafana/datasource.yml create mode 100644 otel/otel-collector-config.yaml create mode 100644 prometheus/prometheus.yml diff --git a/README.md b/README.md new file mode 100644 index 0000000..2a8e360 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# OTEL Collector Dev Stand +A simple Docker Compose setup that launches pre-configured and integrated services, allowing fully testing interactions with OpenTelemetry: +- OTEL Collector +- Jaeger +- Prometheus +- Grafana + +## OTEL Collector +Listens on standard OTLP ports (4317 gRPC, 4318 HTTP) and sends trace data to Jaeger. It also collects metrics and exposes them on port 8889 as a standard Prometheus exporter. + +## Jaeger +Accessible on port 16686. Receives traces from the OTEL Collector. + +## Prometheus +Accessible on port 9090. +Collects metrics from the following targets: +- OTEL Collector +- Grafana self-monitoring +- Prometheus self-monitoring + +## Grafana +Accessible on port 3000. +Login credentials: `admin/grafana`. +The following datasources are connected: +- Jaeger +- Prometheus \ No newline at end of file diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..f13f7c1 --- /dev/null +++ b/TODO.md @@ -0,0 +1,3 @@ +# TODO List for OTEL Collector Dev Stand + +- [ ] Add support for log collection and processing within the OTEL Collector setup. \ No newline at end of file diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..945bc31 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,42 @@ +services: + prometheus: + image: prom/prometheus + container_name: prometheus + command: + - '--config.file=/etc/prometheus/prometheus.yml' + ports: + - 9090:9090 + volumes: + - ./prometheus:/etc/prometheus + + grafana: + image: grafana/grafana + container_name: grafana + ports: + - 3000:3000 + environment: + - GF_SECURITY_ADMIN_USER=admin + - GF_SECURITY_ADMIN_PASSWORD=grafana + volumes: + - ./grafana:/etc/grafana/provisioning/datasources + + otel-collector: + image: otel/opentelemetry-collector:latest + container_name: otel-collector + command: ["--config=/etc/otel-collector-config.yaml"] + volumes: + - ./otel/otel-collector-config.yaml:/etc/otel-collector-config.yaml + ports: + - "4317:4317" # OTLP gRPC receiver + - "8889:8889" # Prometheus exposed port + depends_on: + - jaeger + + jaeger: + image: jaegertracing/all-in-one:latest + container_name: jaeger + environment: + - COLLECTOR_OTLP_ENABLED=true + - COLLECTOR_OTLP_GRPC_HOST_PORT=:4317 + ports: + - "16686:16686" \ No newline at end of file diff --git a/grafana/datasource.yml b/grafana/datasource.yml new file mode 100644 index 0000000..fe75757 --- /dev/null +++ b/grafana/datasource.yml @@ -0,0 +1,14 @@ +apiVersion: 1 + +datasources: +- name: Prometheus + type: prometheus + url: http://prometheus:9090 + isDefault: true + access: proxy + editable: true +- name: Jaeger + type: jaeger + url: http://jaeger:16686 + access: proxy + editable: true \ No newline at end of file diff --git a/otel/otel-collector-config.yaml b/otel/otel-collector-config.yaml new file mode 100644 index 0000000..83f41b7 --- /dev/null +++ b/otel/otel-collector-config.yaml @@ -0,0 +1,28 @@ +receivers: + otlp: + protocols: + grpc: + endpoint: 0.0.0.0:4317 + http: + endpoint: 0.0.0.0:4318 +processors: +exporters: + otlp: + endpoint: "http://jaeger:4317" + tls: + insecure: true + debug: + verbosity: detailed + prometheus: + endpoint: 0.0.0.0:8889 +service: + pipelines: + traces: + receivers: [otlp] + processors: [] + exporters: [otlp, debug] + metrics: + receivers: [otlp] + processors: [] + exporters: [prometheus, debug] + diff --git a/prometheus/prometheus.yml b/prometheus/prometheus.yml new file mode 100644 index 0000000..990e2ae --- /dev/null +++ b/prometheus/prometheus.yml @@ -0,0 +1,39 @@ +global: + scrape_interval: 15s + scrape_timeout: 10s + evaluation_interval: 15s +alerting: + alertmanagers: + - static_configs: + - targets: [] + scheme: http + timeout: 10s + api_version: v2 +scrape_configs: +- job_name: prometheus + honor_timestamps: true + scrape_interval: 15s + scrape_timeout: 10s + metrics_path: /metrics + scheme: http + static_configs: + - targets: + - localhost:9090 +- job_name: grafana + honor_timestamps: true + scrape_interval: 15s + scrape_timeout: 10s + metrics_path: /metrics + scheme: http + static_configs: + - targets: + - grafana:3000 +- job_name: otel-collector + honor_timestamps: true + scrape_interval: 15s + scrape_timeout: 10s + metrics_path: /metrics + scheme: http + static_configs: + - targets: + - otel-collector:8889 \ No newline at end of file