You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an Apollo Server using Apollo Gateway fetches data from a GraphQLDataSource it will not always call the willResolveField (#3988) function of supplied plugins. When the GraphQLDataSource is an instance of LocalGraphQLDataSource then the plugin function is invoked, but for another object implementing the GraphQLDataSource interface this does not occur.
Expected Behaviour
willResolveField should be invoked for each field in the response regardless of the GraphQLDataSource implementation.
Observe the console output never reports will resolve field: b
will resolve field: a
QueryPlan {
Parallel {
Fetch(service: "a") {
{
a
}
},
Fetch(service: "b") {
{
b
}
},
},
}
Other Information
The ApolloServerPluginUsageReporting plugin uses the willResolveField function to track field level data for Apollo Studio metrics. The data for gateways that supply their own GraphQLDataSource has all fields marked with zero traffic.
The text was updated successfully, but these errors were encountered:
This is working as intended. willResolveField is called when you’re actually running a resolver for a field in the process. The gateway doesn’t call this because it’s not running resolvers: it’s just forwarding to the subgraph.
The current way this is expected to work is that your subgraph should be using the inline trace plugin (or an equivalent implementation if you’re not using apollo-server in your subgraph) to include details about execution in its response to the gateway, which the gateway then incorporates into its usage reports. This does require your subgraph to be using a GraphQL implementation that supports inline traces.
We do have a designed but not implemented plan to allow gateways to provide field usage information (but not field performance information) to Studio without needing anything special from subgraphs.
Observed Behaviour
When an Apollo Server using Apollo Gateway fetches data from a
GraphQLDataSource
it will not always call thewillResolveField
(#3988) function of supplied plugins. When theGraphQLDataSource
is an instance ofLocalGraphQLDataSource
then the plugin function is invoked, but for another object implementing theGraphQLDataSource
interface this does not occur.Expected Behaviour
willResolveField
should be invoked for each field in the response regardless of theGraphQLDataSource
implementation.Reproduction
https://codesandbox.io/s/gateway-willresolvefield-7y82n
Submit the query
{ a b }
to receive the responseObserve the console output never reports
will resolve field: b
Other Information
The
ApolloServerPluginUsageReporting
plugin uses thewillResolveField
function to track field level data for Apollo Studio metrics. The data for gateways that supply their ownGraphQLDataSource
has all fields marked with zero traffic.The text was updated successfully, but these errors were encountered: