Skip to content

Commit

Permalink
chore(explore): Add new referrer for explore in events (#76256)
Browse files Browse the repository at this point in the history
Adds the new referrer for the explore span samples table.
  • Loading branch information
Zylphrex committed Aug 15, 2024
1 parent 87c723a commit a715027
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/sentry/api/endpoints/organization_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class DiscoverDatasetSplitException(Exception):
Referrer.API_PERFORMANCE_MOBILE_UI_METRICS_RIBBON.value,
Referrer.API_PERFORMANCE_SPAN_SUMMARY_HEADER_DATA.value,
Referrer.API_PERFORMANCE_SPAN_SUMMARY_TABLE.value,
Referrer.API_EXPLORE_SPANS_SAMPLES_TABLE,
}

API_TOKEN_REFERRER = Referrer.API_AUTH_TOKEN_EVENTS.value
Expand Down Expand Up @@ -386,6 +387,11 @@ def get(self, request: Request, organization) -> Response:
if request.auth:
referrer = API_TOKEN_REFERRER
elif referrer not in ALLOWED_EVENTS_REFERRERS:
with sentry_sdk.isolation_scope() as scope:
scope.set_tag("forbidden_referrer", referrer)
sentry_sdk.capture_message(
"Forbidden Referrer. If this is intentional, add it to `ALLOWED_EVENTS_REFERRERS`"
)
referrer = Referrer.API_ORGANIZATION_EVENTS.value

def _data_fn(scoped_dataset, offset, limit, query) -> dict[str, Any]:
Expand Down
1 change: 1 addition & 0 deletions src/sentry/snuba/referrer.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class Referrer(Enum):
API_DISCOVER_TRANSACTIONS_LIST = "api.discover.transactions-list"
API_EVENTS_MEASUREMENTS = "api.events.measurements"
API_EVENTS_VITALS = "api.events.vitals"
API_EXPLORE_SPANS_SAMPLES_TABLE = "api.explore.spans-samples-table"
API_GROUP_EVENTS_ERROR_DIRECT_HIT = "api.group-events.error.direct-hit"
API_GROUP_EVENTS_ERROR = "api.group-events.error"
API_GROUP_EVENTS_PERFORMANCE_DIRECT_HIT = "api.group-events.performance.direct-hit"
Expand Down

0 comments on commit a715027

Please sign in to comment.