I’m using the bfmatei/apollo-prometheus-exporter metrics plugin to expose Prometheus metrics for a federated GraphQL gateway. One of the metrics created by this library is recorded on a willResolveField
event, but this metric is not being produced for my gateway.
My first thought was that the willResolveField
lifecycle event may not be firing, so I checked that by adding some console.log
statements as follows:
const plugins = [{
requestDidStart() {
console.log('requestDidStart')
return {
executionDidStart() {
console.log('executionDidStart');
return {
willResolveField() {
console.log('willResolveField');
return (error, result) => {
console.log('end hook');
};
}
};
}
};
}
}];
apolloServer = new ApolloServer({ # V2
gateway: new ApolloGateway(),
subscriptions: false,
plugins
});
The only statements that get logged to the console when I make a request are requestDidStart
and executionDidStart
. I am using apollo-server
2.25.2.
Does anyone know why my gateway won’t respond to willResolveField
events?