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: Make pull query metrics apply only to pull and not also push #6944

Merged

Conversation

AlanConfluent
Copy link
Member

Description

This changes pull query metrics to be reported only for pull queries, and not push, since both use the /query endpoint.

Testing done

Ran tests and manually verified.

Reviewer checklist

  • Ensure docs are updated if necessary. (eg. if a user visible feature is being added or changed).
  • Ensure relevant issues are linked (description should include text like "Fixes #")

@AlanConfluent AlanConfluent requested a review from a team as a code owner February 3, 2021 21:08
Copy link
Contributor

@agavra agavra left a comment

Choose a reason for hiding this comment

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

LGTM, though is it possible to add automated tests to make sure this doesnt' regress in a future refactor?

* arbitrarily, e.g. /query is used for both push and pull queries so we let the resource
* determine how to report the metrics.
*/
public interface MetricsCallback {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: since this is used in the old and the new endpoints can we pull it out into its own class? (same for the impl below)

Copy link
Member Author

Choose a reason for hiding this comment

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

It wasn't used in the new endpoint when I wrote this. I moved them out and now call it from the new endpoint stream-query as well. I still don't call it from /ws/query because it's a bit harder to do it in these scenarios, though we report latency and basic count from there.

@AlanConfluent AlanConfluent force-pushed the fix_metrics_only_pull branch 2 times, most recently from 9a6ad17 to 84c0aab Compare March 10, 2021 22:59
@AlanConfluent AlanConfluent force-pushed the fix_metrics_only_pull branch from 84c0aab to d939ca6 Compare March 11, 2021 00:22
@AlanConfluent AlanConfluent merged commit 1db18b3 into confluentinc:master Mar 11, 2021
Copy link
Contributor

@guozhangwang guozhangwang left a comment

Choose a reason for hiding this comment

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

@AlanConfluent for my understanding: which class/line is the actual fix -- it seems to be hidden somewhere with this refactoring change that I'm missing..

if (throwable == null) {
pullQueryMetrics.ifPresent(p -> p.recordLatency(startTimeNanos));
}
pullQueryMetrics.ifPresent(p -> p.recordLatency(startTimeNanos));
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems changing the behavior that even if the result contains an error, we would still record latency. Is it intentional?

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.

3 participants