Skip to content

Commit b4c18f7

Browse files
authored
chore: dev doc and provisioned grafana datasource for pyroscope (#2356)
1 parent 79f5300 commit b4c18f7

File tree

3 files changed

+254
-2
lines changed

3 files changed

+254
-2
lines changed
Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
{
2+
"annotations": {
3+
"list": [
4+
{
5+
"builtIn": 1,
6+
"datasource": {
7+
"type": "grafana",
8+
"uid": "-- Grafana --"
9+
},
10+
"enable": true,
11+
"hide": true,
12+
"iconColor": "rgba(0, 211, 255, 1)",
13+
"name": "Annotations & Alerts",
14+
"type": "dashboard"
15+
}
16+
]
17+
},
18+
"editable": true,
19+
"fiscalYearStartMonth": 0,
20+
"graphTooltip": 1,
21+
"id": 3,
22+
"links": [],
23+
"panels": [
24+
{
25+
"datasource": {
26+
"type": "prometheus",
27+
"uid": "PBFA97CFB590B2093"
28+
},
29+
"fieldConfig": {
30+
"defaults": {
31+
"color": {
32+
"mode": "palette-classic"
33+
},
34+
"custom": {
35+
"axisBorderShow": false,
36+
"axisCenteredZero": false,
37+
"axisColorMode": "text",
38+
"axisLabel": "",
39+
"axisPlacement": "auto",
40+
"barAlignment": 0,
41+
"barWidthFactor": 0.6,
42+
"drawStyle": "line",
43+
"fillOpacity": 0,
44+
"gradientMode": "none",
45+
"hideFrom": {
46+
"legend": false,
47+
"tooltip": false,
48+
"viz": false
49+
},
50+
"insertNulls": false,
51+
"lineInterpolation": "linear",
52+
"lineWidth": 1,
53+
"pointSize": 5,
54+
"scaleDistribution": {
55+
"type": "linear"
56+
},
57+
"showPoints": "auto",
58+
"spanNulls": false,
59+
"stacking": {
60+
"group": "A",
61+
"mode": "none"
62+
},
63+
"thresholdsStyle": {
64+
"mode": "off"
65+
}
66+
},
67+
"mappings": [],
68+
"thresholds": {
69+
"mode": "absolute",
70+
"steps": [
71+
{
72+
"color": "green"
73+
},
74+
{
75+
"color": "red",
76+
"value": 80
77+
}
78+
]
79+
}
80+
},
81+
"overrides": []
82+
},
83+
"gridPos": {
84+
"h": 8,
85+
"w": 24,
86+
"x": 0,
87+
"y": 0
88+
},
89+
"id": 3,
90+
"options": {
91+
"legend": {
92+
"calcs": [],
93+
"displayMode": "list",
94+
"placement": "bottom",
95+
"showLegend": true
96+
},
97+
"tooltip": {
98+
"hideZeros": false,
99+
"mode": "single",
100+
"sort": "none"
101+
}
102+
},
103+
"pluginVersion": "12.0.2",
104+
"targets": [
105+
{
106+
"datasource": {
107+
"type": "prometheus",
108+
"uid": "PBFA97CFB590B2093"
109+
},
110+
"editorMode": "code",
111+
"expr": "avg(router_engine_connections{ })",
112+
"legendFormat": "__auto",
113+
"range": true,
114+
"refId": "A"
115+
}
116+
],
117+
"title": "Connections",
118+
"type": "timeseries"
119+
},
120+
{
121+
"datasource": {
122+
"type": "prometheus",
123+
"uid": "PBFA97CFB590B2093"
124+
},
125+
"fieldConfig": {
126+
"defaults": {
127+
"color": {
128+
"mode": "palette-classic"
129+
},
130+
"custom": {
131+
"axisBorderShow": false,
132+
"axisCenteredZero": false,
133+
"axisColorMode": "text",
134+
"axisLabel": "",
135+
"axisPlacement": "auto",
136+
"barAlignment": 0,
137+
"barWidthFactor": 0.6,
138+
"drawStyle": "line",
139+
"fillOpacity": 0,
140+
"gradientMode": "none",
141+
"hideFrom": {
142+
"legend": false,
143+
"tooltip": false,
144+
"viz": false
145+
},
146+
"insertNulls": false,
147+
"lineInterpolation": "linear",
148+
"lineWidth": 1,
149+
"pointSize": 5,
150+
"scaleDistribution": {
151+
"type": "linear"
152+
},
153+
"showPoints": "auto",
154+
"spanNulls": false,
155+
"stacking": {
156+
"group": "A",
157+
"mode": "none"
158+
},
159+
"thresholdsStyle": {
160+
"mode": "off"
161+
}
162+
},
163+
"mappings": [],
164+
"thresholds": {
165+
"mode": "absolute",
166+
"steps": [
167+
{
168+
"color": "green"
169+
},
170+
{
171+
"color": "red",
172+
"value": 80
173+
}
174+
]
175+
}
176+
},
177+
"overrides": []
178+
},
179+
"gridPos": {
180+
"h": 8,
181+
"w": 24,
182+
"x": 0,
183+
"y": 8
184+
},
185+
"id": 1,
186+
"options": {
187+
"legend": {
188+
"calcs": [],
189+
"displayMode": "list",
190+
"placement": "bottom",
191+
"showLegend": true
192+
},
193+
"tooltip": {
194+
"hideZeros": false,
195+
"mode": "single",
196+
"sort": "none"
197+
}
198+
},
199+
"pluginVersion": "12.0.2",
200+
"targets": [
201+
{
202+
"adhocFilters": [],
203+
"datasource": {
204+
"type": "prometheus",
205+
"uid": "PBFA97CFB590B2093"
206+
},
207+
"editorMode": "code",
208+
"expr": "avg(router_engine_triggers{ })",
209+
"fromExploreMetrics": true,
210+
"interval": "",
211+
"legendFormat": "avg",
212+
"range": true,
213+
"refId": "router_engine_triggers-avg"
214+
}
215+
],
216+
"title": "Triggers",
217+
"type": "timeseries"
218+
}
219+
],
220+
"preload": false,
221+
"schemaVersion": 41,
222+
"tags": [],
223+
"templating": {
224+
"list": []
225+
},
226+
"time": {
227+
"from": "now-15m",
228+
"to": "now"
229+
},
230+
"timepicker": {},
231+
"timezone": "browser",
232+
"title": "Router Subscriptions",
233+
"uid": "5e145ccc-dbb8-4b2a-84ea-7980021be028",
234+
"version": 6
235+
}

docker/grafana/provisioning/datasources/datasources.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ datasources:
99
jsonData:
1010
httpMethod: POST
1111
manageAlerts: true
12+
- name: Pyroscope
13+
type: grafana-pyroscope-datasource
14+
url: http://pyroscope:4040
15+
readOnly: false
16+
editable: false
17+
jsonData:
18+
httpMethod: POST
19+
manageAlerts: true
1220
- name: ClickHouse
1321
type: grafana-clickhouse-datasource
1422
readOnly: false
@@ -19,4 +27,4 @@ datasources:
1927
host: clickhouse
2028
username: $__env{CLICKHOUSE_USER}
2129
secureJsonData:
22-
password: $__env{CLICKHOUSE_PASSWORD}
30+
password: $__env{CLICKHOUSE_PASSWORD}

router/docs/Profiling.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,13 @@ In addition, we can also see how allocs work by running
9898
You can also run a profile for an amount of time (for example, 5 seconds), by running:
9999
```
100100
go tool pprof ‘http://localhost:6060/debug/pprof/profile?seconds=5’
101-
```
101+
```
102+
103+
## Pyroscope
104+
105+
To use Pyroscope for continuous profiling of the router:
106+
107+
1. Raise the infra-debug stack with `make infra-debug-up`
108+
2. Run the router with either `PYROSCOPE_ADDR=http://localhost:4040` or `-pyroscope-addr http://localhost:4040` to enable sending continuous profiling data to Pyroscope. You can view this data in Grafana.
109+
3. Visit the drilldown profiles section in Grafana at `http://localhost:9300`
110+
4. Select the router from the service dropdown

0 commit comments

Comments
 (0)