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

prometheus: revert the condition for enabling aggregation #2232

Closed
wants to merge 1 commit into from

Conversation

tchaikov
Copy link
Contributor

@tchaikov tchaikov commented May 9, 2024

in d7e16bb, we added the query time configuration for disabling aggregation, but the condition for disabling aggregation was wrong. before that change, we always enable the aggregation, but after that change, the aggregation is disabled when the value of query parameter of "aggregate" is not "false". in other words,

  • if this query parameter is not set, the aggregation is disabled. this changes the existing behavior.
  • if this query parameter's value is "false", the aggregation is enabeld. this is not the expected behavior.

so, in this change

  • change the parameter from disable_aggregation to enable_aggregation. as the positive condition is always easier to understand.
  • and update the handling accodingly.

Fixes d7e16bb
Signed-off-by: Kefu Chai kefu.chai@scylladb.com

in d7e16bb, we added the query time configuration for disabling
aggregation, but the condition for disabling aggregation was wrong.
before that change, we always enable the aggregation, but after that
change, the aggregation is disabled when the value of query parameter
of "__aggregate__" is not "false". in other words,

- if this query parameter is not set, the aggregation is disabled. this
  changes the existing behavior.
- if this query parameter's value is "false", the aggregation is
  enabeld. this is not the expected behavior.

so, in this change

- change the parameter from `disable_aggregation` to
  `enable_aggregation`. as the positive condition is
  always easier to understand.
- and update the handling accodingly.

Fixes d7e16bb
Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
@tchaikov tchaikov requested a review from amnonh May 9, 2024 08:03
@tchaikov
Copy link
Contributor Author

tchaikov commented May 9, 2024

@scylladb/seastar-maint could you help review this change? it addresses a regression. and is required for scylladb/scylladb#18554
and unblocking tablet testing based on scylladb/scylla-ccm#574.

@tchaikov
Copy link
Contributor Author

tchaikov commented May 9, 2024

cc @bhalevy

@tchaikov
Copy link
Contributor Author

tchaikov commented May 9, 2024

with this change, scylladb master is able to pass topology_experimental_raft/test_tablets.

@tchaikov
Copy link
Contributor Author

tchaikov commented May 9, 2024

cc @nvartolomei

@nyh
Copy link
Contributor

nyh commented May 9, 2024

in d7e16bb, we added the query time configuration for disabling aggregation, but the condition for disabling aggregation was wrong. before that change, we always enable the aggregation, but after that change, the aggregation is disabled when the value of query parameter of "aggregate" is not "false". in other words,

* if this query parameter is not set, the aggregation is disabled. this changes the existing behavior.

* if this query parameter's value is "false", the aggregation is enabeld. this is not the expected behavior.

These last two things don't look like "in other words" of the statement before them, but rather a failure to implement what the previous statement said.

so, in this change

* change the parameter from `disable_aggregation` to `enable_aggregation`. as the positive condition is always easier to understand.

You are overloading the word "parameter". The user-visible parameter remains with the name "aggregate", no change to that. You are just changing the name of some variable in the code, to make it easier for you to understand.

I'll take a look at the actual change now :-)

Also, you have in the commit message a "Fixes" line which refers to a commit hash, not to an issue. Please remove that line or fix it.

@nyh
Copy link
Contributor

nyh commented May 9, 2024

These last two things don't look like "in other words" of the statement before them, but rather a failure to implement what the previous statement said.

I just now realized that the previous statement had a wrong "not" in the statement, so indeed the following statements are equivalent to that first wrong statement. This is a very confusing way to describe the bug. But I think I finally understood.

@@ -896,16 +896,16 @@ class metrics_handler : public httpd::handler_base {
sstring metric_family_name = req->get_query_param("__name__");
bool prefix = trim_asterisk(metric_family_name);
bool show_help = req->get_query_param("__help__") != "false";
bool disable_aggregation = req->get_query_param("__aggregate__") != "false";
bool enable_aggregation = req->get_query_param("__aggregate__") != "false";
Copy link
Contributor

Choose a reason for hiding this comment

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

Please note that you could have fixed this bug by a one-line change - changing != to ==, and that's it. The renaming (and flipping) the variable wasn't necessary. But I agree it looks better.

Copy link
Contributor Author

@tchaikov tchaikov May 9, 2024

Choose a reason for hiding this comment

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

i knew. but i was not after a single-liner fix.

@nyh nyh closed this in 42f15a5 May 9, 2024
@tchaikov tchaikov deleted the prometheus-aggregate branch May 9, 2024 09:57
@nvartolomei
Copy link
Contributor

🤦‍♂️ sorry for the bad PR. Appreciate the fix!

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