-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ContextDataFetcherDecorator should capture from global and local GraphQLContext #688
Labels
Milestone
Comments
bclozel
added
type: enhancement
A general enhancement
in: core
Issues related to config and core support
labels
May 10, 2023
bclozel
added a commit
that referenced
this issue
May 10, 2023
Prior to this commit, a partial fix in a56ff6e introduced proper relationships between request and data fetcher observations by tracking them in a local concurrent map. This fix is incomplete as data fetcher operations are not set as current in the ThreadLocal or reactive contexts when the actual DataFetcher is executed. We cannot use the global GraphQLContext for DataFetcher observations, as it is shared for the entire GraphQL request (and no thread safe). This commit makes the Instrumentation instrument DataFetcher and make them return a `DataFetcherResult` that holds a `g.s.DataFetchingEnvironment#getLocalContext` with a reference to the current data fetcher observation. A temporary fix is also applied in `ContextDataFetcherDecorator` to merge both global and local contexts when capturing a `ContextSnapshot` to be applied for the data fetching operation. Fixes gh-676 See gh-688
A temporary fix has been applied in #676 in the |
bclozel
added
the
for: backport-to-1.2.x
Marks an issue as a candidate for backport to 1.2.x
label
Jun 7, 2023
github-actions
bot
added
status: backported
An issue that has been backported to maintenance branches
and removed
for: backport-to-1.2.x
Marks an issue as a candidate for backport to 1.2.x
labels
Jun 7, 2023
Reopening as we undid this change in 9ff1691. We will remove the workaround once we raise the minimum requirement for Context Propagation 1.0.3. |
bclozel
removed
the
status: backported
An issue that has been backported to maintenance branches
label
Jun 19, 2023
bclozel
added a commit
to bclozel/spring-graphql
that referenced
this issue
Feb 14, 2024
Prior to this commit, spring-projectsgh-676 fixed the local and global context inheritance in the `ContextDataFetcherDecorator` with a workaround. This commit undoes this workaround and uses the new Context Propagation API for this, effectively raising the requirement for version 1.0.3 and removing all deprecated APIs in the meantime. Closes spring-projectsgh-688
bclozel
added a commit
that referenced
this issue
Feb 14, 2024
Prior to this commit, gh-676 fixed the local and global context inheritance in the `ContextDataFetcherDecorator` with a workaround. This commit undoes this workaround and uses the new Context Propagation API for this, effectively raising the requirement for version 1.0.3 and removing all deprecated APIs in the meantime. Closes gh-688
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Currently, the
ContextDataFetcherDecorator
captures context values from the globalGraphQLContext
and set captured values in the execution context of the decoratedDataFetcher
. EachDataFetcher
can also contribute additional context values by returning aDataFetcherResult
containing alocalContext
that will be used when calling otherDataFetcher
lower in the hierarchy call.We should ensure that
ContextDataFetcherDecorator
captures from both global and localGraphQLContext
, if the latter is present. This requires a change in the context-propagation library, see micrometer-metrics/context-propagation#98.The text was updated successfully, but these errors were encountered: