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

feat(apis): Pass query source to snuba - phase 3 #73499

Merged
merged 7 commits into from
Aug 15, 2024

Conversation

sentaur-athena
Copy link
Member

Continuing #73497 to pass query source to snuba for more debuggability.

OrganizationEventsTraceBaseEndpoint
OrganizationsEventsNewTrendsStatsEndpoint
OrganizationsEventsEndpoint

@sentaur-athena sentaur-athena requested review from volokluev, Zylphrex and a team June 28, 2024 11:30
@sentaur-athena sentaur-athena requested review from a team as code owners June 28, 2024 11:30
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 28, 2024
@sentaur-athena sentaur-athena changed the base branch from master to athena/snuba-query-source June 28, 2024 11:31
Copy link

codecov bot commented Jun 28, 2024

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
21641 1 21640 202
View the top 1 failed tests by shortest run time
tests.snuba.api.endpoints.test_organization_events.OrganizationEventsProfilesDatasetEndpointTest�test_profiles_dataset_simple
Stack Traces | 15.7s run time
#x1B[1m#x1B[.../api/endpoints/test_organization_events.py#x1B[0m:5989: in test_profiles_dataset_simple
assert response.status_code == 200, response.content
#x1B[1m#x1B[31mE AssertionError: b'{"detail":"Internal Error","errorId":null}'#x1B[0m
#x1B[1m#x1B[31mE assert 500 == 200#x1B[0m
#x1B[1m#x1B[31mE + where 500 = <Response status_code=500, "application/json">.status_code#x1B[0m

To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard

@@ -338,6 +340,8 @@ def get(self, request: Request, organization) -> Response:
elif referrer not in ALLOWED_EVENTS_REFERRERS:
referrer = Referrer.API_ORGANIZATION_EVENTS.value

query_source = QuerySource.FRONTEND if is_frontend_request(request) else QuerySource.API
Copy link
Member

Choose a reason for hiding this comment

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

Just a thought but it'd be nice if this was wrapped into a helper function like

def get_request_source(request: Request) -> QuerySource:
  if is_frontend_request(request):
    return QuerySource.FRONTEND
  return QuerySource.API

This also gives you a single place to update in the future if there are additional query sources instead of having to update every caller with additional checks.

@getsantry
Copy link
Contributor

getsantry bot commented Jul 27, 2024

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you add the label WIP, I will leave it alone unless WIP is removed ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@sentaur-athena sentaur-athena merged commit f24f9d5 into master Aug 15, 2024
48 checks passed
@sentaur-athena sentaur-athena deleted the athena/snuba-query-source-3 branch August 15, 2024 20:26
@github-actions github-actions bot locked and limited conversation to collaborators Aug 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants