Skip to content

Commit

Permalink
Merge pull request #4934 from jsternberg/hack-grafana
Browse files Browse the repository at this point in the history
hack: add prometheus and grafana to hack/compose
  • Loading branch information
tonistiigi authored May 29, 2024
2 parents 4cf5e34 + 5bcbe47 commit 1c55173
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 3 deletions.
37 changes: 37 additions & 0 deletions hack/composefiles/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ services:
privileged: true
environment:
DELVE_PORT: 5000
OTEL_SERVICE_NAME: buildkitd
OTEL_EXPORTER_OTLP_ENDPOINT: http://otel-collector:4317
configs:
- source: buildkit_config
Expand All @@ -36,15 +37,51 @@ services:
target: /etc/otelcol-contrib/config.yaml
ports:
- 127.0.0.1:4317:4317
- 127.0.0.1:8000:8000
depends_on:
- jaeger

prometheus:
image: prom/prometheus:v2.48.1
configs:
- source: prometheus_config
target: /etc/prometheus/prometheus.yml
volumes:
- prometheus:/prometheus
depends_on:
- buildkit

grafana:
image: grafana/grafana-oss:10.2.3
configs:
- source: grafana_config
target: /etc/grafana/grafana.ini
- source: grafana_datasources_config
target: /etc/grafana/provisioning/datasources/datasources.yaml
ports:
- 127.0.0.1:3000:3000
volumes:
- grafana:/var/lib/grafana
depends_on:
- prometheus

volumes:
buildkit:
prometheus:
grafana:

configs:
buildkit_config:
file: ./buildkitd.toml

otelcol_config:
file: ./otelcol.yaml

prometheus_config:
file: ./prometheus.yml

grafana_config:
file: ./grafana.ini

grafana_datasources_config:
file: ./datasources.yaml
19 changes: 19 additions & 0 deletions hack/composefiles/datasources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: true
jsonData:
httpMethod: POST
manageAlerts: false
prometheusType: Prometheus
prometheusVersion: 2.48.1
# cacheLevel set to none because this is primarily used for development
# where caching is detrimental to the experience and there's not enough
# data where caching is helpful.
cacheLevel: 'None'
disableRecordingRules: false
incrementalQueryOverlapWindow: 10m
exemplarTraceIdDestinations: []
7 changes: 4 additions & 3 deletions hack/composefiles/extensions/buildx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ configs:
metrics::metric:
- 'instrumentation_scope.name != "github.com/docker/buildx"'
exporters::debug::verbosity: detailed
service::pipelines::metrics::receivers: [otlp]
service::pipelines::metrics::processors: [filter/buildx]
service::pipelines::metrics::exporters: [debug]
service::pipelines::metrics/buildx:
receivers: [otlp]
processors: [filter/buildx]
exporters: [debug]
3 changes: 3 additions & 0 deletions hack/composefiles/grafana.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[security]
admin_user = moby
admin_password = moby
6 changes: 6 additions & 0 deletions hack/composefiles/prometheus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
scrape_configs:
- job_name: buildkit
scrape_interval: 1m
static_configs:
- targets:
- "buildkit:6060"

0 comments on commit 1c55173

Please sign in to comment.