Skip to content

Commit e510da1

Browse files
CopilotneSpecc
andcommitted
fix: add proper type annotations to GraphQL metrics plugin
Co-authored-by: neSpecc <[email protected]>
1 parent 02e6cd0 commit e510da1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/metrics/graphql.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import client from 'prom-client';
2-
import { GraphQLRequestContext } from 'apollo-server-plugin-base';
2+
import { ApolloServerPlugin, GraphQLRequestContext, GraphQLRequestListener } from 'apollo-server-plugin-base';
33
import { GraphQLError } from 'graphql';
44

55
/**
@@ -37,8 +37,8 @@ export const gqlResolverDuration = new client.Histogram({
3737
/**
3838
* Apollo Server plugin to track GraphQL metrics
3939
*/
40-
export const graphqlMetricsPlugin = {
41-
async requestDidStart(requestContext: GraphQLRequestContext) {
40+
export const graphqlMetricsPlugin: ApolloServerPlugin = {
41+
async requestDidStart(requestContext: GraphQLRequestContext): Promise<GraphQLRequestListener> {
4242
const startTime = Date.now();
4343
let operationName = 'unknown';
4444
let operationType = 'unknown';

0 commit comments

Comments
 (0)