-
-
Notifications
You must be signed in to change notification settings - Fork 458
Allow filtering graphql errors #2967
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ | |
| import io.sentry.opentelemetry.OpenTelemetryLinkErrorEventProcessor; | ||
| import io.sentry.protocol.SdkVersion; | ||
| import io.sentry.quartz.SentryJobListener; | ||
| import io.sentry.spring.boot.jakarta.graphql.SentryGraphqlAutoConfiguration; | ||
| import io.sentry.spring.jakarta.ContextTagsEventProcessor; | ||
| import io.sentry.spring.jakarta.SentryExceptionResolver; | ||
| import io.sentry.spring.jakarta.SentryRequestResolver; | ||
|
|
@@ -27,7 +28,6 @@ | |
| import io.sentry.spring.jakarta.checkin.SentryQuartzConfiguration; | ||
| import io.sentry.spring.jakarta.exception.SentryCaptureExceptionParameterPointcutConfiguration; | ||
| import io.sentry.spring.jakarta.exception.SentryExceptionParameterAdviceConfiguration; | ||
| import io.sentry.spring.jakarta.graphql.SentryGraphqlConfiguration; | ||
| import io.sentry.spring.jakarta.tracing.SentryAdviceConfiguration; | ||
| import io.sentry.spring.jakarta.tracing.SentrySpanPointcutConfiguration; | ||
| import io.sentry.spring.jakarta.tracing.SentryTracingFilter; | ||
|
|
@@ -166,7 +166,7 @@ static class OpenTelemetryLinkErrorEventProcessorConfiguration { | |
| } | ||
|
|
||
| @Configuration(proxyBeanMethods = false) | ||
| @Import(SentryGraphqlConfiguration.class) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the reason why we didn't update the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I kept |
||
| @Import(SentryGraphqlAutoConfiguration.class) | ||
| @Open | ||
| @ConditionalOnClass({ | ||
| SentryGraphqlExceptionHandler.class, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| package io.sentry.spring.boot.jakarta.graphql; | ||
|
|
||
| import com.jakewharton.nopen.annotation.Open; | ||
| import io.sentry.SentryIntegrationPackageStorage; | ||
| import io.sentry.graphql.SentryInstrumentation; | ||
| import io.sentry.spring.boot.jakarta.SentryProperties; | ||
| import io.sentry.spring.jakarta.graphql.SentryDataFetcherExceptionResolverAdapter; | ||
| import io.sentry.spring.jakarta.graphql.SentryGraphqlBeanPostProcessor; | ||
| import io.sentry.spring.jakarta.graphql.SentrySpringSubscriptionHandler; | ||
| import org.jetbrains.annotations.NotNull; | ||
| import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; | ||
| import org.springframework.boot.autoconfigure.graphql.GraphQlSourceBuilderCustomizer; | ||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.Configuration; | ||
| import org.springframework.core.Ordered; | ||
| import org.springframework.core.annotation.Order; | ||
|
|
||
| @Configuration(proxyBeanMethods = false) | ||
| @Open | ||
| public class SentryGraphqlAutoConfiguration { | ||
|
|
||
| @Bean | ||
| @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) | ||
| public GraphQlSourceBuilderCustomizer sourceBuilderCustomizerWebmvc( | ||
| final @NotNull SentryProperties sentryProperties) { | ||
| SentryIntegrationPackageStorage.getInstance().addIntegration("Spring6GrahQLWebMVC"); | ||
| return sourceBuilderCustomizer(sentryProperties, false); | ||
| } | ||
|
|
||
| @Bean | ||
| @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE) | ||
| public GraphQlSourceBuilderCustomizer sourceBuilderCustomizerWebflux( | ||
| final @NotNull SentryProperties sentryProperties) { | ||
| SentryIntegrationPackageStorage.getInstance().addIntegration("Spring6GrahQLWebFlux"); | ||
| return sourceBuilderCustomizer(sentryProperties, true); | ||
| } | ||
|
|
||
| /** | ||
| * We're not setting defaultDataFetcherExceptionHandler here on purpose and instead use the | ||
| * resolver adapter below. This way Springs handler can still forward to other resolver adapters. | ||
| */ | ||
| private GraphQlSourceBuilderCustomizer sourceBuilderCustomizer( | ||
| final @NotNull SentryProperties sentryProperties, final boolean captureRequestBody) { | ||
| return (builder) -> | ||
| builder.configureGraphQl( | ||
| graphQlBuilder -> | ||
| graphQlBuilder.instrumentation( | ||
| new SentryInstrumentation( | ||
| null, | ||
| new SentrySpringSubscriptionHandler(), | ||
| captureRequestBody, | ||
| sentryProperties.getGraphql().getIgnoredErrorTypes()))); | ||
| } | ||
|
|
||
| @Bean | ||
| @Order(Ordered.HIGHEST_PRECEDENCE) | ||
| public SentryDataFetcherExceptionResolverAdapter exceptionResolverAdapter() { | ||
| return new SentryDataFetcherExceptionResolverAdapter(); | ||
| } | ||
|
|
||
| @Bean | ||
| public SentryGraphqlBeanPostProcessor graphqlBeanPostProcessor() { | ||
| return new SentryGraphqlBeanPostProcessor(); | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.