Skip to content

Commit a715027

Browse files
authored
chore(explore): Add new referrer for explore in events (#76256)
Adds the new referrer for the explore span samples table.
1 parent 87c723a commit a715027

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/sentry/api/endpoints/organization_events.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ class DiscoverDatasetSplitException(Exception):
126126
Referrer.API_PERFORMANCE_MOBILE_UI_METRICS_RIBBON.value,
127127
Referrer.API_PERFORMANCE_SPAN_SUMMARY_HEADER_DATA.value,
128128
Referrer.API_PERFORMANCE_SPAN_SUMMARY_TABLE.value,
129+
Referrer.API_EXPLORE_SPANS_SAMPLES_TABLE,
129130
}
130131

131132
API_TOKEN_REFERRER = Referrer.API_AUTH_TOKEN_EVENTS.value
@@ -386,6 +387,11 @@ def get(self, request: Request, organization) -> Response:
386387
if request.auth:
387388
referrer = API_TOKEN_REFERRER
388389
elif referrer not in ALLOWED_EVENTS_REFERRERS:
390+
with sentry_sdk.isolation_scope() as scope:
391+
scope.set_tag("forbidden_referrer", referrer)
392+
sentry_sdk.capture_message(
393+
"Forbidden Referrer. If this is intentional, add it to `ALLOWED_EVENTS_REFERRERS`"
394+
)
389395
referrer = Referrer.API_ORGANIZATION_EVENTS.value
390396

391397
def _data_fn(scoped_dataset, offset, limit, query) -> dict[str, Any]:

src/sentry/snuba/referrer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ class Referrer(Enum):
9191
API_DISCOVER_TRANSACTIONS_LIST = "api.discover.transactions-list"
9292
API_EVENTS_MEASUREMENTS = "api.events.measurements"
9393
API_EVENTS_VITALS = "api.events.vitals"
94+
API_EXPLORE_SPANS_SAMPLES_TABLE = "api.explore.spans-samples-table"
9495
API_GROUP_EVENTS_ERROR_DIRECT_HIT = "api.group-events.error.direct-hit"
9596
API_GROUP_EVENTS_ERROR = "api.group-events.error"
9697
API_GROUP_EVENTS_PERFORMANCE_DIRECT_HIT = "api.group-events.performance.direct-hit"

0 commit comments

Comments
 (0)