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
Using Spring Boot 3.0.0 and GraphQL 1.1.0 with MVC an NPE occurs.
When calling a controller, a trace-id is generated as expected. The trace shows up in Grafana (etc).
When calling the graphiql endpoint, an NPE is generated.
2022-11-25 16:11:17.504 ERROR 64991 [] --- [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] threw exception
java.lang.NullPointerException: Cannot invoke "Object.toString()" because the return value of "java.util.Map.get(Object)" is null
at org.springframework.graphql.observation.ExecutionRequestObservationContext.lambda$new$0(ExecutionRequestObservationContext.java:35)
at io.micrometer.tracing.handler.PropagatingReceiverTracingObservationHandler.lambda$onStart$0(PropagatingReceiverTracingObservationHandler.java:59)
at io.micrometer.tracing.brave.bridge.W3CPropagation.lambda$extractor$1(W3CPropagation.java:249)
at io.micrometer.tracing.brave.bridge.BravePropagator.extract(BravePropagator.java:59)
at io.micrometer.tracing.handler.PropagatingReceiverTracingObservationHandler.onStart(PropagatingReceiverTracingObservationHandler.java:58)
at io.micrometer.tracing.handler.PropagatingReceiverTracingObservationHandler.onStart(PropagatingReceiverTracingObservationHandler.java:35)
at io.micrometer.observation.ObservationHandler$FirstMatchingCompositeObservationHandler.lambda$onStart$1(ObservationHandler.java:134)
at java.base/java.util.Optional.ifPresent(Optional.java:178)
at io.micrometer.observation.ObservationHandler$FirstMatchingCompositeObservationHandler.onStart(ObservationHandler.java:134)
at io.micrometer.observation.SimpleObservation.lambda$notifyOnObservationStarted$2(SimpleObservation.java:188)
at java.base/java.util.ArrayDeque.forEach(ArrayDeque.java:888)
at io.micrometer.observation.SimpleObservation.notifyOnObservationStarted(SimpleObservation.java:188)
at io.micrometer.observation.SimpleObservation.start(SimpleObservation.java:143)
at org.springframework.graphql.observation.GraphQlObservationInstrumentation.beginExecution(GraphQlObservationInstrumentation.java:105)
at graphql.execution.instrumentation.ChainedInstrumentation.lambda$beginExecution$0(ChainedInstrumentation.java:85)
at graphql.collect.ImmutableKit.mapAndDropNulls(ImmutableKit.java:107)
at graphql.execution.instrumentation.ChainedInstrumentation.beginExecution(ChainedInstrumentation.java:83)
at graphql.GraphQL.executeAsync(GraphQL.java:522)
at org.springframework.graphql.execution.DefaultExecutionGraphQlService.lambda$execute$2(DefaultExecutionGraphQlService.java:82)
...
The text was updated successfully, but these errors were encountered:
bclozel
changed the title
GraphQL via WebMVC and Observability - NullPointerException
Tracing support fails with NullPointerException when propagation information is missing
Dec 1, 2022
Thanks @RutgerLubbers for this issue. The instrumentation was not well tested here and we'll use this issue to revisit fix and improve tracing support in general.
This issue shows that when extracting the propagation information from inbound requests, we are only looking at the graphql request extension and failing with an NPE if the extensions map is null...
We should change the instrumentation to first look up the propagation information in the GraphQL context. Developers can use a transport specific interceptor to look up that information in the transport protocol and put it in the graphql context. This is the case if HTTP clients send this information as request headers. We should provide a WebGraphQlInterceptor interceptor that does just that.
If the propagation information is not available in the GraphQL context, we should then fall back to the request extensions and ensure that we don't fail if they are missing.
Since the tracing support is effectively broken, we will also change the contextual name of the observation to better align with other implementations, from graphQL to graphql. Without this change, the name of the observation can be normalized by collectors as graph-q-l and this is unfortunate.
As of spring-projects/spring-graphql#547, Spring GraphQL introduced a
`PropagationWebGraphQlInterceptor` that propagates the incoming tracing
information in HTTP request headers into the GraphQL context.
This commit auto-configures the propagation interceptor if the
application exposes a GraphQL HTTP endpoint and if it is configured for
Tracing support.
Fixesgh-33542
Using Spring Boot 3.0.0 and GraphQL 1.1.0 with MVC an NPE occurs.
When calling a controller, a trace-id is generated as expected. The trace shows up in Grafana (etc).
When calling the graphiql endpoint, an NPE is generated.
An example project can be found here: https://github.com/RutgerLubbers/graphql-observability
The text was updated successfully, but these errors were encountered: