forked from sourcegraph/sourcegraph-public-snapshot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrontend.go
260 lines (259 loc) · 12.9 KB
/
frontend.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
package main
func Frontend() *Container {
return &Container{
Name: "frontend",
Title: "Frontend",
Description: "Serves all end-user browser and API requests.",
Groups: []Group{
{
Title: "Search at a glance",
Rows: []Row{
{
{
Name: "99th_percentile_search_request_duration",
Description: "99th percentile successful search request duration over 5m",
Query: `histogram_quantile(0.99, sum by (le)(rate(src_graphql_field_seconds_bucket{type="Search",field="results",error="false",source="browser",name!="CodeIntelSearch"}[5m])))`,
DataMayNotExist: true,
DataMayBeNaN: true, // See https://github.com/sourcegraph/sourcegraph/issues/9834
Warning: Alert{GreaterOrEqual: 20},
PanelOptions: PanelOptions().LegendFormat("duration").Unit(Seconds),
},
{
Name: "90th_percentile_search_request_duration",
Description: "90th percentile successful search request duration over 5m",
Query: `histogram_quantile(0.90, sum by (le)(rate(src_graphql_field_seconds_bucket{type="Search",field="results",error="false",source="browser",name!="CodeIntelSearch"}[5m])))`,
DataMayNotExist: true,
DataMayBeNaN: true, // See https://github.com/sourcegraph/sourcegraph/issues/9834
Warning: Alert{GreaterOrEqual: 15},
PanelOptions: PanelOptions().LegendFormat("duration").Unit(Seconds),
},
},
{
{
Name: "hard_timeout_search_responses",
Description: "hard timeout search responses every 5m",
Query: `sum(sum by (status)(increase(src_graphql_search_response{status="timeout",source="browser",name!="CodeIntelSearch"}[5m]))) + sum(sum by (status, alert_type)(increase(src_graphql_search_response{status="alert",alert_type="timed_out",source="browser",name!="CodeIntelSearch"}[5m])))`,
DataMayNotExist: true,
Warning: Alert{GreaterOrEqual: 5},
Critical: Alert{GreaterOrEqual: 20},
PanelOptions: PanelOptions().LegendFormat("hard timeout"),
},
{
Name: "hard_error_search_responses",
Description: "hard error search responses every 5m",
Query: `sum by (status)(increase(src_graphql_search_response{status=~"error",source="browser",name!="CodeIntelSearch"}[5m]))`,
DataMayNotExist: true,
Warning: Alert{GreaterOrEqual: 5},
Critical: Alert{GreaterOrEqual: 20},
PanelOptions: PanelOptions().LegendFormat("hard error"),
},
{
Name: "partial_timeout_search_responses",
Description: "partial timeout search responses every 5m",
Query: `sum by (status)(increase(src_graphql_search_response{status="partial_timeout",source="browser",name!="CodeIntelSearch"}[5m]))`,
DataMayNotExist: true,
Warning: Alert{GreaterOrEqual: 5},
PanelOptions: PanelOptions().LegendFormat("partial timeout"),
},
{
Name: "search_alert_user_suggestions",
Description: "search alert user suggestions shown every 5m",
Query: `sum by (alert_type)(increase(src_graphql_search_response{status="alert",alert_type!~"timed_out",source="browser",name!="CodeIntelSearch"}[5m]))`,
DataMayNotExist: true,
Warning: Alert{GreaterOrEqual: 50},
PanelOptions: PanelOptions().LegendFormat("{{alert_type}}"),
},
},
},
},
{
Title: "Search-based code intelligence at a glance",
Hidden: true,
Rows: []Row{
{
{
Name: "99th_percentile_search_codeintel_request_duration",
Description: "99th percentile code-intel successful search request duration over 5m",
Query: `histogram_quantile(0.99, sum by (le)(rate(src_graphql_field_seconds_bucket{type="Search",field="results",error="false",source="browser",request_name="CodeIntelSearch"}[5m])))`,
DataMayNotExist: true,
DataMayBeNaN: true, // See https://github.com/sourcegraph/sourcegraph/issues/9834
Warning: Alert{GreaterOrEqual: 20},
PanelOptions: PanelOptions().LegendFormat("duration").Unit(Seconds),
},
{
Name: "90th_percentile_search_codeintel_request_duration",
Description: "90th percentile code-intel successful search request duration over 5m",
Query: `histogram_quantile(0.90, sum by (le)(rate(src_graphql_field_seconds_bucket{type="Search",field="results",error="false",source="browser",request_name="CodeIntelSearch"}[5m])))`,
DataMayNotExist: true,
DataMayBeNaN: true, // See https://github.com/sourcegraph/sourcegraph/issues/9834
Warning: Alert{GreaterOrEqual: 15},
PanelOptions: PanelOptions().LegendFormat("duration").Unit(Seconds),
},
},
{
{
Name: "hard_timeout_search_codeintel_responses",
Description: "hard timeout search code-intel responses every 5m",
Query: `sum(sum by (status)(increase(src_graphql_search_response{status="timeout",source="browser",request_name="CodeIntelSearch"}[5m]))) + sum(sum by (status, alert_type)(increase(src_graphql_search_response{status="alert",alert_type="timed_out",source="browser",request_name="CodeIntelSearch"}[5m])))`,
DataMayNotExist: true,
Warning: Alert{GreaterOrEqual: 5},
Critical: Alert{GreaterOrEqual: 20},
PanelOptions: PanelOptions().LegendFormat("hard timeout"),
},
{
Name: "hard_error_search_codeintel_responses",
Description: "hard error search code-intel responses every 5m",
Query: `sum by (status)(increase(src_graphql_search_response{status=~"error",source="browser",request_name="CodeIntelSearch"}[5m]))`,
DataMayNotExist: true,
Warning: Alert{GreaterOrEqual: 5},
Critical: Alert{GreaterOrEqual: 20},
PanelOptions: PanelOptions().LegendFormat("hard error"),
},
{
Name: "partial_timeout_search_codeintel_responses",
Description: "partial timeout search code-intel responses every 5m",
Query: `sum by (status)(increase(src_graphql_search_response{status="partial_timeout",source="browser",request_name="CodeIntelSearch"}[5m]))`,
DataMayNotExist: true,
Warning: Alert{GreaterOrEqual: 5},
PanelOptions: PanelOptions().LegendFormat("partial timeout"),
},
{
Name: "search_codeintel_alert_user_suggestions",
Description: "search code-intel alert user suggestions shown every 5m",
Query: `sum by (alert_type)(increase(src_graphql_search_response{status="alert",alert_type!~"timed_out",source="browser",request_name="CodeIntelSearch"}[5m]))`,
DataMayNotExist: true,
Warning: Alert{GreaterOrEqual: 50},
PanelOptions: PanelOptions().LegendFormat("{{alert_type}}"),
},
},
},
},
{
Title: "Search API usage at a glance",
Hidden: true,
Rows: []Row{
{
{
Name: "99th_percentile_search_api_request_duration",
Description: "99th percentile successful search API request duration over 5m",
Query: `histogram_quantile(0.99, sum by (le)(rate(src_graphql_field_seconds_bucket{type="Search",field="results",error="false",source="other"}[5m])))`,
DataMayNotExist: true,
DataMayBeNaN: true, // See https://github.com/sourcegraph/sourcegraph/issues/9834
Warning: Alert{GreaterOrEqual: 50},
PanelOptions: PanelOptions().LegendFormat("duration").Unit(Seconds),
},
{
Name: "90th_percentile_search_api_request_duration",
Description: "90th percentile successful search API request duration over 5m",
Query: `histogram_quantile(0.90, sum by (le)(rate(src_graphql_field_seconds_bucket{type="Search",field="results",error="false",source="other"}[5m])))`,
DataMayNotExist: true,
DataMayBeNaN: true, // See https://github.com/sourcegraph/sourcegraph/issues/9834
Warning: Alert{GreaterOrEqual: 40},
PanelOptions: PanelOptions().LegendFormat("duration").Unit(Seconds),
},
},
{
{
Name: "hard_timeout_search_api_responses",
Description: "hard timeout search API responses every 5m",
Query: `sum(sum by (status)(increase(src_graphql_search_response{status="timeout",source="other"}[5m]))) + sum(sum by (status, alert_type)(increase(src_graphql_search_response{status="alert",alert_type="timed_out",source="other"}[5m])))`,
DataMayNotExist: true,
Warning: Alert{GreaterOrEqual: 5},
Critical: Alert{GreaterOrEqual: 20},
PanelOptions: PanelOptions().LegendFormat("hard timeout"),
},
{
Name: "hard_error_search_api_responses",
Description: "hard error search API responses every 5m",
Query: `sum by (status)(increase(src_graphql_search_response{status=~"error",source="other"}[5m]))`,
DataMayNotExist: true,
Warning: Alert{GreaterOrEqual: 5},
Critical: Alert{GreaterOrEqual: 20},
PanelOptions: PanelOptions().LegendFormat("hard error"),
},
{
Name: "partial_timeout_search_api_responses",
Description: "partial timeout search API responses every 5m",
Query: `sum by (status)(increase(src_graphql_search_response{status="partial_timeout",source="other"}[5m]))`,
DataMayNotExist: true,
Warning: Alert{GreaterOrEqual: 5},
PanelOptions: PanelOptions().LegendFormat("partial timeout"),
},
{
Name: "search_api_alert_user_suggestions",
Description: "search API alert user suggestions shown every 5m",
Query: `sum by (alert_type)(increase(src_graphql_search_response{status="alert",alert_type!~"timed_out",source="other"}[5m]))`,
DataMayNotExist: true,
Warning: Alert{GreaterOrEqual: 50},
PanelOptions: PanelOptions().LegendFormat("{{alert_type}}"),
},
},
},
},
{
Title: "Internal service requests",
Hidden: true,
Rows: []Row{
{
{
Name: "internal_indexed_search_error_responses",
Description: "internal indexed search error responses every 5m",
Query: `sum by (code)(increase(src_zoekt_request_duration_seconds_count{code!~"2.."}[5m]))`,
DataMayNotExist: true,
Warning: Alert{GreaterOrEqual: 5},
PanelOptions: PanelOptions().LegendFormat("{{code}}"),
},
{
Name: "internal_unindexed_search_error_responses",
Description: "internal unindexed search error responses every 5m",
Query: `sum by (code)(increase(searcher_service_request_total{code!~"2.."}[5m]))`,
DataMayNotExist: true,
Warning: Alert{GreaterOrEqual: 5},
PanelOptions: PanelOptions().LegendFormat("{{code}}"),
},
{
Name: "internal_api_error_responses",
Description: "internal API error responses every 5m by route",
Query: `sum by (category)(increase(src_frontend_internal_request_duration_seconds_count{code!~"2.."}[5m]))`,
DataMayNotExist: true,
Warning: Alert{GreaterOrEqual: 25},
PanelOptions: PanelOptions().LegendFormat("{{category}}"),
},
},
},
},
{
Title: "Container monitoring (not available on k8s or server)",
Hidden: true,
Rows: []Row{
{
{
Name: "container_restarts",
Description: "container restarts every 5m by instance (not available on k8s or server)",
Query: `increase(cadvisor_container_restart_count{name=~".*frontend.*"}[5m])`,
DataMayNotExist: true,
Warning: Alert{GreaterOrEqual: 1},
PanelOptions: PanelOptions().LegendFormat("{{name}}"),
},
{
Name: "container_memory_usage",
Description: "container memory usage by instance (not available on k8s or server)",
Query: `cadvisor_container_memory_usage_percentage_total{name=~".*frontend.*"}`,
DataMayNotExist: true,
Warning: Alert{GreaterOrEqual: 90},
PanelOptions: PanelOptions().LegendFormat("{{name}}").Unit(Percentage),
},
{
Name: "container_cpu_usage",
Description: "container cpu usage total (5m average) across all cores by instance (not available on k8s or server)",
Query: `cadvisor_container_cpu_usage_percentage_total{name=~".*frontend.*"}`,
DataMayNotExist: true,
Warning: Alert{GreaterOrEqual: 90},
PanelOptions: PanelOptions().LegendFormat("{{name}}").Unit(Percentage),
},
},
},
},
},
}
}