-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set current observation in data fetching environment
Prior to this commit, the Observability instrumentation would instrument `DataFetcher` instances and set the current observation in the local context of the value returned by the data fetcher itself. This allowed to properly build a parent/child chain of observations between the main request and the instrumented data fetching observations. Because the current observation was not set in the `DataFetchingEnvironment` given as a parameter to the data fetcher, any operation done in the data fetcher would not propagate using the current observation but instead the parent one. This commit revisits the implementation of the instrumentation to not wrap the result anymore, but to build a new local `GraphQLContext` that holds the current observation right before calling the data fetcher. Note that we cannot "just" set the current observation in that local context as this is shared mutable instance for all child data fetchers. Fixes gh-764
- Loading branch information
Showing
2 changed files
with
32 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters