Skip to content

Commit

Permalink
chore: add pyroscope to compose setup
Browse files Browse the repository at this point in the history
The `debug` profile will now also start a pyroscope instance configured
to scrape the indexer and matcher.

Signed-off-by: Hank Donnay <[email protected]>
  • Loading branch information
hdonnay committed Jul 7, 2023
1 parent 1e574c2 commit 7df2b86
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 31 deletions.
27 changes: 21 additions & 6 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ version: "3.7"
# This is just to hold a bunch of yaml anchors and try to consolidate parts of
# the config.
x-anchors:
postgres: &postgres-image docker.io/library/postgres:12
traefik: &traefik-image docker.io/library/traefik:v2.2
pgadmin: &pgadmin-image docker.io/dpage/pgadmin4:5.7
go: &go-image quay.io/projectquay/golang:1.20
grafana: &grafana-image docker.io/grafana/grafana:8.0.3
jaeger: &jaeger-image docker.io/jaegertracing/all-in-one:1.26
pgadmin: &pgadmin-image docker.io/dpage/pgadmin4:5.7
postgres: &postgres-image docker.io/library/postgres:12
prom: &prom-image docker.io/prom/prometheus:v2.30.2
grafana: &grafana-image docker.io/grafana/grafana:8.0.3
pyroscope: &pyroscope-image docker.io/pyroscope/pyroscope:0.37.2
quay: &quay-image quay.io/projectquay/quay:latest
rabbitmq: &rabbitmq-image docker.io/library/rabbitmq:3.11
redis: &redis-image docker.io/library/redis:6.2
go: &go-image quay.io/projectquay/golang:1.20
skopeo: &skopeo-image quay.io/skopeo/stable:latest
rabbitmq: &rabbitmq-image docker.io/library/rabbitmq:3.11
traefik: &traefik-image docker.io/library/traefik:v2.2
clair-service: &clair-service
image: *go-image
depends_on:
Expand Down Expand Up @@ -110,6 +111,18 @@ services:
- '--web.external-url=http://localhost:8080/prom/'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
pyroscope:
container_name: clair-pyroscope
profiles:
- debug
image: *pyroscope-image
volumes:
- ./local-dev/pyroscope:/etc/pyroscope/
command:
- server
environment:
PYROSCOPE_LOG_LEVEL: info
PYROSCOPE_WAIT_AFTER_STOP: 'true'
grafana:
container_name: clair-grafana
profiles:
Expand All @@ -119,10 +132,12 @@ services:
environment:
GF_SERVER_ROOT_URL: /grafana
GF_SERVER_SERVE_FROM_SUB_PATH: 'true'
GF_INSTALL_PLUGINS: 'pyroscope-datasource,pyroscope-panel'
volumes:
- ./local-dev/grafana/provisioning/:/etc/grafana/provisioning/
depends_on:
- prometheus
- pyroscope

# Notifier services -- use profile 'notifier'
notifier: &notifier
Expand Down
34 changes: 9 additions & 25 deletions local-dev/grafana/provisioning/datasources/datasource.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# config file version
apiVersion: 1

Expand All @@ -19,32 +20,15 @@ datasources:
orgId: 1
# <string> url
url: http://clair-prometheus:9090/prom/
# <string> database password, if used
password:
# <string> database user, if used
user:
# <string> database name, if used
database:
# <bool> enable/disable basic auth
basicAuth: false
# <string> basic auth username, if used
basicAuthUser:
# <string> basic auth password, if used
basicAuthPassword:
# <bool> enable/disable with credentials headers
withCredentials:
# <bool> mark as default datasource. Max one per org
isDefault: true
# <map> fields that will be converted to json and stored in json_data
jsonData:
graphiteVersion: "1.1"
tlsAuth: false
tlsAuthWithCACert: false
# <string> json object of data that will be encrypted.
secureJsonData:
tlsCACert: "..."
tlsClientCert: "..."
tlsClientKey: "..."
version: 1
# <bool> allow users to edit datasources from the UI.
editable: false
- name: Pyroscope
type: pyroscope-datasource
access: proxy
orgId: 1
url: http://clair-pyroscope:4040/
jsonData:
path: http://clair-pyroscope:4040/
editable: false
19 changes: 19 additions & 0 deletions local-dev/pyroscope/server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
analytics-opt-out: 'true'
base-url: /pyroscope
disable-pprof-endpoint: 'true'
scrape-configs:
- job-name: pyroscope
scrape-interval: 10s
scrape-timeout: 15s
enabled-profiles: [cpu, mem, goroutines, mutex, block]
use-delta-profiles: true
static-configs:
- application: clair-indexer
spy-name: gospy
targets:
- clair-indexer:8089
- application: clair-matcher
spy-name: gospy
targets:
- clair-matcher:8089
21 changes: 21 additions & 0 deletions local-dev/traefik/config/pyroscope.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
http:
routers:
pyroscope:
entryPoints: [traefik]
rule: 'PathPrefix(`/pyroscope`)'
service: pyroscope
middlewares:
- pyroscope-stripprefix
middlewares:
pyroscope-stripprefix:
stripPrefix:
prefixes:
- /pyroscope
services:
pyroscope:
loadBalancer:
servers:
- url: "http://clair-pyroscope:4040/"
healthCheck:
path: /

0 comments on commit 7df2b86

Please sign in to comment.