From 005c012cfdc134593b055b52f1c1f7dc9028dda5 Mon Sep 17 00:00:00 2001 From: Kamil Kisiela Date: Wed, 28 Sep 2022 13:18:22 +0200 Subject: [PATCH] Add the name of graphql client to Sentry context --- packages/services/server/src/graphql-handler.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/services/server/src/graphql-handler.ts b/packages/services/server/src/graphql-handler.ts index 6035cee4e..2f543538f 100644 --- a/packages/services/server/src/graphql-handler.ts +++ b/packages/services/server/src/graphql-handler.ts @@ -104,7 +104,9 @@ export const graphqlHandler = (options: GraphQLHandlerOptions): RouteHandlerMeth // Reduce the number of transactions to avoid overloading Sentry const ctx = args.contextValue as Context; - const graphqlClientName = ctx.headers['graphql-client-name']; + const graphqlClientName = Array.isArray(ctx.headers['graphql-client-name']) + ? ctx.headers['graphql-client-name'][0] + : ctx.headers['graphql-client-name']; if (transaction && graphqlClientName !== 'Hive CLI' && graphqlClientName !== 'Hive App') { transaction.sampled = false; @@ -115,6 +117,7 @@ export const graphqlHandler = (options: GraphQLHandlerOptions): RouteHandlerMeth operationName: args.operationName, operation: print(args.document), userId: extractUserId(args.contextValue as any), + graphqlClientName, }); }, trackResolvers: false,