Prepare k6 to export metrics #120

Merged
fyrchik merged 1 commit from dstepanov-yadro/xk6-frostfs:feat/metrics into master 2024-09-04 19:51:18 +00:00

Relates #119

  1. Allow to set instance label for metrics. This can be useful in case of metrics export. This label will be used only with custom metrics.

  2. *_total metrics renamed to *_success where it corresponds to the meaning of these metrics.

  3. Added *_bytes metrics, because k6 doesn't export builtin metrics (data sent/data received) to prometheus.

To send metrics to prometheus:

K6_PROMETHEUS_RW_SERVER_URL=http://prometheus.host:8888/api/v1/write \ <-- prometheus remote write URL
K6_PROMETHEUS_RW_TREND_STATS="p(95),p(99),min,max" \ <-- percentiles for duration metrics
./k6 run ... -e METRIC_TAGS=instance:value -o experimental-prometheus-rw scenario.js

Relates #119 1. Allow to set `instance` label for metrics. This can be useful in case of metrics export. This label will be used only with custom metrics. 2. `*_total` metrics renamed to `*_success` where it corresponds to the meaning of these metrics. 3. Added `*_bytes` metrics, because k6 doesn't export builtin metrics (data sent/data received) to prometheus. To send metrics to prometheus: ``` K6_PROMETHEUS_RW_SERVER_URL=http://prometheus.host:8888/api/v1/write \ <-- prometheus remote write URL K6_PROMETHEUS_RW_TREND_STATS="p(95),p(99),min,max" \ <-- percentiles for duration metrics ./k6 run ... -e METRIC_TAGS=instance:value -o experimental-prometheus-rw scenario.js ```
dstepanov-yadro reviewed 2024-01-24 10:08:39 +00:00
@ -10,0 +26,4 @@
}
func (m *RootModule) SetInstance(inst string) {
tagSet = Registry.RootTagSet().With("instance", inst)
Author
Member

tagSet must be inherited from registry, otherwise k6 panics on export.

`tagSet` must be inherited from registry, otherwise k6 panics on export.
dstepanov-yadro force-pushed feat/metrics from 6af368726a to ac02d5211a 2024-01-24 10:10:26 +00:00 Compare
dstepanov-yadro changed title from WIP: Allow to specify instance tag for custome metrics to Prepare k6 to export metrics 2024-01-24 10:52:46 +00:00
dstepanov-yadro requested review from storage-core-committers 2024-01-24 10:52:53 +00:00
dstepanov-yadro requested review from storage-core-developers 2024-01-24 10:52:56 +00:00
fyrchik requested review from mmalygina 2024-01-24 11:09:31 +00:00
fyrchik requested review from abereziny 2024-01-24 11:09:31 +00:00
Owner

@abereziny @mmalygina Please, check metrics renaming -- they could be used somewhere in summary parsing, for example.

@abereziny @mmalygina Please, check metrics renaming -- they could be used somewhere in summary parsing, for example.
aarifullin approved these changes 2024-01-24 13:59:40 +00:00
dstepanov-yadro force-pushed feat/metrics from ac02d5211a to 060f949a3e 2024-01-25 07:00:25 +00:00 Compare
fyrchik approved these changes 2024-01-25 12:18:36 +00:00
@ -146,3 +149,3 @@
onDataChunk func(chunk []byte),
) error {
var buf = make([]byte, 4*1024)
buf := make([]byte, 4*1024)
Owner

Unrelated to commit

Unrelated to commit
Author
Member

fixed

fixed
fyrchik marked this conversation as resolved
@ -10,0 +25,4 @@
modules.Register("k6/x/frostfs/stats", &RootModule{})
}
func (m *RootModule) SetInstance(inst string) {
Owner

It could also be beneficial to attach other tags, like doing 7 loads in a row, each with its own tag.
Why did you go with SetInstance and not AddTag, for example?

It could also be beneficial to attach other tags, like doing 7 loads in a row, each with its own tag. Why did you go with `SetInstance` and not `AddTag`, for example?
Author
Member

fixed

Example:
-e METRIC_TAGS="instance:dstepanov;run:1"

fixed Example: `-e METRIC_TAGS="instance:dstepanov;run:1"`
fyrchik marked this conversation as resolved
aarifullin approved these changes 2024-01-25 15:32:55 +00:00
dstepanov-yadro force-pushed feat/metrics from 060f949a3e to 1422422a23 2024-01-26 07:32:23 +00:00 Compare
dstepanov-yadro force-pushed feat/metrics from 1422422a23 to 73409c6f81 2024-01-26 07:38:19 +00:00 Compare
dstepanov-yadro force-pushed feat/metrics from 73409c6f81 to 965dcdcbe7 2024-01-26 07:39:39 +00:00 Compare
abereziny approved these changes 2024-01-26 12:19:28 +00:00
acid-ant approved these changes 2024-01-29 06:05:20 +00:00
fyrchik merged commit 965dcdcbe7 into master 2024-01-29 13:29:55 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
5 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/xk6-frostfs#120
No description provided.