Skip to content

Commit 093ebc6

Browse files
authored
Replace GraphQlSourceBuilderCustomizer with directly providing a SentryInstrumenter bean if missing (#3744)
* attach request body for application/x-www-form-urlencoded * extend tests * changelog * Add support for v22 of graphql-java, new modules sentry-graphql-22 and sentry-graphql-core * Add back callback interface and constants as deprecated * Replace GraphQlSourceBuilderCustomizer with directly providing a SentryInstrumentation bean if missing * CR changes; changelog
1 parent 18da8f8 commit 093ebc6

File tree

10 files changed

+121
-76
lines changed

10 files changed

+121
-76
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
- Support `graphql-java` v22 via a new module `sentry-graphql-22` ([#3740](https://github.com/getsentry/sentry-java/pull/3740))
2727
- If you are using `graphql-java` v21 or earlier, you can use the `sentry-graphql` module
2828
- For `graphql-java` v22 and newer please use the `sentry-graphql-22` module
29+
- We now provide a `SentryInstrumenter` bean directly for Spring (Boot) if there is none yet instead of using `GraphQlSourceBuilderCustomizer` to add the instrumentation ([#3744](https://github.com/getsentry/sentry-java/pull/3744))
30+
- It is now also possible to provide a bean of type `SentryGraphqlInstrumentation.BeforeSpanCallback` which is then used by `SentryInstrumenter`
2931

3032
### Fixes
3133

sentry-graphql-22/api/sentry-graphql-22.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
public final class io/sentry/graphql22/BuildConfig {
2+
public static final field SENTRY_GRAPHQL_SDK_NAME Ljava/lang/String;
23
public static final field SENTRY_GRAPHQL22_SDK_NAME Ljava/lang/String;
34
public static final field VERSION_NAME Ljava/lang/String;
45
}

sentry-spring-boot-jakarta/api/sentry-spring-boot-jakarta.api

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,19 @@ public class io/sentry/spring/boot/jakarta/SentryWebfluxAutoConfiguration {
7171
public fun sentryWebExceptionHandler (Lio/sentry/IScopes;)Lio/sentry/spring/jakarta/webflux/SentryWebExceptionHandler;
7272
}
7373

74+
public class io/sentry/spring/boot/jakarta/graphql/SentryGraphql22AutoConfiguration {
75+
public fun <init> ()V
76+
public fun exceptionResolverAdapter ()Lio/sentry/spring/jakarta/graphql/SentryDataFetcherExceptionResolverAdapter;
77+
public static fun graphqlBeanPostProcessor ()Lio/sentry/spring/jakarta/graphql/SentryGraphqlBeanPostProcessor;
78+
public fun sentryInstrumentationWebMvc (Lio/sentry/spring/boot/jakarta/SentryProperties;Lorg/springframework/beans/factory/ObjectProvider;)Lio/sentry/graphql22/SentryInstrumentation;
79+
public fun sentryInstrumentationWebflux (Lio/sentry/spring/boot/jakarta/SentryProperties;Lorg/springframework/beans/factory/ObjectProvider;)Lio/sentry/graphql22/SentryInstrumentation;
80+
}
81+
7482
public class io/sentry/spring/boot/jakarta/graphql/SentryGraphqlAutoConfiguration {
7583
public fun <init> ()V
7684
public fun exceptionResolverAdapter ()Lio/sentry/spring/jakarta/graphql/SentryDataFetcherExceptionResolverAdapter;
7785
public static fun graphqlBeanPostProcessor ()Lio/sentry/spring/jakarta/graphql/SentryGraphqlBeanPostProcessor;
78-
public fun sourceBuilderCustomizerWebflux (Lio/sentry/spring/boot/jakarta/SentryProperties;)Lorg/springframework/boot/autoconfigure/graphql/GraphQlSourceBuilderCustomizer;
79-
public fun sourceBuilderCustomizerWebmvc (Lio/sentry/spring/boot/jakarta/SentryProperties;)Lorg/springframework/boot/autoconfigure/graphql/GraphQlSourceBuilderCustomizer;
86+
public fun sentryInstrumentationWebMvc (Lio/sentry/spring/boot/jakarta/SentryProperties;Lorg/springframework/beans/factory/ObjectProvider;)Lio/sentry/graphql/SentryInstrumentation;
87+
public fun sentryInstrumentationWebflux (Lio/sentry/spring/boot/jakarta/SentryProperties;Lorg/springframework/beans/factory/ObjectProvider;)Lio/sentry/graphql/SentryInstrumentation;
8088
}
8189

sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/graphql/SentryGraphqlAutoConfiguration.java

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
import com.jakewharton.nopen.annotation.Open;
44
import io.sentry.SentryIntegrationPackageStorage;
5+
import io.sentry.graphql.SentryGraphqlInstrumentation;
56
import io.sentry.graphql.SentryInstrumentation;
67
import io.sentry.spring.boot.jakarta.SentryProperties;
78
import io.sentry.spring.jakarta.graphql.SentryDataFetcherExceptionResolverAdapter;
89
import io.sentry.spring.jakarta.graphql.SentryGraphqlBeanPostProcessor;
910
import io.sentry.spring.jakarta.graphql.SentrySpringSubscriptionHandler;
1011
import org.jetbrains.annotations.NotNull;
12+
import org.springframework.beans.factory.ObjectProvider;
13+
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
1114
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
12-
import org.springframework.boot.autoconfigure.graphql.GraphQlSourceBuilderCustomizer;
1315
import org.springframework.context.annotation.Bean;
1416
import org.springframework.context.annotation.Configuration;
1517
import org.springframework.core.Ordered;
@@ -19,37 +21,42 @@
1921
@Open
2022
public class SentryGraphqlAutoConfiguration {
2123

22-
@Bean
24+
@Bean(name = "sentryInstrumentation")
25+
@ConditionalOnMissingBean
2326
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
24-
public GraphQlSourceBuilderCustomizer sourceBuilderCustomizerWebmvc(
25-
final @NotNull SentryProperties sentryProperties) {
27+
public SentryInstrumentation sentryInstrumentationWebMvc(
28+
final @NotNull SentryProperties sentryProperties,
29+
final @NotNull ObjectProvider<SentryGraphqlInstrumentation.BeforeSpanCallback>
30+
beforeSpanCallback) {
2631
SentryIntegrationPackageStorage.getInstance().addIntegration("Spring6GrahQLWebMVC");
27-
return sourceBuilderCustomizer(sentryProperties, false);
32+
return createInstrumentation(sentryProperties, beforeSpanCallback, false);
2833
}
2934

30-
@Bean
35+
@Bean(name = "sentryInstrumentation")
36+
@ConditionalOnMissingBean
3137
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
32-
public GraphQlSourceBuilderCustomizer sourceBuilderCustomizerWebflux(
33-
final @NotNull SentryProperties sentryProperties) {
38+
public SentryInstrumentation sentryInstrumentationWebflux(
39+
final @NotNull SentryProperties sentryProperties,
40+
final @NotNull ObjectProvider<SentryGraphqlInstrumentation.BeforeSpanCallback>
41+
beforeSpanCallback) {
3442
SentryIntegrationPackageStorage.getInstance().addIntegration("Spring6GrahQLWebFlux");
35-
return sourceBuilderCustomizer(sentryProperties, true);
43+
return createInstrumentation(sentryProperties, beforeSpanCallback, true);
3644
}
3745

3846
/**
3947
* We're not setting defaultDataFetcherExceptionHandler here on purpose and instead use the
4048
* resolver adapter below. This way Springs handler can still forward to other resolver adapters.
4149
*/
42-
private GraphQlSourceBuilderCustomizer sourceBuilderCustomizer(
43-
final @NotNull SentryProperties sentryProperties, final boolean captureRequestBody) {
44-
return (builder) ->
45-
builder.configureGraphQl(
46-
graphQlBuilder ->
47-
graphQlBuilder.instrumentation(
48-
new SentryInstrumentation(
49-
null,
50-
new SentrySpringSubscriptionHandler(),
51-
captureRequestBody,
52-
sentryProperties.getGraphql().getIgnoredErrorTypes())));
50+
private SentryInstrumentation createInstrumentation(
51+
final @NotNull SentryProperties sentryProperties,
52+
final @NotNull ObjectProvider<SentryGraphqlInstrumentation.BeforeSpanCallback>
53+
beforeSpanCallback,
54+
final boolean captureRequestBody) {
55+
return new SentryInstrumentation(
56+
beforeSpanCallback.getIfAvailable(),
57+
new SentrySpringSubscriptionHandler(),
58+
captureRequestBody,
59+
sentryProperties.getGraphql().getIgnoredErrorTypes());
5360
}
5461

5562
@Bean

sentry-spring-boot/api/sentry-spring-boot.api

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public class io/sentry/spring/boot/graphql/SentryGraphqlAutoConfiguration {
6767
public fun <init> ()V
6868
public fun exceptionResolverAdapter ()Lio/sentry/spring/graphql/SentryDataFetcherExceptionResolverAdapter;
6969
public static fun graphqlBeanPostProcessor ()Lio/sentry/spring/graphql/SentryGraphqlBeanPostProcessor;
70-
public fun sourceBuilderCustomizerWebflux (Lio/sentry/spring/boot/SentryProperties;)Lorg/springframework/boot/autoconfigure/graphql/GraphQlSourceBuilderCustomizer;
71-
public fun sourceBuilderCustomizerWebmvc (Lio/sentry/spring/boot/SentryProperties;)Lorg/springframework/boot/autoconfigure/graphql/GraphQlSourceBuilderCustomizer;
70+
public fun sentryInstrumentationWebMvc (Lio/sentry/spring/boot/SentryProperties;Lorg/springframework/beans/factory/ObjectProvider;)Lio/sentry/graphql/SentryInstrumentation;
71+
public fun sentryInstrumentationWebflux (Lio/sentry/spring/boot/SentryProperties;Lorg/springframework/beans/factory/ObjectProvider;)Lio/sentry/graphql/SentryInstrumentation;
7272
}
7373

sentry-spring-boot/src/main/java/io/sentry/spring/boot/graphql/SentryGraphqlAutoConfiguration.java

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
import com.jakewharton.nopen.annotation.Open;
44
import io.sentry.SentryIntegrationPackageStorage;
5+
import io.sentry.graphql.SentryGraphqlInstrumentation;
56
import io.sentry.graphql.SentryInstrumentation;
67
import io.sentry.spring.boot.SentryProperties;
78
import io.sentry.spring.graphql.SentryDataFetcherExceptionResolverAdapter;
89
import io.sentry.spring.graphql.SentryGraphqlBeanPostProcessor;
910
import io.sentry.spring.graphql.SentrySpringSubscriptionHandler;
1011
import org.jetbrains.annotations.NotNull;
12+
import org.springframework.beans.factory.ObjectProvider;
13+
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
1114
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
12-
import org.springframework.boot.autoconfigure.graphql.GraphQlSourceBuilderCustomizer;
1315
import org.springframework.context.annotation.Bean;
1416
import org.springframework.context.annotation.Configuration;
1517
import org.springframework.core.Ordered;
@@ -19,37 +21,42 @@
1921
@Open
2022
public class SentryGraphqlAutoConfiguration {
2123

22-
@Bean
24+
@Bean(name = "sentryInstrumentation")
25+
@ConditionalOnMissingBean
2326
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
24-
public GraphQlSourceBuilderCustomizer sourceBuilderCustomizerWebmvc(
25-
final @NotNull SentryProperties sentryProperties) {
27+
public SentryInstrumentation sentryInstrumentationWebMvc(
28+
final @NotNull SentryProperties sentryProperties,
29+
final @NotNull ObjectProvider<SentryGraphqlInstrumentation.BeforeSpanCallback>
30+
beforeSpanCallback) {
2631
SentryIntegrationPackageStorage.getInstance().addIntegration("Spring5GrahQLWebMVC");
27-
return sourceBuilderCustomizer(sentryProperties, false);
32+
return createInstrumentation(sentryProperties, beforeSpanCallback, false);
2833
}
2934

30-
@Bean
35+
@Bean(name = "sentryInstrumentation")
36+
@ConditionalOnMissingBean
3137
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
32-
public GraphQlSourceBuilderCustomizer sourceBuilderCustomizerWebflux(
33-
final @NotNull SentryProperties sentryProperties) {
38+
public SentryInstrumentation sentryInstrumentationWebflux(
39+
final @NotNull SentryProperties sentryProperties,
40+
final @NotNull ObjectProvider<SentryGraphqlInstrumentation.BeforeSpanCallback>
41+
beforeSpanCallback) {
3442
SentryIntegrationPackageStorage.getInstance().addIntegration("Spring5GrahQLWebFlux");
35-
return sourceBuilderCustomizer(sentryProperties, true);
43+
return createInstrumentation(sentryProperties, beforeSpanCallback, true);
3644
}
3745

3846
/**
3947
* We're not setting defaultDataFetcherExceptionHandler here on purpose and instead use the
4048
* resolver adapter below. This way Springs handler can still forward to other resolver adapters.
4149
*/
42-
private GraphQlSourceBuilderCustomizer sourceBuilderCustomizer(
43-
final @NotNull SentryProperties sentryProperties, final boolean captureRequestBody) {
44-
return (builder) ->
45-
builder.configureGraphQl(
46-
graphQlBuilder ->
47-
graphQlBuilder.instrumentation(
48-
new SentryInstrumentation(
49-
null,
50-
new SentrySpringSubscriptionHandler(),
51-
captureRequestBody,
52-
sentryProperties.getGraphql().getIgnoredErrorTypes())));
50+
private SentryInstrumentation createInstrumentation(
51+
final @NotNull SentryProperties sentryProperties,
52+
final @NotNull ObjectProvider<SentryGraphqlInstrumentation.BeforeSpanCallback>
53+
beforeSpanCallback,
54+
final boolean captureRequestBody) {
55+
return new SentryInstrumentation(
56+
beforeSpanCallback.getIfAvailable(),
57+
new SentrySpringSubscriptionHandler(),
58+
captureRequestBody,
59+
sentryProperties.getGraphql().getIgnoredErrorTypes());
5360
}
5461

5562
@Bean

sentry-spring-jakarta/api/sentry-spring-jakarta.api

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ public class io/sentry/spring/jakarta/graphql/SentryGraphqlConfiguration {
185185
public fun <init> ()V
186186
public fun exceptionResolverAdapter ()Lio/sentry/spring/jakarta/graphql/SentryDataFetcherExceptionResolverAdapter;
187187
public fun graphqlBeanPostProcessor ()Lio/sentry/spring/jakarta/graphql/SentryGraphqlBeanPostProcessor;
188-
public fun sourceBuilderCustomizerWebflux ()Lorg/springframework/boot/autoconfigure/graphql/GraphQlSourceBuilderCustomizer;
189-
public fun sourceBuilderCustomizerWebmvc ()Lorg/springframework/boot/autoconfigure/graphql/GraphQlSourceBuilderCustomizer;
188+
public fun sentryInstrumentationWebMvc (Lorg/springframework/beans/factory/ObjectProvider;)Lio/sentry/graphql/SentryInstrumentation;
189+
public fun sentryInstrumentationWebflux (Lorg/springframework/beans/factory/ObjectProvider;)Lio/sentry/graphql/SentryInstrumentation;
190190
}
191191

192192
public final class io/sentry/spring/jakarta/graphql/SentrySpringSubscriptionHandler : io/sentry/graphql/SentrySubscriptionHandler {

sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/graphql/SentryGraphqlConfiguration.java

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
import com.jakewharton.nopen.annotation.Open;
44
import io.sentry.SentryIntegrationPackageStorage;
5+
import io.sentry.graphql.SentryGraphqlInstrumentation;
56
import io.sentry.graphql.SentryInstrumentation;
7+
import org.jetbrains.annotations.NotNull;
8+
import org.springframework.beans.factory.ObjectProvider;
9+
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
610
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
7-
import org.springframework.boot.autoconfigure.graphql.GraphQlSourceBuilderCustomizer;
811
import org.springframework.context.annotation.Bean;
912
import org.springframework.context.annotation.Configuration;
1013
import org.springframework.core.Ordered;
@@ -14,31 +17,38 @@
1417
@Open
1518
public class SentryGraphqlConfiguration {
1619

17-
@Bean
20+
@Bean(name = "sentryInstrumentation")
21+
@ConditionalOnMissingBean
1822
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
19-
public GraphQlSourceBuilderCustomizer sourceBuilderCustomizerWebmvc() {
23+
public SentryInstrumentation sentryInstrumentationWebMvc(
24+
final @NotNull ObjectProvider<SentryGraphqlInstrumentation.BeforeSpanCallback>
25+
beforeSpanCallback) {
2026
SentryIntegrationPackageStorage.getInstance().addIntegration("Spring6GrahQLWebMVC");
21-
return sourceBuilderCustomizer(false);
27+
return createInstrumentation(beforeSpanCallback, false);
2228
}
2329

24-
@Bean
30+
@Bean(name = "sentryInstrumentation")
31+
@ConditionalOnMissingBean
2532
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
26-
public GraphQlSourceBuilderCustomizer sourceBuilderCustomizerWebflux() {
33+
public SentryInstrumentation sentryInstrumentationWebflux(
34+
final @NotNull ObjectProvider<SentryGraphqlInstrumentation.BeforeSpanCallback>
35+
beforeSpanCallback) {
2736
SentryIntegrationPackageStorage.getInstance().addIntegration("Spring6GrahQLWebFlux");
28-
return sourceBuilderCustomizer(true);
37+
return createInstrumentation(beforeSpanCallback, true);
2938
}
3039

3140
/**
3241
* We're not setting defaultDataFetcherExceptionHandler here on purpose and instead use the
3342
* resolver adapter below. This way Springs handler can still forward to other resolver adapters.
3443
*/
35-
private GraphQlSourceBuilderCustomizer sourceBuilderCustomizer(final boolean captureRequestBody) {
36-
return (builder) ->
37-
builder.configureGraphQl(
38-
graphQlBuilder ->
39-
graphQlBuilder.instrumentation(
40-
new SentryInstrumentation(
41-
null, new SentrySpringSubscriptionHandler(), captureRequestBody)));
44+
private SentryInstrumentation createInstrumentation(
45+
final @NotNull ObjectProvider<SentryGraphqlInstrumentation.BeforeSpanCallback>
46+
beforeSpanCallback,
47+
final boolean captureRequestBody) {
48+
return new SentryInstrumentation(
49+
beforeSpanCallback.getIfAvailable(),
50+
new SentrySpringSubscriptionHandler(),
51+
captureRequestBody);
4252
}
4353

4454
@Bean

sentry-spring/api/sentry-spring.api

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ public class io/sentry/spring/graphql/SentryGraphqlConfiguration {
185185
public fun <init> ()V
186186
public fun exceptionResolverAdapter ()Lio/sentry/spring/graphql/SentryDataFetcherExceptionResolverAdapter;
187187
public fun graphqlBeanPostProcessor ()Lio/sentry/spring/graphql/SentryGraphqlBeanPostProcessor;
188-
public fun sourceBuilderCustomizerWebflux ()Lorg/springframework/boot/autoconfigure/graphql/GraphQlSourceBuilderCustomizer;
189-
public fun sourceBuilderCustomizerWebmvc ()Lorg/springframework/boot/autoconfigure/graphql/GraphQlSourceBuilderCustomizer;
188+
public fun sentryInstrumentationWebMvc (Lorg/springframework/beans/factory/ObjectProvider;)Lio/sentry/graphql/SentryInstrumentation;
189+
public fun sentryInstrumentationWebflux (Lorg/springframework/beans/factory/ObjectProvider;)Lio/sentry/graphql/SentryInstrumentation;
190190
}
191191

192192
public final class io/sentry/spring/graphql/SentrySpringSubscriptionHandler : io/sentry/graphql/SentrySubscriptionHandler {

sentry-spring/src/main/java/io/sentry/spring/graphql/SentryGraphqlConfiguration.java

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
import com.jakewharton.nopen.annotation.Open;
44
import io.sentry.SentryIntegrationPackageStorage;
5+
import io.sentry.graphql.SentryGraphqlInstrumentation;
56
import io.sentry.graphql.SentryInstrumentation;
7+
import org.jetbrains.annotations.NotNull;
8+
import org.springframework.beans.factory.ObjectProvider;
9+
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
610
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
7-
import org.springframework.boot.autoconfigure.graphql.GraphQlSourceBuilderCustomizer;
811
import org.springframework.context.annotation.Bean;
912
import org.springframework.context.annotation.Configuration;
1013
import org.springframework.core.Ordered;
@@ -14,31 +17,38 @@
1417
@Open
1518
public class SentryGraphqlConfiguration {
1619

17-
@Bean
20+
@Bean(name = "sentryInstrumentation")
21+
@ConditionalOnMissingBean
1822
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
19-
public GraphQlSourceBuilderCustomizer sourceBuilderCustomizerWebmvc() {
23+
public SentryInstrumentation sentryInstrumentationWebMvc(
24+
final @NotNull ObjectProvider<SentryGraphqlInstrumentation.BeforeSpanCallback>
25+
beforeSpanCallback) {
2026
SentryIntegrationPackageStorage.getInstance().addIntegration("Spring5GrahQLWebMVC");
21-
return sourceBuilderCustomizer(false);
27+
return createInstrumentation(beforeSpanCallback, false);
2228
}
2329

24-
@Bean
30+
@Bean(name = "sentryInstrumentation")
31+
@ConditionalOnMissingBean
2532
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
26-
public GraphQlSourceBuilderCustomizer sourceBuilderCustomizerWebflux() {
33+
public SentryInstrumentation sentryInstrumentationWebflux(
34+
final @NotNull ObjectProvider<SentryGraphqlInstrumentation.BeforeSpanCallback>
35+
beforeSpanCallback) {
2736
SentryIntegrationPackageStorage.getInstance().addIntegration("Spring5GrahQLWebFlux");
28-
return sourceBuilderCustomizer(true);
37+
return createInstrumentation(beforeSpanCallback, true);
2938
}
3039

3140
/**
3241
* We're not setting defaultDataFetcherExceptionHandler here on purpose and instead use the
3342
* resolver adapter below. This way Springs handler can still forward to other resolver adapters.
3443
*/
35-
private GraphQlSourceBuilderCustomizer sourceBuilderCustomizer(final boolean captureRequestBody) {
36-
return (builder) ->
37-
builder.configureGraphQl(
38-
graphQlBuilder ->
39-
graphQlBuilder.instrumentation(
40-
new SentryInstrumentation(
41-
null, new SentrySpringSubscriptionHandler(), captureRequestBody)));
44+
private SentryInstrumentation createInstrumentation(
45+
final @NotNull ObjectProvider<SentryGraphqlInstrumentation.BeforeSpanCallback>
46+
beforeSpanCallback,
47+
final boolean captureRequestBody) {
48+
return new SentryInstrumentation(
49+
beforeSpanCallback.getIfAvailable(),
50+
new SentrySpringSubscriptionHandler(),
51+
captureRequestBody);
4252
}
4353

4454
@Bean

0 commit comments

Comments
 (0)