Skip to content

Commit

Permalink
feat(graphql): Add has_graphql_request analytics property to issue/ev…
Browse files Browse the repository at this point in the history
…ent (#50949)

Closes #50231
  • Loading branch information
malwilley authored Jun 15, 2023
1 parent 6d95c20 commit a995100
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions static/app/utils/analytics/workflowAnalyticsEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export type BaseEventAnalyticsParams = {
event_type?: string;
frames_with_sourcemaps_percent?: number;
frames_without_source_maps_percent?: number;
has_graphql_request?: boolean;
has_otel?: boolean;
release_user_agent?: string;
sdk_name?: string;
Expand Down
12 changes: 12 additions & 0 deletions static/app/utils/events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import ConfigStore from 'sentry/stores/configStore';
import {
BaseGroup,
EntryException,
EntryRequest,
EntryThreads,
EventMetadata,
EventOrGroupType,
Expand Down Expand Up @@ -395,6 +396,16 @@ export function eventHasExceptionGroup(event: Event) {
);
}

export function eventHasGraphQlRequest(event: Event) {
const requestEntry = event.entries?.find(entry => entry.type === EntryType.REQUEST) as
| EntryRequest
| undefined;
return (
typeof requestEntry?.data?.apiTarget === 'string' &&
requestEntry.data.apiTarget.toLowerCase() === 'graphql'
);
}

/**
* Return the integration type for the first assignment via integration
*/
Expand Down Expand Up @@ -425,6 +436,7 @@ export function getAnalyticsDataForEvent(event?: Event | null): BaseEventAnalyti
event_type: event?.type,
has_release: !!event?.release,
has_exception_group: event ? eventHasExceptionGroup(event) : false,
has_graphql_request: event ? eventHasGraphQlRequest(event) : false,
has_source_context: event ? eventHasSourceContext(event) : false,
has_source_maps: event ? eventHasSourceMaps(event) : false,
has_trace: event ? hasTrace(event) : false,
Expand Down

0 comments on commit a995100

Please sign in to comment.