-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(CapMan): Eventstore query tenant_ids
#45550
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
Conversation
…/querybuilder_tenant_ids
| query: QueryDefinition, tenant_ids: dict[str, Any] | None = None | ||
| query: QueryDefinition, | ||
| tenant_ids: dict[str, Any] | None = None, | ||
| referrer: str = "outcomes.timeseries", | ||
| ) -> ResultSet: | ||
| """ | ||
| Runs an outcomes query. By default the referrer is `outcomes.timeseries` and this should not change | ||
| unless there is a very specific reason to do so. Eg. getsentry uses this function for billing | ||
| metrics, so the referrer is different as it's no longer a "product" query. | ||
| """ |
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.
I can PR this separately but it's a quick change not very relevant to the entire PR. Previously, I added tenant_ids to all outcomes.timeseries and outcomes.totals queries but I was still seeing timeseries queries coming without this data. Turns out this function is used in getsentry for a billing metric, and there should should really be a different referrer for that use case, so I made referrer an optional param with a quick description of why.
JoshFerge
left a comment
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.
everything looks okay to me except for the one in reprocessing2
src/sentry/tasks/reprocessing2.py
Outdated
| batch_size=settings.SENTRY_REPROCESSING_PAGE_SIZE, | ||
| state=query_state, | ||
| referrer="reprocessing2.reprocess_group", | ||
| tenant_ids={"organization_id": models.Project.objects.get(id=project_id).organization_id}, |
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.
this one could be problematic as this is an ingest flow. would check with @untitaker on if this is okay to do here.
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.
reprocessing is not perf sensitive, but if you can, use get_from_cache across the board just because it's low-effort
JoshFerge
left a comment
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
Overview
tenant_idstenant_idsto Snuba #44788 for more context