From 9f7985205b35be8908499875460bcd70c7ed717a Mon Sep 17 00:00:00 2001 From: Caleb Schoepp Date: Mon, 22 Apr 2024 16:30:54 -0700 Subject: [PATCH] Setup a docker compose file that creates an o11y stack for Spin to use Signed-off-by: Caleb Schoepp --- hack/o11y-stack/docker-compose.yaml | 61 ++++++++++++++++++++++ hack/o11y-stack/grafana.yaml | 16 ++++++ hack/o11y-stack/otel-collector-config.yaml | 40 ++++++++++++++ hack/o11y-stack/prometheus.yaml | 1 + hack/o11y-stack/tempo.yaml | 23 ++++++++ 5 files changed, 141 insertions(+) create mode 100644 hack/o11y-stack/docker-compose.yaml create mode 100644 hack/o11y-stack/grafana.yaml create mode 100644 hack/o11y-stack/otel-collector-config.yaml create mode 100644 hack/o11y-stack/prometheus.yaml create mode 100644 hack/o11y-stack/tempo.yaml diff --git a/hack/o11y-stack/docker-compose.yaml b/hack/o11y-stack/docker-compose.yaml new file mode 100644 index 000000000..de2afd857 --- /dev/null +++ b/hack/o11y-stack/docker-compose.yaml @@ -0,0 +1,61 @@ +version: "3" +services: + otel-collector: + image: otel/opentelemetry-collector-contrib:0.98.0 + restart: always + command: + - "--config=/etc/otel-collector-config.yaml" + volumes: + - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml + ports: + - "8888:8888" # Prometheus metrics exposed by the collector + - "8889:8889" # Prometheus exporter metrics + - "4317:4317" # OTLP gRPC receiver + - "4318:4318" # OTLP gRPC receiver + depends_on: + - jaeger + - prometheus + - tempo + + jaeger: + image: jaegertracing/all-in-one:latest + restart: always + ports: + - "16686:16686" # UI + - "14268" # ?? + - "14250" # ?? + + tempo: + image: grafana/tempo:2.4.1 + command: + - '-config.file=/etc/tempo/config.yaml' + volumes: + - ./tempo.yaml:/etc/tempo/config.yaml + ports: + - 4318 + - 7999:7999 + + prometheus: + image: prom/prometheus:latest + restart: always + command: + - '--config.file=/etc/prometheus/prometheus.yaml' + - '--web.enable-remote-write-receiver' + volumes: + - ./prometheus.yaml:/etc/prometheus/prometheus.yaml + ports: + - "9090:9090" + + grafana: + image: grafana/grafana:10.4.2 + ports: + - 5050:3000 + volumes: + - ./grafana.yaml:/etc/grafana/provisioning/datasources/datasources.yaml + environment: + - GF_AUTH_ANONYMOUS_ENABLED=true + - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin + - GF_AUTH_DISABLE_LOGIN_FORM=true + depends_on: + - prometheus + - tempo diff --git a/hack/o11y-stack/grafana.yaml b/hack/o11y-stack/grafana.yaml new file mode 100644 index 000000000..ee5e68f52 --- /dev/null +++ b/hack/o11y-stack/grafana.yaml @@ -0,0 +1,16 @@ +apiVersion: 1 + +datasources: + - name: Prometheus + type: prometheus + url: http://prometheus:9090 + isDefault: true + access: proxy + editable: true + - name: Tempo + type: tempo + url: http://tempo:7999 + access: proxy + version: 1 + editable: false + uid: tempo \ No newline at end of file diff --git a/hack/o11y-stack/otel-collector-config.yaml b/hack/o11y-stack/otel-collector-config.yaml new file mode 100644 index 000000000..7b1ef06e0 --- /dev/null +++ b/hack/o11y-stack/otel-collector-config.yaml @@ -0,0 +1,40 @@ +receivers: + otlp: + protocols: + grpc: + endpoint: 0.0.0.0:4317 + http: + endpoint: 0.0.0.0:4318 + +exporters: + prometheusremotewrite: + endpoint: "http://prometheus:9090/api/v1/write" + tls: + insecure: true + + debug: + + otlp/jaeger: + endpoint: jaeger:4317 + tls: + insecure: true + + otlphttp/tempo: + endpoint: http://tempo:4318 + tls: + insecure: true + +processors: + batch: + +service: + extensions: [] + pipelines: + traces: + receivers: [otlp] + processors: [batch] + exporters: [debug, otlp/jaeger, otlphttp/tempo] + metrics: + receivers: [otlp] + processors: [batch] + exporters: [debug, prometheusremotewrite] \ No newline at end of file diff --git a/hack/o11y-stack/prometheus.yaml b/hack/o11y-stack/prometheus.yaml new file mode 100644 index 000000000..4a1490252 --- /dev/null +++ b/hack/o11y-stack/prometheus.yaml @@ -0,0 +1 @@ +scrape_configs: \ No newline at end of file diff --git a/hack/o11y-stack/tempo.yaml b/hack/o11y-stack/tempo.yaml new file mode 100644 index 000000000..a097408af --- /dev/null +++ b/hack/o11y-stack/tempo.yaml @@ -0,0 +1,23 @@ +server: + http_listen_port: 7999 + +distributor: + receivers: + otlp: + protocols: + http: + endpoint: "0.0.0.0:4318" + log_received_spans: + enabled: true + +# This is not tuned at all https://grafana.com/docs/tempo/latest/configuration/#storage +storage: + trace: + backend: local + block: + v2_encoding: zstd + wal: + path: /tmp/tempo/wal + v2_encoding: none + local: + path: /tmp/tempo/blocks \ No newline at end of file