Skip to content
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

Replace GraphQlSourceBuilderCustomizer with directly providing a SentryInstrumenter bean if missing #3744

Merged

Conversation

adinauer
Copy link
Member

@adinauer adinauer commented Oct 2, 2024

📜 Description

We now provide a SentryInstrumenter bean directly if there is none yet instead of using GraphQlSourceBuilderCustomizer to add the instrumentation.

It is now also possible to provide a bean of type SentryGraphqlInstrumentation.BeforeSpanCallback which is then used by SentryInstrumenter, e.g.:

  @Bean
  SentryGraphqlInstrumentation.BeforeSpanCallback beforeSpanGraphql() {
    return (
      @NotNull ISpan span, @NotNull DataFetchingEnvironment environment, @Nullable Object result) -> {
      span.setData("beforeSpanCallbackData", "hello world");
      return span;
    };
  }

💡 Motivation and Context

Closes #3412

💚 How did you test it?

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Copy link
Contributor

github-actions bot commented Oct 2, 2024

Fails
🚫 Please consider adding a changelog entry for the next release.
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

- Replace `GraphQlSourceBuilderCustomizer` with directly providing a `SentryInstrumenter` bean if missing ([#3744](https://github.com/getsentry/sentry-java/pull/3744))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.

Generated by 🚫 dangerJS against 7d0e25d

}

@Bean
@Bean(name = "sentryInstrumentation")
@ConditionalOnMissingBean(name = "sentryInstrumentation")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should change this to not rely on the bean name but rather the type SentryInstrumentation regardless of name.

Copy link
Collaborator

@lbloder lbloder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍, after the @ConditionalOnMissingBean() annotations have been changed to rely on type instead of name

Base automatically changed from fix/support-graphql-v22 to 8.x.x October 7, 2024 13:12
@adinauer adinauer merged commit 093ebc6 into 8.x.x Oct 7, 2024
3 of 4 checks passed
@adinauer adinauer deleted the feat/sentry-instrumentation-bean-instead-of-customizer branch October 7, 2024 13:20
Copy link
Contributor

github-actions bot commented Oct 7, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 420.79 ms 437.94 ms 17.15 ms
Size 1.70 MiB 2.35 MiB 669.06 KiB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants