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:
@ -9,6 +9,7 @@ import { MetadataGraphQLApiModule } from 'src/engine/api/graphql/metadata-graphq
|
||||
import { CacheStorageService } from 'src/engine/core-modules/cache-storage/services/cache-storage.service';
|
||||
import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service';
|
||||
import { useGraphQLErrorHandlerHook } from 'src/engine/core-modules/graphql/hooks/use-graphql-error-handler.hook';
|
||||
import { MetricsService } from 'src/engine/core-modules/metrics/metrics.service';
|
||||
import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';
|
||||
import { DataloaderService } from 'src/engine/dataloaders/dataloader.service';
|
||||
import { renderApolloPlayground } from 'src/engine/utils/render-apollo-playground.util';
|
||||
@ -18,6 +19,7 @@ export const metadataModuleFactory = async (
|
||||
exceptionHandlerService: ExceptionHandlerService,
|
||||
dataloaderService: DataloaderService,
|
||||
cacheStorageService: CacheStorageService,
|
||||
metricsService: MetricsService,
|
||||
): Promise<YogaDriverConfig> => {
|
||||
const config: YogaDriverConfig = {
|
||||
autoSchemaFile: true,
|
||||
@ -35,6 +37,7 @@ export const metadataModuleFactory = async (
|
||||
},
|
||||
}),
|
||||
useGraphQLErrorHandlerHook({
|
||||
metricsService: metricsService,
|
||||
exceptionHandlerService,
|
||||
}),
|
||||
useCachedMetadata({
|
||||
|
||||
Reference in New Issue
Block a user