-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Querier: block query by hash #8953
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
Querier: block query by hash #8953
Conversation
Signed-off-by: Danny Kopping <danny.kopping@grafana.com>
291c977
to
ff838e2
Compare
Signed-off-by: Danny Kopping <danny.kopping@grafana.com>
The query hash changes when the order of the labels in the matcher changes, right? At some point we should hash the AST of the query so that logically ident queries have the same hash. |
Signed-off-by: Danny Kopping <danny.kopping@grafana.com>
Yes, it's a hash of the query string - the contents of the string are not considered at all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[docs team] LGTM.
Just one question, how would a tenant know if their query had been blocked? I'm guessing that not every user will have access to the logs, some users might run a query in the UI and have no idea why it did not complete?
They will currently get a simple error stating "query blocked by policy". They'll then likely make contact with support to ask why this is happening. We have to be a bit circumspect sometimes because a bad actor might be trying to disrupt the service, and we don't want to give away too much - but on the other hand we want to be user-friendly for the majority of folks who will see this who will not be bad actors. Definitely a topic to discuss further, let's touch base on it tomorrow? |
OK, good, there's at least some indication why the query didn't run as expected. That's mainly what I was looking for. |
What this PR does / why we need it:
Using the query blocker can be unergonomic since queries can be long, require escaping, or hard to copy from logs. This change enables an operator to block queries by their hash.
Which issue(s) this PR fixes:
N/A
Special notes for your reviewer:
We should probably provide a tool for creating uint32 representations of 32-bit FNV-1 hashes; all the online tools I found produce a hex value. It's not strictly necessary though since we have the
query_hash
in the logs, but it would be nice.Checklist
CONTRIBUTING.md
guide (required)CHANGELOG.md
updateddocs/sources/upgrading/_index.md