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

Avoid logging and connection backoff in the case of a canceled context #4428

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

teyyubismayil
Copy link
Contributor

@teyyubismayil teyyubismayil commented Dec 9, 2024

Avoid logging and connection backoff in the case of a canceled context on the gRPC stream in querier.

What this PR does:
Currently in case of context cancel a lot of unnecessary error logs are produced. Also this pr will potentially improve performance as backoff won't be awaited on context cancel.

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@CLAassistant
Copy link

CLAassistant commented Dec 9, 2024

CLA assistant check
All committers have signed the CLA.

@joe-elliott
Copy link
Member

Thanks for the PR! Can you talk about what this is trying to solve? What situations have you seen that are problematic and how does this PR help them?

@teyyubismayil
Copy link
Contributor Author

teyyubismayil commented Dec 9, 2024

@joe-elliott When querier is overloaded and query frontend cancels query I observe a lot of error contacting frontend, received context error while waiting for new LB policy update: context canceled error logs which I assume is not needed. Also I think awaiting backoff is also unnecessary here. Similar conditional exists a few lines after.

@joe-elliott
Copy link
Member

So the first error here occurs when there is an issue connecting:

https://github.com/grafana/tempo/blob/main/modules/querier/worker/frontend_processor.go#L74-L79

I think we'd prefer to have backoff here b/c it signals an unreachable or struggling frontend. In this case we'd like queriers to backoff so they don't overwhelm the frontend when it becomes reachable again.

The second part:

https://github.com/grafana/tempo/blob/main/modules/querier/worker/frontend_processor.go#L74-L79

Has special handling for context cancelled b/c this is how the frontend signals that a job is cancelled and tells the querier to stop processing. It's not a great system and I hope to fix it one day.

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