Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental Native Histogram #57

Merged
merged 3 commits into from
Nov 28, 2022
Merged

Experimental Native Histogram #57

merged 3 commits into from
Nov 28, 2022

Conversation

codebien
Copy link
Contributor

@codebien codebien commented Nov 16, 2022

It adds an experimental mapping for Trend. It uses the new Prometheus' experimental feature Native Histogram.
A new TrendAsNativeHistogram option has been added for enabling it. If it is not explicitly enabled the Output continues to use the current AsGauges mapping.

It also contains other changes not dedicated to this feature so they will be separated in the next few days with specific PRs:

  • Sort labels
  • Migration to k6.metrics.TrendSink (from the master branch)

Manual testing

The Docker compose has been updated so it can be used for testing. A new xk6 build based on this branch is required.

$ docker compose up -d prometheus grafana
K6_PROMETHEUS_TREND_AS_NATIVE_HISTOGRAM=true ./k6 run -o output-prometheus-remote ./samples/test.js

An example PromQL query for checking the generated data:

histogram_quantile(0.9, rate(k6_http_reqs_duration[1m]))

pkg/remotewrite/trend.go Outdated Show resolved Hide resolved
pkg/remotewrite/remotewrite.go Outdated Show resolved Hide resolved
@codebien
Copy link
Contributor Author

@olegbespalov I have rebased and addressed the request changes

Copy link
Contributor

@olegbespalov olegbespalov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally LGTM 💪

I left a few minor suggestions about the panics. The idea is to make them more transparent for the facing user.

Last but not least. Do you think we should update the README with the info about K6_PROMETHEUS_TREND_AS_NATIVE_HISTOGRAM 🤔

pkg/remotewrite/trend.go Outdated Show resolved Hide resolved
pkg/remotewrite/trend.go Outdated Show resolved Hide resolved
pkg/remotewrite/trend.go Outdated Show resolved Hide resolved
pkg/remotewrite/trend.go Outdated Show resolved Hide resolved
pkg/remotewrite/config.go Outdated Show resolved Hide resolved
pkg/remotewrite/trend_test.go Outdated Show resolved Hide resolved
@codebien codebien force-pushed the nativehistogram branch 2 times, most recently from 664496a to 85a2b50 Compare November 23, 2022 10:29
Copy link
Contributor

@olegbespalov olegbespalov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@codebien codebien force-pushed the nativehistogram branch 2 times, most recently from a0a8edb to b8b5d68 Compare November 24, 2022 17:35
It requires the experimental Native Histogram feature enabled.
goos: linux
goarch: amd64
pkg: github.com/grafana/xk6-output-prometheus-remote/pkg/remotewrite
cpu: AMD Ryzen 7 4800H with Radeon Graphics
BenchmarkK6TrendSinkAdd-16      	92493090	        13.25 ns/op
BenchmarkHistogramSinkAdd-16    	22255527	        57.16 ns/op
PASS
ok  	github.com/grafana/xk6-output-prometheus-remote/pkg/remotewrite	4.167s
@codebien codebien merged commit 667a4a4 into main Nov 28, 2022
@codebien codebien deleted the nativehistogram branch November 28, 2022 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants