Skip to content

Automatically use SentryOptions.Logs.BeforeSendLogCallback Spring beans #4509

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

Merged
merged 20 commits into from
Jun 25, 2025

Conversation

adinauer
Copy link
Member

📜 Description

Automatically wire up spring beans of type SentryOptions.Logs.BeforeSendLogCallback into Sentry configuration.

  @Bean
  public SentryOptions.Logs.BeforeSendLogCallback beforeSendLogs() {
    return (log) -> {
      if (log.getBody().contains("purchase")) {
        return null;
      }
      return log;
    };
  }

💡 Motivation and Context

Makes it easier to use Sentry Logs with Spring Boot

💚 How did you test it?

📝 Checklist

  • 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.
  • I updated the wizard 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 Jun 23, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 1f508a6

Copy link
Contributor

github-actions bot commented Jun 23, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 417.24 ms 465.96 ms 48.72 ms
Size 1.58 MiB 2.09 MiB 519.08 KiB

Previous results on branch: feat/spring-boot-before-send-log

Startup times

Revision Plain With Sentry Diff
6c25e3a 383.16 ms 413.46 ms 30.30 ms

App size

Revision Plain With Sentry Diff
6c25e3a 1.58 MiB 2.09 MiB 518.85 KiB

Copy link
Member

@lcian lcian left a comment

Choose a reason for hiding this comment

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

Looks good to me

Base automatically changed from feat/logback-spring-boot to main June 25, 2025 07:24
@adinauer adinauer merged commit 1528dfb into main Jun 25, 2025
34 checks passed
@adinauer adinauer deleted the feat/spring-boot-before-send-log branch June 25, 2025 07:51
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