Skip to content

feat(CapMan): QueryBuilders + Search tenant_ids - #45505

Merged
rahul-kumar-saini merged 14 commits into
masterfrom
rahul/feat/querybuilder_tenant_ids
Mar 14, 2023
Merged

feat(CapMan): QueryBuilders + Search tenant_ids#45505
rahul-kumar-saini merged 14 commits into
masterfrom
rahul/feat/querybuilder_tenant_ids

Conversation

@rahul-kumar-saini

@rahul-kumar-sainirahul-kumar-saini commented Mar 7, 2023

Copy link
Copy Markdown
Contributor

Overview

  • All Snuba queries built and executed with QueryBuilder objects now contain org ID in tenant_ids for their Snuba Requests
  • Outcomes Timeseries Queries now have tenant_ids
  • Search queries now have tenant_ids
  • See feat(CapMan): Pass tenant_ids to Snuba #44788 for more context

@github-actionsgithub-actionsBot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 7, 2023
@rahul-kumar-saini
rahul-kumar-saini marked this pull request as ready for review March 8, 2023 00:03
@rahul-kumar-saini
rahul-kumar-saini requested a review from a teamMarch 8, 2023 00:03
@rahul-kumar-saini
rahul-kumar-saini requested a review from a team as a code ownerMarch 8, 2023 00:03
@rahul-kumar-saini
rahul-kumar-saini requested a review from a teamMarch 8, 2023 00:06
@rahul-kumar-sainirahul-kumar-saini changed the title feat(CapMan): QueryBuilders now produce queries with tenant_idsfeat(CapMan): QueryBuilders + Search tenant_idsMar 8, 2023

@volokluevvolokluev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it seems like these don't have referrers attached to them. How are they populated?

Select a field, define a date range, and group or filter by columns.
"""
with self.handle_query_errors():
tenant_ids = {"organization_id": organization.id}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

does the referrer get injected somewhere else?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Since referrer is passed to Snuba in every request, I've updated the Snuba query functions in utils/snuba.py to at least add the referrer per request into tenant ids.

Eg:

ifreferrer:
kwargs["tenant_ids"] =kwargs.get("tenant_ids") ordict()
kwargs["tenant_ids"]["referrer"] =referrer

@wmakwmak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@rahul-kumar-saini
rahul-kumar-saini merged commit 911d002 into masterMar 14, 2023
@rahul-kumar-saini
rahul-kumar-saini deleted the rahul/feat/querybuilder_tenant_ids branch March 14, 2023 17:32
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Mar 30, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: BackendAutomatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@rahul-kumar-saini@volokluev@wmak