@@ -10,41 +10,17 @@ import { ResolverContext } from '../config/apollo-server-config';
1010export function createSentryPlugin ( ) : ApolloServerPlugin < ResolverContext > {
1111 return {
1212 async requestDidStart ( { request, contextValue } ) {
13- Sentry . startSpan (
14- {
15- name : request . operationName || 'anonymous ',
16- op : 'graphql.query ',
17- attributes : {
18- 'random-test' : 'test' ,
19- 'operation.type' : 'graphql .query' ,
20- 'operation.name' : request . operationName || 'anonymous' ,
21- } ,
13+ // Log incoming queries to Sentry as breadcrumbs (no manual spans or profiler here)
14+ Sentry . addBreadcrumb ( {
15+ category : 'graphql.query ',
16+ message : request . operationName || 'Anonymous GraphQL operation ',
17+ level : 'info' ,
18+ data : {
19+ query : request . query ,
20+ variables : request . variables ,
21+ operationType : request . operationName ? 'named' : 'anonymous' ,
2222 } ,
23- span => {
24- // Set operation attributes
25- span . setAttributes ( {
26- 'operation.details.type' : 'graphql.query' ,
27- 'operation.details.name' : request . operationName || 'anonymous' ,
28- 'operation.details.timestamp' : new Date ( ) . toISOString ( ) ,
29- 'operation.details.query' : request . query ,
30- } ) ;
31-
32- // Optionally log all incoming queries to Sentry as breadcrumbs
33- // Breadcrumbs create a historical trail that persists (query history)
34- Sentry . profiler . startProfiler ( ) ;
35- Sentry . addBreadcrumb ( {
36- category : 'graphql.query' ,
37- message : request . operationName || 'Anonymous GraphQL operation' ,
38- level : 'info' ,
39- data : {
40- query : request . query ,
41- variables : request . variables ,
42- operationType : request . operationName ? 'named' : 'anonymous' ,
43- } ,
44- } ) ;
45- Sentry . profiler . stopProfiler ( ) ;
46- } ,
47- ) ;
23+ } ) ;
4824 return {
4925 async didEncounterErrors ( { errors, operation, operationName, request } ) {
5026 // Skip Apollo-specific errors that are intentionally thrown
0 commit comments