ApolloServer plugin does not respond to willResolveField event

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() {
    return {
      executionDidStart() {
        return {
          willResolveField() {
            return (error, result) => {
              console.log('end hook');

apolloServer = new ApolloServer({ # V2
  gateway: new ApolloGateway(),
  subscriptions: false,

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?

Is your resolver in the correct location and any resolvers further up the chain being resolved?

Can you show your request and response for the/a query that triggers this?

Hello, great question!

You are correct that the gateway does not fire the willResolveField event, and this is a federation-specific omission in our docs. The reason for this is that the gateway doesn’t resolve fields, because your individual subgraphs do instead.

To get a full timeline of a GraphQL operation in a federated graph, you need to track execution in both the gateway and in your subgraphs. And the details of what you track differ slightly between the two. Unfortunately I’m unfamiliar with the Prometheus exporter, but you might find parallels with Apollo’s OpenTelemetry support.