mirror of
https://github.com/grafana/grafana.git
synced 2024-12-28 01:41:24 -06:00
DevEnv: Add pyroscope to self-instrumentation (#78430)
This commit is contained in:
parent
2502fe4d19
commit
a5957ba555
53
devenv/docker/blocks/self-instrumentation/agent.flow
Normal file
53
devenv/docker/blocks/self-instrumentation/agent.flow
Normal file
@ -0,0 +1,53 @@
|
||||
loki.write "default" {
|
||||
endpoint {
|
||||
url = "http://loki:3100/loki/api/v1/push"
|
||||
}
|
||||
external_labels = {}
|
||||
}
|
||||
|
||||
logging {
|
||||
level = "debug"
|
||||
format = "json"
|
||||
write_to = [loki.write.default.receiver]
|
||||
}
|
||||
|
||||
tracing {
|
||||
sampling_fraction = 1
|
||||
write_to = [otelcol.exporter.otlp.tempo.input]
|
||||
}
|
||||
|
||||
otelcol.exporter.otlp "tempo" {
|
||||
client {
|
||||
endpoint = "tempo:4317"
|
||||
tls {
|
||||
insecure = true
|
||||
insecure_skip_verify = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
faro.receiver "frontend" {
|
||||
server {
|
||||
listen_address = "0.0.0.0"
|
||||
listen_port = 12347
|
||||
cors_allowed_origins = ["*"]
|
||||
}
|
||||
|
||||
output {
|
||||
logs = [loki.write.default.receiver]
|
||||
traces = [otelcol.exporter.otlp.tempo.input]
|
||||
}
|
||||
}
|
||||
|
||||
pyroscope.write "default" {
|
||||
endpoint {
|
||||
url = "http://pyroscope:4040"
|
||||
}
|
||||
}
|
||||
|
||||
pyroscope.scrape "default" {
|
||||
targets = [
|
||||
{"__address__" = "host.docker.internal:6060", "service_name"="grafana"},
|
||||
]
|
||||
forward_to = [pyroscope.write.default.receiver]
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
logs:
|
||||
positions_directory: /tmp/loki-pos
|
||||
configs:
|
||||
- name: default
|
||||
scrape_configs: []
|
||||
clients:
|
||||
- url: http://host.docker.internal:3100/loki/api/v1/push
|
||||
traces:
|
||||
configs:
|
||||
- name: default
|
||||
remote_write:
|
||||
- endpoint: http://host.docker.internal:3200
|
||||
insecure: true
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
http:
|
||||
cors:
|
||||
allowed_origins:
|
||||
- "*"
|
||||
integrations:
|
||||
app_agent_receiver_configs:
|
||||
- autoscrape:
|
||||
enable: false
|
||||
instance: "frontend"
|
||||
logs_instance: "default"
|
||||
traces_instance: "default"
|
||||
server:
|
||||
host: 0.0.0.0
|
||||
port: 12347
|
||||
cors_allowed_origins:
|
||||
- "*"
|
||||
logs_labels: # labels to add to loki log record
|
||||
app: frontend # static value
|
||||
kind: # value will be taken from log items. exception, log, measurement, etc
|
||||
logs_send_timeout: 5000
|
||||
sourcemaps:
|
||||
download: true # will download source file, extract source map location,
|
||||
# download source map and use it to transform stack trace locations
|
@ -30,15 +30,22 @@
|
||||
ports:
|
||||
- "14268:14268"
|
||||
- "3200:3200"
|
||||
- "4317:4317"
|
||||
pyroscope:
|
||||
image: "grafana/pyroscope:latest"
|
||||
ports:
|
||||
- "4040:4040"
|
||||
agent:
|
||||
image: grafana/agent:v0.34.3
|
||||
image: grafana/agent:v0.37.0
|
||||
environment:
|
||||
- AGENT_MODE=flow
|
||||
entrypoint:
|
||||
- /bin/grafana-agent
|
||||
- -server.http.address=0.0.0.0:12345
|
||||
- -config.file=/etc/agent/agent.yaml
|
||||
- -enable-features=integrations-next
|
||||
- run
|
||||
- --server.http.listen-addr=0.0.0.0:12345
|
||||
- /etc/agent/config.river
|
||||
volumes:
|
||||
- ./docker/blocks/self-instrumentation/agent.yaml:/etc/agent/agent.yaml
|
||||
- ./docker/blocks/self-instrumentation/agent.flow:/etc/agent/config.river
|
||||
ports:
|
||||
- "12345:12345"
|
||||
- "12347:12347"
|
||||
|
@ -9,10 +9,10 @@ clients:
|
||||
- url: http://loki:3100/loki/api/v1/push
|
||||
|
||||
scrape_configs:
|
||||
- job_name: hosted-grafana/grafana
|
||||
- job_name: grafana
|
||||
static_configs:
|
||||
- targets:
|
||||
- localhost
|
||||
labels:
|
||||
job: hosted-grafana/grafana
|
||||
job: grafana
|
||||
__path__: /var/log/grafana/*log
|
||||
|
@ -6,14 +6,26 @@ To run this source, in the Grafana repo root:
|
||||
make devenv sources=self-instrumentation
|
||||
```
|
||||
|
||||
This will setup Prometheus, Loki and Tempo.
|
||||
This will setup Prometheus, Loki, Tempo, and Pyroscope.
|
||||
|
||||
You then need to run Grafana with those added config:
|
||||
|
||||
```ini
|
||||
[log.file]
|
||||
format = json
|
||||
|
||||
[log.frontend]
|
||||
enabled = true
|
||||
custom_endpoint=http://localhost:12347/collect
|
||||
|
||||
[tracing.opentelemetry.jaeger]
|
||||
address = http://localhost:14268/api/traces
|
||||
```
|
||||
|
||||
To collect profiles with pyroscope, you need to run Grafana with the following env vars:
|
||||
|
||||
```bash
|
||||
export GF_DIAGNOSTICS_PROFILING_ENABLED=true
|
||||
export GF_DIAGNOSTICS_PROFILING_ADDR=0.0.0.0
|
||||
make run
|
||||
``````
|
||||
|
Loading…
Reference in New Issue
Block a user