Skip to content

Commit a16ecdf

Browse files
Replace average collector with summary collector
Update metrics version to 0.5.0. Replace average latency collector with summary collector in example cluster. Example cluster metrics no more breaks Prometheus metrics collect (closes #13). Replace average latency panels with summary 99th percentile panels (closes #29).
1 parent e13b9d6 commit a16ecdf

File tree

6 files changed

+71
-21
lines changed

6 files changed

+71
-21
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## Unreleased
88

9+
## Changed
10+
- Update metrics version to 0.5.0
11+
- Replace average latency collector with summary collector in example cluster
12+
- Replace average latency panels with summary 99th percentile panels
13+
914
## Fixed
1015
- Example cluster now starts successfully
16+
- Example cluster metrics no more breaks Prometheus metrics collect
1117

1218
## [0.1.1] - 2020-09-04
1319
Grafana revisions: [InfluxDB revision 2](https://grafana.com/api/dashboards/12567/revisions/2/download)

example/project/app/roles/custom.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
local cartridge = require('cartridge')
22
local config = require('cartridge.argparse')
3+
local fiber = require('fiber')
34

45
local function init(opts) -- luacheck: no unused args
56
local local_cfg = config.get_opts({
@@ -10,13 +11,14 @@ local function init(opts) -- luacheck: no unused args
1011
local metrics = cartridge.service_get('metrics')
1112
local http_middleware = metrics.http_middleware
1213

13-
local http_collector = http_middleware.build_default_collector('average')
14+
local http_collector = http_middleware.build_default_collector('summary')
1415

1516
local httpd = cartridge.service_get('httpd')
1617
httpd:route(
1718
{ method = 'GET', path = '/hello' },
1819
http_middleware.v1(
1920
function()
21+
fiber.sleep(0.02)
2022
return { status = 200, body = 'Hello world!' }
2123
end,
2224
http_collector
@@ -26,6 +28,7 @@ local function init(opts) -- luacheck: no unused args
2628
{ method = 'GET', path = '/hell0' },
2729
http_middleware.v1(
2830
function()
31+
fiber.sleep(0.01)
2932
return { status = 400, body = 'Hell0 world!' }
3033
end,
3134
http_collector
@@ -35,6 +38,7 @@ local function init(opts) -- luacheck: no unused args
3538
{ method = 'POST', path = '/goodbye' },
3639
http_middleware.v1(
3740
function()
41+
fiber.sleep(0.005)
3842
return { status = 500, body = 'Goodbye cruel world!' }
3943
end,
4044
http_collector

example/project/project-scm-1.rockspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dependencies = {
1010
'checks == 3.0.1-1',
1111
'http == 1.1.0-1',
1212
'cartridge == 2.1.2-1',
13-
'metrics ~> 0.3'
13+
'metrics == 0.5.0-1'
1414
}
1515
build = {
1616
type = 'none';

example/telegraf/telegraf.conf

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@
77
"http://example_project:8085/metrics"
88
]
99
timeout = "30s"
10-
tag_keys = ["metric_name", "label_pairs_alias", "label_pairs_path", "label_pairs_method", "label_pairs_status", "label_pairs_operation"]
10+
tag_keys = [
11+
"metric_name",
12+
"label_pairs_alias",
13+
"label_pairs_quantile",
14+
"label_pairs_path",
15+
"label_pairs_method",
16+
"label_pairs_status",
17+
"label_pairs_operation"
18+
]
1119
insecure_skip_verify = true
1220
interval = "10s"
1321
data_format = "json"

tarantool/http.libsonnet

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,16 @@ local influxdb = grafana.influxdb;
110110
policy,
111111
measurement,
112112
metric_name,
113+
quantile,
114+
label,
113115
status_regex,
114116
) = graph.new(
115117
title=title,
116118
description=description,
117119
datasource=datasource,
118120

119121
format='s',
120-
labelY1='average',
122+
labelY1=label,
121123
fill=0,
122124
decimals=3,
123125
decimalsY1=2,
@@ -135,67 +137,79 @@ local influxdb = grafana.influxdb;
135137
measurement=measurement,
136138
group_tags=['label_pairs_alias', 'label_pairs_path', 'label_pairs_method', 'label_pairs_status'],
137139
alias='$tag_label_pairs_alias — $tag_label_pairs_method $tag_label_pairs_path (code $tag_label_pairs_status)',
138-
).where('metric_name', '=', metric_name).where('label_pairs_status', '=~', status_regex)
139-
.selectField('value').addConverter('mean')
140+
).where('metric_name', '=', metric_name).where('label_pairs_quantile', '=', quantile)
141+
.where('label_pairs_status', '=~', status_regex).selectField('value').addConverter('mean')
140142
),
141143

142144
latency_success(
143145
title='Success requests latency (code 2xx)',
144146
description=|||
145-
Latency of requests, processed with success (code 2xx) on Tarantool's side.
147+
99th percentile of requests latency. Includes only requests processed with success (code 2xx) on Tarantool's side.
146148
|||,
147149

148150
datasource=null,
149151
policy=null,
150152
measurement=null,
151-
metric_name='http_server_request_latency_avg',
153+
metric_name='http_server_request_latency',
154+
quantile='0.99',
155+
label='99th percentile',
152156
):: latency_graph(
153157
title=title,
154158
description=description,
155159
datasource=datasource,
156160
policy=policy,
157161
measurement=measurement,
158162
metric_name=metric_name,
163+
quantile=quantile,
164+
label=label,
159165
status_regex='/^2\\d{2}$/',
160166
),
161167

162168
latency_error_4xx(
163169
title='Error requests latency (code 4xx)',
164170
description=|||
165-
Latency of requests, processed with 4xx error on Tarantool's side.
171+
99th percentile of requests latency. Includes only requests processed with 4xx error on Tarantool's side.
166172
|||,
167173

168174
datasource=null,
169175
policy=null,
170176
measurement=null,
171-
metric_name='http_server_request_latency_avg',
177+
metric_name='http_server_request_latency',
178+
quantile='0.99',
179+
label='99th percentile',
172180
):: latency_graph(
173181
title=title,
174182
description=description,
175183
datasource=datasource,
176184
policy=policy,
177185
measurement=measurement,
178186
metric_name=metric_name,
187+
quantile=quantile,
188+
label=label,
179189
status_regex='/^4\\d{2}$/',
180190
),
181191

182192
latency_error_5xx(
183193
title='Error requests latency (code 5xx)',
184194
description=|||
185-
Latency of requests, processed with 5xx error on Tarantool's side.
195+
99th percentile of requests latency. Includes only requests processed with 5xx error on Tarantool's side.
186196
|||,
187197

188198
datasource=null,
189199
policy=null,
190200
measurement=null,
191-
metric_name='http_server_request_latency_avg',
201+
metric_name='http_server_request_latency',
202+
quantile='0.99',
203+
label='99th percentile',
192204
):: latency_graph(
193205
title=title,
194206
description=description,
195207
datasource=datasource,
196208
policy=policy,
197209
measurement=measurement,
198210
metric_name=metric_name,
211+
quantile=quantile,
212+
label=label,
199213
status_regex='/^5\\d{2}$/',
200214
),
201215
}

tests/InfluxDB/dashboard_compiled.json

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@
568568
"dashes": false,
569569
"datasource": "${DS_INFLUXDB}",
570570
"decimals": 3,
571-
"description": "Latency of requests, processed with success (code 2xx) on Tarantool's side.\n",
571+
"description": "99th percentile of requests latency. Includes only requests processed with success (code 2xx) on Tarantool's side.\n",
572572
"fill": 0,
573573
"gridPos": {
574574
"h": 8,
@@ -667,7 +667,13 @@
667667
{
668668
"key": "metric_name",
669669
"operator": "=",
670-
"value": "http_server_request_latency_avg"
670+
"value": "http_server_request_latency"
671+
},
672+
{
673+
"condition": "AND",
674+
"key": "label_pairs_quantile",
675+
"operator": "=",
676+
"value": "0.99"
671677
},
672678
{
673679
"condition": "AND",
@@ -699,7 +705,7 @@
699705
{
700706
"decimals": 2,
701707
"format": "s",
702-
"label": "average",
708+
"label": "99th percentile",
703709
"logBase": 1,
704710
"max": null,
705711
"min": null,
@@ -723,7 +729,7 @@
723729
"dashes": false,
724730
"datasource": "${DS_INFLUXDB}",
725731
"decimals": 3,
726-
"description": "Latency of requests, processed with 4xx error on Tarantool's side.\n",
732+
"description": "99th percentile of requests latency. Includes only requests processed with 4xx error on Tarantool's side.\n",
727733
"fill": 0,
728734
"gridPos": {
729735
"h": 8,
@@ -822,7 +828,13 @@
822828
{
823829
"key": "metric_name",
824830
"operator": "=",
825-
"value": "http_server_request_latency_avg"
831+
"value": "http_server_request_latency"
832+
},
833+
{
834+
"condition": "AND",
835+
"key": "label_pairs_quantile",
836+
"operator": "=",
837+
"value": "0.99"
826838
},
827839
{
828840
"condition": "AND",
@@ -854,7 +866,7 @@
854866
{
855867
"decimals": 2,
856868
"format": "s",
857-
"label": "average",
869+
"label": "99th percentile",
858870
"logBase": 1,
859871
"max": null,
860872
"min": null,
@@ -878,7 +890,7 @@
878890
"dashes": false,
879891
"datasource": "${DS_INFLUXDB}",
880892
"decimals": 3,
881-
"description": "Latency of requests, processed with 5xx error on Tarantool's side.\n",
893+
"description": "99th percentile of requests latency. Includes only requests processed with 5xx error on Tarantool's side.\n",
882894
"fill": 0,
883895
"gridPos": {
884896
"h": 8,
@@ -977,7 +989,13 @@
977989
{
978990
"key": "metric_name",
979991
"operator": "=",
980-
"value": "http_server_request_latency_avg"
992+
"value": "http_server_request_latency"
993+
},
994+
{
995+
"condition": "AND",
996+
"key": "label_pairs_quantile",
997+
"operator": "=",
998+
"value": "0.99"
981999
},
9821000
{
9831001
"condition": "AND",
@@ -1009,7 +1027,7 @@
10091027
{
10101028
"decimals": 2,
10111029
"format": "s",
1012-
"label": "average",
1030+
"label": "99th percentile",
10131031
"logBase": 1,
10141032
"max": null,
10151033
"min": null,

0 commit comments

Comments
 (0)