Add graphql queries error codes metrics (#12833)

## Context
Added to the existing useGraphQLErrorHandlerHook yoga hook to increment
metrics after all query executions based on their error codes. I
originally wanted to create a new useMetrics hook but most of the error
handling was done in useGraphQLErrorHandlerHook so we decided to keep it
there for now.

<img width="1310" alt="Screenshot 2025-06-24 at 15 58 26"
src="https://github.com/user-attachments/assets/498d3754-851a-4051-a5c2-23ac8253aa6a"
/>
This commit is contained in:
Weiko
2025-06-24 16:13:33 +02:00
committed by GitHub
parent b8fd10e9e8
commit ed11cac5f7
7 changed files with 78 additions and 7 deletions

View File

@ -15,7 +15,7 @@ export class MetricsService {
shouldStoreInCache = true,
}: {
key: MetricsKeys;
eventId: string;
eventId?: string;
shouldStoreInCache?: boolean;
}) {
//TODO : Define meter name usage in monitoring
@ -24,7 +24,7 @@ export class MetricsService {
counter.add(1);
if (shouldStoreInCache) {
if (shouldStoreInCache && eventId) {
this.metricsCacheService.updateCounter(key, [eventId]);
}
}

View File

@ -6,6 +6,13 @@ export enum MetricsKeys {
CalendarEventSyncJobFailedInsufficientPermissions = 'calendar-event-sync-job/failed-insufficient-permissions',
CalendarEventSyncJobFailedUnknown = 'calendar-event-sync-job/failed-unknown',
InvalidCaptcha = 'invalid-captcha',
GraphqlOperation200 = 'graphql-operation/200',
GraphqlOperation400 = 'graphql-operation/400',
GraphqlOperation401 = 'graphql-operation/401',
GraphqlOperation403 = 'graphql-operation/403',
GraphqlOperation404 = 'graphql-operation/404',
GraphqlOperation500 = 'graphql-operation/500',
GraphqlOperationUnknown = 'graphql-operation/unknown',
WorkflowRunStartedDatabaseEventTrigger = 'workflow-run/started/database-event-trigger',
WorkflowRunStartedCronTrigger = 'workflow-run/started/cron-trigger',
WorkflowRunStartedWebhookTrigger = 'workflow-run/started/webhook-trigger',