Skip to content

Commit a5957ba

Browse files
authored
DevEnv: Add pyroscope to self-instrumentation (grafana#78430)
1 parent 2502fe4 commit a5957ba

File tree

5 files changed

+81
-49
lines changed

5 files changed

+81
-49
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
loki.write "default" {
2+
endpoint {
3+
url = "http://loki:3100/loki/api/v1/push"
4+
}
5+
external_labels = {}
6+
}
7+
8+
logging {
9+
level = "debug"
10+
format = "json"
11+
write_to = [loki.write.default.receiver]
12+
}
13+
14+
tracing {
15+
sampling_fraction = 1
16+
write_to = [otelcol.exporter.otlp.tempo.input]
17+
}
18+
19+
otelcol.exporter.otlp "tempo" {
20+
client {
21+
endpoint = "tempo:4317"
22+
tls {
23+
insecure = true
24+
insecure_skip_verify = true
25+
}
26+
}
27+
}
28+
29+
faro.receiver "frontend" {
30+
server {
31+
listen_address = "0.0.0.0"
32+
listen_port = 12347
33+
cors_allowed_origins = ["*"]
34+
}
35+
36+
output {
37+
logs = [loki.write.default.receiver]
38+
traces = [otelcol.exporter.otlp.tempo.input]
39+
}
40+
}
41+
42+
pyroscope.write "default" {
43+
endpoint {
44+
url = "http://pyroscope:4040"
45+
}
46+
}
47+
48+
pyroscope.scrape "default" {
49+
targets = [
50+
{"__address__" = "host.docker.internal:6060", "service_name"="grafana"},
51+
]
52+
forward_to = [pyroscope.write.default.receiver]
53+
}

devenv/docker/blocks/self-instrumentation/agent.yaml

-40
This file was deleted.

devenv/docker/blocks/self-instrumentation/docker-compose.yaml

+12-5
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,22 @@
3030
ports:
3131
- "14268:14268"
3232
- "3200:3200"
33+
- "4317:4317"
34+
pyroscope:
35+
image: "grafana/pyroscope:latest"
36+
ports:
37+
- "4040:4040"
3338
agent:
34-
image: grafana/agent:v0.34.3
39+
image: grafana/agent:v0.37.0
40+
environment:
41+
- AGENT_MODE=flow
3542
entrypoint:
3643
- /bin/grafana-agent
37-
- -server.http.address=0.0.0.0:12345
38-
- -config.file=/etc/agent/agent.yaml
39-
- -enable-features=integrations-next
44+
- run
45+
- --server.http.listen-addr=0.0.0.0:12345
46+
- /etc/agent/config.river
4047
volumes:
41-
- ./docker/blocks/self-instrumentation/agent.yaml:/etc/agent/agent.yaml
48+
- ./docker/blocks/self-instrumentation/agent.flow:/etc/agent/config.river
4249
ports:
4350
- "12345:12345"
4451
- "12347:12347"

devenv/docker/blocks/self-instrumentation/promtail.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ clients:
99
- url: http://loki:3100/loki/api/v1/push
1010

1111
scrape_configs:
12-
- job_name: hosted-grafana/grafana
12+
- job_name: grafana
1313
static_configs:
1414
- targets:
1515
- localhost
1616
labels:
17-
job: hosted-grafana/grafana
17+
job: grafana
1818
__path__: /var/log/grafana/*log

devenv/docker/blocks/self-instrumentation/readme.md

+14-2
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,26 @@ To run this source, in the Grafana repo root:
66
make devenv sources=self-instrumentation
77
```
88

9-
This will setup Prometheus, Loki and Tempo.
9+
This will setup Prometheus, Loki, Tempo, and Pyroscope.
1010

1111
You then need to run Grafana with those added config:
1212

1313
```ini
14+
[log.file]
15+
format = json
16+
1417
[log.frontend]
1518
enabled = true
19+
custom_endpoint=http://localhost:12347/collect
1620

1721
[tracing.opentelemetry.jaeger]
1822
address = http://localhost:14268/api/traces
19-
```
23+
```
24+
25+
To collect profiles with pyroscope, you need to run Grafana with the following env vars:
26+
27+
```bash
28+
export GF_DIAGNOSTICS_PROFILING_ENABLED=true
29+
export GF_DIAGNOSTICS_PROFILING_ADDR=0.0.0.0
30+
make run
31+
``````

0 commit comments

Comments
 (0)