8000 tail plugin, latency: Fix regressions after #2535 by rpv-tomsk · Pull Request #2611 · collectd/collectd · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

tail plugin, latency: Fix regressions after #2535 #2611

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

Merged
merged 1 commit into from
Dec 14, 2017

Conversation

rpv-tomsk
Copy link
Contributor
@rpv-tomsk rpv-tomsk commented Dec 10, 2017

As reported in #2587, the f46d76e causes regression.

  1. It adds two fixed decimal places into type instance of reported percentiles.

Before:

# perl -e 'print sprintf("%.0f\n", 10.05);'
10

After:

# perl -e 'print sprintf("%.2f\n", 10.00);'
10.00

Also, the difference in format of percentile appeared after f46d76e : the '%.0f' was in use when no type instance is configured, and '%.2f' - when type instance is set.

This was fixed by setting format to '%.4g' for all cases.
I think it's enough to use '%.4g' to output percentile values which are in range from 0 to 100.

  1. It reduces accuracy of bounds in reported buckets.

Before:

# perl -e 'print sprintf("%g\n", 10.05);'
10.05

After:

# perl -e 'print sprintf("%.2g\n", 100);'
1e+02
# perl -e 'print sprintf("%.2g\n", 10.05);'
10

This was fixed by reverting format back to '%g' as it was before f46d76e.

Summary:

  • Removed two fixed decimal places from type instance of percentiles
  • Recovered accuracy of bounds in type instance of buckets
  • Changed maximum length of reported type and type instance to 50 chars in all latency metrics

References: #2535, #2587

Have anybody any objections against merging this?

CC @taraschornyi, @mfournier, @PhantomPhreak

@collectd-bot collectd-bot added this to the 5.8 milestone Dec 10, 2017
@rpv-tomsk rpv-tomsk added the Bug A genuine bug label Dec 10, 2017
@@ -118,10 +118,10 @@ static int latency_submit_match(cu_match_t *match, void *user_data) {
sstrncpy(vl.type, data->type, sizeof(vl.type));
for (size_t i = 0; i < data->latency_config.percentile_num; i++) {
if (strlen(data->type_instance) != 0)
snprintf(vl.type_instance, sizeof(vl.type_instance), "%.117s-%.2f",
snprintf(vl.type_instance, sizeof(vl.type_instance), "%.50s-%.4g",
Copy link
Member

Choose a reason for hiding this comment

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

This format was originally "%s-%.0f". Can we go back to using %.0f again?

Copy link
Contributor Author
@rpv-tomsk rpv-tomsk Dec 12, 2017

Choose a reason for hiding this comment

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

As stated before, that is done to allow to report percentiles with fractional values.

# perl -e 'use POSIX; printf("%.0f\n", 99.5);'
100
# perl -e 'use POSIX; printf("%.4g\n", 99.5);'
99.5
# perl -e 'use POSIX; printf("%.4g\n", 99);'
99

Configuration allows to set fractional percentile values, so I think we need to allow report them correctly.
If you want, we can split this change - set %.0f in 5.8 and %.4g in master. Or we can just set to %.0f. What would be preferred?

Copy link
Member

Choose a reason for hiding this comment

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

The docs don't say that fractional percentiles are forbidden, so it makes sense to support them. Put the %g variant into 5.8.

Maybe we can increase the precision to %.5g though – somebody is going to want to track five nines … ;)

 - Remove two fixed decimal places from type instance of percentiles
 - Recover accuracy of bounds in type instance of buckets
 + Allow (compared to state before collectd#2535) to report percentiles with fractional values
 * Changed maximum length of reported type and type instance to 50 chars

References: collectd#2535
Closes: collectd#2587
@rpv-tomsk rpv-tomsk added the Automerge Labels PRs to be merged by a bot once approved label Dec 14, 2017
@collectd-bot collectd-bot merged commit b5e2928 into collectd:collectd-5.8 Dec 14, 2017
@rpv-tomsk rpv-tomsk deleted the fix-2587 branch October 31, 2018 17:04
@rpv-tomsk rpv-tomsk restored the fix-2587 branch October 31, 2018 17:05
@rpv-tomsk rpv-tomsk deleted the fix-2587 branch October 31, 2018 19:14
@octo octo added Fix A pull request fixing a bug and removed Bug A genuine bug labels Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Automerge Labels PRs to be merged by a bot once approved Fix A pull request fixing a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0