Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Tempo, Prometheus and Grafana to docker-compose #571

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ cmd/docs/*
# docker-compose
gatewayd-files/
cmd/gatewayd-plugin-cache-linux-amd64-*
tempo-data

50 changes: 47 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ services:
retries: 5
gatewayd:
image: gatewaydio/gatewayd:latest
command: ["run", "--config", "/gatewayd-files/gatewayd.yaml", "--plugin-config", "/gatewayd-files/gatewayd_plugins.yaml"]
command: ["run", "--config", "/gatewayd-files/gatewayd.yaml", "--plugin-config", "/gatewayd-files/gatewayd_plugins.yaml", "--tracing", "--collector-url", "tempo:4317"]
environment:
# For more information about the environment variables, see:
# https://docs.gatewayd.io/using-gatewayd/configuration#environment-variables
Expand All @@ -48,8 +48,8 @@ services:
# GatewayD server for PostgreSQL clients to connect to
- "15432:15432"
# Prometheus metrics:
# http://localhost:9090/metrics
- "9090:9090"
# http://localhost:9090/metrics # Make sure the port is not used by prometheus before uncommenting the following line
# - "9090:9090"
# GatewayD HTTP gateway:
# http://localhost:18080/swagger-ui/ for the API documentation
# http://localhost:18080/healthz for the health check
Expand All @@ -74,3 +74,47 @@ services:
condition: service_healthy
install_plugins:
condition: service_completed_successfully

prometheus:
image: prom/prometheus:latest
volumes:
- ./observability-configs/prometheus.yaml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"
depends_on:
- gatewayd

tempo_init:
image: &tempoImage grafana/tempo:latest
user: root
entrypoint:
- "chown"
- "10001:10001"
- "/var/tempo"
volumes:
- ./tempo-data:/var/tempo

tempo:
image: *tempoImage
command: ["-config.file=/etc/tempo.yaml"]
volumes:
- ./observability-configs/tempo.yaml:/etc/tempo.yaml
- ./tempo-data:/var/tempo
ports:
- "4317:4317" # otlp grpc
depends_on:
- tempo_init

grafana:
image: grafana/grafana:latest
volumes:
- ./observability-configs/grafana-datasources.yaml:/etc/grafana/provisioning/datasources/datasources.yaml
environment:
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_DISABLE_LOGIN_FORM=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
ports:
- "3000:3000"
depends_on:
- prometheus
- tempo
31 changes: 31 additions & 0 deletions observability-configs/grafana-datasources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: 1

datasources:
- name: GatewayD Prometheus
type: prometheus
uid: prometheus
access: proxy
orgId: 1
url: http://prometheus:9090
basicAuth: false
isDefault: false
version: 1
editable: false
jsonData:
httpMethod: GET
- name: GatewayD Tempo
type: tempo
access: proxy
orgId: 1
url: http://tempo:3200
basicAuth: false
isDefault: true
version: 1
editable: false
apiVersion: 1
uid: tempo
jsonData:
httpMethod: GET
serviceMap:
datasourceUid: prometheus

13 changes: 13 additions & 0 deletions observability-configs/prometheus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
global:
scrape_interval: 5s

scrape_configs:
- job_name: "gatewayd-aggregated-metrics"
scrape_interval: 5s
metrics_path: /metrics
static_configs:
- targets: ["gatewayd:9090"]

- job_name: "tempo"
static_configs:
- targets: ["tempo:3200"]
43 changes: 43 additions & 0 deletions observability-configs/tempo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
stream_over_http_enabled: true
server:
http_listen_port: 3200
log_level: info

distributor:
receivers: # this configuration will listen on all ports and protocols that tempo is capable of.
otlp:
protocols:
grpc:

ingester:
max_block_duration: 5m # cut the headblock when this much time passes. this is being set for demo purposes and should probably be left alone normally

compactor:
compaction:
block_retention: 1h # overall Tempo trace retention. set for demo purposes

metrics_generator:
registry:
external_labels:
source: tempo
cluster: docker-compose
storage:
path: /var/tempo/generator/wal
remote_write:
- url: http://prometheus:9090/api/v1/write
send_exemplars: true
traces_storage:
path: /var/tempo/generator/traces

storage:
trace:
backend: local # backend configuration to use
wal:
path: /var/tempo/wal # where to store the wal locally
local:
path: /var/tempo/blocks

overrides:
defaults:
metrics_generator:
processors: [service-graphs, span-metrics, local-blocks] # enables metrics generator