Q: Apollo server accessing all datasources within resolvers before API request is sent In a graphql query with multiple resolvers, I'm looking for a way to count how many times datasources are called before the first datasource API request is sent. The project that I am working on requires me to either allow or stop all the requests if the number of the datasources called within resolvers in a graphql query exceeds a certain number. 
I am using an instance of the RESTDataSource to make API calls and each one of the resolvers call one or more datasources from the RESTDataSource class. I've been looking into this and far as I know, the RESTDataSource class doesn't have a method that shows me all the datasources requested because it is only called by the resolver and per request.
My problem is, I'm not finding a place where I can have access to all the datasources that will be called before the request is sent. I found that in the Apollo server instantiation, the only thing that I have access to are the resolvers, and not the datasources within each resolver, and as far as I know, not before the request is made so I can't stop it if the number of datasources calls exceed a certain threshold. I was hoping I could access that in the willSendRequest method inside the RESTDataSource class since from what I know, this is the only method that intercepts the request before being sent, but I don't think it's possible.
I'm pretty new to Apollo and I've been reading about this but didn't find a solution. I'd really appreciate any help.
Here's a simplified snippet of my code (not the original code):
resolvers.ts
export const resolvers: Resolvers = {
  Query: {
    getCompanies: (_, __, { dataSources }) => {
      return dataSources.companyDatasource.getCompanies();
    },
    getCompany: (_, { name }, { dataSources }) => {
      return dataSources.companyDatasource.getCompanyByName(name);
    },
    getCompanyCEOs: async (_, { name }, { dataSources }) => {
      const company = await dataSources.companyDatasource.getCompanyByName(name);
      return dataSources.companyDatasource.getCEOs(company.id);
    },
....

company.datasource.ts
export default class CompanyDatasource extends RESTDataSource {
  async willSendRequest(request) {
    // some logic
  }

  async getCompanies() {
    return this.get(`some_api_url`);
  }

  async getCompanyByName(name) {
    return this.get(`some_api_url?companyName=name`);
  }
  //other external API endpoints
...
}

main.ts
  const server = new ApolloServer({
    typeDefs: schema,
    schema,
    resolvers,
    dataSources,
    cache: 'bounded',
  });
  await server.start();

Edit: I'm limiting the number of unique datasource API calls because the API I'm hitting has a limit. I tried instantiating a counter in the RESTDataSource class and using it in the willSendRequest to count how many datasource calls there are, but the problem is this is counting request by request and has no access to all the API requests that are coming from the resolver. For instance, if the getCompanies API can be called only once and I have 2 upcoming requests, I'll have to let one of them pass and only stop the second, because at that point I don't know there's a second request coming. My team has agreed to stop both requests in case the number of upcoming requests exceeds the available limit for the endpoint (this is specified in our database), so this is why I need to know beforehand how many API requests are there before even allowing the first request.
