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

Fix code comment #2785

Merged
merged 1 commit into from Nov 30, 2022
Merged

Fix code comment #2785

merged 1 commit into from Nov 30, 2022

Conversation

codebien
Copy link
Collaborator

@codebien codebien commented Nov 29, 2022

Add the Sum stat into the resolvers map. It is helpful for reusing the same function from the Remote Write output. grafana/xk6-output-prometheus-remote#64

Just fix a comment

metrics/value_type.go Outdated Show resolved Hide resolved
Copy link
Member

@na-- na-- left a comment

Choose a reason for hiding this comment

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

Hmm 🤔 if I am reading this correctly:

k6/cmd/options.go

Lines 191 to 200 in 616e5e2

if flags.Changed("summary-trend-stats") {
trendStats, errSts := flags.GetStringSlice("summary-trend-stats")
if errSts != nil {
return opts, errSts
}
if _, errSts = metrics.GetResolversForTrendColumns(trendStats); err != nil {
return opts, errSts
}
opts.SummaryTrendStats = trendStats
}

Then changing this function will also allow users to specify k6 run --summary-trend-stats min,med,max,sum, which is not something we want, right? 🤔

Why do you need this change?

@codebien
Copy link
Collaborator Author

codebien commented Nov 29, 2022

which is not something we want, right?

@na-- I thought we were fine adding it, it isn't included in the default values but it allows users to generate that stat if needed.

Why do you need this change?

The Prometheus Output has the option for exporting the sum stat, so it would be helpful to reuse the same function to have it supported from the k6's resolver. The k6 function is useful because it has the validation / parsing already implemented for the percentile. If it is possible then I would avoid to clone the same logic in the Output.

@na--
Copy link
Member

na-- commented Nov 29, 2022

I am not sure how the sum of a Trend's values would be useful in any way for the end-of-test summary? Maybe it could be of use in some weird handleSummary() use case? 🤔 Even so, AFAIK, nobody has requested something like this so far.

Also, the sum is easy to get with our current TrendSink implementation, since it doesn't require any calculation - we update it on every value add() call. However, if we adopt HDR histograms (#763), calculating the sum would require some computation and even so, it will be just an approximation.

So, given the dubious value to users and the potential complication for HDR histograms, I think copying some code to the extension (with a TODO) would be preferable to hastily updating the values in this k6 function.

@codebien
Copy link
Collaborator Author

Ok, then I think I can do something hacky for excluding the sum from the validation and still reuse the k6 function. Thanks for your opinion 🙇

@codebien codebien closed this Nov 29, 2022
@na--
Copy link
Member

na-- commented Nov 29, 2022

The fix to the metrics.Time comments were good though 😅

@na-- na-- reopened this Nov 29, 2022
Co-authored-by: na-- <n@andreev.sh>
@na-- na-- changed the title Sum stat resolver Fix code comment Nov 30, 2022
@codebien codebien merged commit 564197a into master Nov 30, 2022
@codebien codebien deleted the sum-trend-stat-resolver branch November 30, 2022 15:29
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

3 participants