Skip to content

Commit 7df2b86

Browse files
committed
chore: add pyroscope to compose setup
The `debug` profile will now also start a pyroscope instance configured to scrape the indexer and matcher. Signed-off-by: Hank Donnay <[email protected]>
1 parent 1e574c2 commit 7df2b86

File tree

4 files changed

+70
-31
lines changed

4 files changed

+70
-31
lines changed

docker-compose.yaml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@ version: "3.7"
33
# This is just to hold a bunch of yaml anchors and try to consolidate parts of
44
# the config.
55
x-anchors:
6-
postgres: &postgres-image docker.io/library/postgres:12
7-
traefik: &traefik-image docker.io/library/traefik:v2.2
8-
pgadmin: &pgadmin-image docker.io/dpage/pgadmin4:5.7
6+
go: &go-image quay.io/projectquay/golang:1.20
7+
grafana: &grafana-image docker.io/grafana/grafana:8.0.3
98
jaeger: &jaeger-image docker.io/jaegertracing/all-in-one:1.26
9+
pgadmin: &pgadmin-image docker.io/dpage/pgadmin4:5.7
10+
postgres: &postgres-image docker.io/library/postgres:12
1011
prom: &prom-image docker.io/prom/prometheus:v2.30.2
11-
grafana: &grafana-image docker.io/grafana/grafana:8.0.3
12+
pyroscope: &pyroscope-image docker.io/pyroscope/pyroscope:0.37.2
1213
quay: &quay-image quay.io/projectquay/quay:latest
14+
rabbitmq: &rabbitmq-image docker.io/library/rabbitmq:3.11
1315
redis: &redis-image docker.io/library/redis:6.2
14-
go: &go-image quay.io/projectquay/golang:1.20
1516
skopeo: &skopeo-image quay.io/skopeo/stable:latest
16-
rabbitmq: &rabbitmq-image docker.io/library/rabbitmq:3.11
17+
traefik: &traefik-image docker.io/library/traefik:v2.2
1718
clair-service: &clair-service
1819
image: *go-image
1920
depends_on:
@@ -110,6 +111,18 @@ services:
110111
- '--web.external-url=http://localhost:8080/prom/'
111112
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
112113
- '--web.console.templates=/usr/share/prometheus/consoles'
114+
pyroscope:
115+
container_name: clair-pyroscope
116+
profiles:
117+
- debug
118+
image: *pyroscope-image
119+
volumes:
120+
- ./local-dev/pyroscope:/etc/pyroscope/
121+
command:
122+
- server
123+
environment:
124+
PYROSCOPE_LOG_LEVEL: info
125+
PYROSCOPE_WAIT_AFTER_STOP: 'true'
113126
grafana:
114127
container_name: clair-grafana
115128
profiles:
@@ -119,10 +132,12 @@ services:
119132
environment:
120133
GF_SERVER_ROOT_URL: /grafana
121134
GF_SERVER_SERVE_FROM_SUB_PATH: 'true'
135+
GF_INSTALL_PLUGINS: 'pyroscope-datasource,pyroscope-panel'
122136
volumes:
123137
- ./local-dev/grafana/provisioning/:/etc/grafana/provisioning/
124138
depends_on:
125139
- prometheus
140+
- pyroscope
126141

127142
# Notifier services -- use profile 'notifier'
128143
notifier: &notifier
Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
# config file version
23
apiVersion: 1
34

@@ -19,32 +20,15 @@ datasources:
1920
orgId: 1
2021
# <string> url
2122
url: http://clair-prometheus:9090/prom/
22-
# <string> database password, if used
23-
password:
24-
# <string> database user, if used
25-
user:
26-
# <string> database name, if used
27-
database:
28-
# <bool> enable/disable basic auth
29-
basicAuth: false
30-
# <string> basic auth username, if used
31-
basicAuthUser:
32-
# <string> basic auth password, if used
33-
basicAuthPassword:
34-
# <bool> enable/disable with credentials headers
35-
withCredentials:
3623
# <bool> mark as default datasource. Max one per org
3724
isDefault: true
38-
# <map> fields that will be converted to json and stored in json_data
39-
jsonData:
40-
graphiteVersion: "1.1"
41-
tlsAuth: false
42-
tlsAuthWithCACert: false
43-
# <string> json object of data that will be encrypted.
44-
secureJsonData:
45-
tlsCACert: "..."
46-
tlsClientCert: "..."
47-
tlsClientKey: "..."
4825
version: 1
49-
# <bool> allow users to edit datasources from the UI.
26+
editable: false
27+
- name: Pyroscope
28+
type: pyroscope-datasource
29+
access: proxy
30+
orgId: 1
31+
url: http://clair-pyroscope:4040/
32+
jsonData:
33+
path: http://clair-pyroscope:4040/
5034
editable: false

local-dev/pyroscope/server.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
analytics-opt-out: 'true'
3+
base-url: /pyroscope
4+
disable-pprof-endpoint: 'true'
5+
scrape-configs:
6+
- job-name: pyroscope
7+
scrape-interval: 10s
8+
scrape-timeout: 15s
9+
enabled-profiles: [cpu, mem, goroutines, mutex, block]
10+
use-delta-profiles: true
11+
static-configs:
12+
- application: clair-indexer
13+
spy-name: gospy
14+
targets:
15+
- clair-indexer:8089
16+
- application: clair-matcher
17+
spy-name: gospy
18+
targets:
19+
- clair-matcher:8089
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
http:
3+
routers:
4+
pyroscope:
5+
entryPoints: [traefik]
6+
rule: 'PathPrefix(`/pyroscope`)'
7+
service: pyroscope
8+
middlewares:
9+
- pyroscope-stripprefix
10+
middlewares:
11+
pyroscope-stripprefix:
12+
stripPrefix:
13+
prefixes:
14+
- /pyroscope
15+
services:
16+
pyroscope:
17+
loadBalancer:
18+
servers:
19+
- url: "http://clair-pyroscope:4040/"
20+
healthCheck:
21+
path: /

0 commit comments

Comments
 (0)