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

spring-boot/record-user page shoud mention that SentryUserProvider works only in web-app mode #5294

Open
nixel2007 opened this issue Jul 14, 2022 · 8 comments

Comments

@nixel2007
Copy link
Contributor

Core or SDK?

Platform/SDK

Which part? Which one?

Spring boot

Description

https://docs.sentry.io/platforms/java/guides/spring-boot/record-user page states that you could use SentryUserProvider bean for User custimization. But there is no information that this bean condinionaly loads only in web application mode - the only place where SentryUserProvider is used is the SentryWebMvcConfiguration with @ConditionalOnWebApplication.
I have a console spring boot app (WebEnvironment.NONE) and spend some time to figure it out :)

Suggested Solution

Add a note about ConditionalOnWebApplication/web app mode and provide a link to general doc https://docs.sentry.io/platforms/java/guides/spring-boot/enriching-events/identify-user/

@nixel2007
Copy link
Contributor Author

Another option is to implement SentryUserProvider registration in all modes, but it is a not "docs" issue, i guess.

@getsentry-release
Copy link
Contributor

Routing to @getsentry/team-mobile for triage. ⏲️

@philipphofmann
Copy link
Member

Thanks for opening the issue @nixel2007. @adinauer should be able to help you out during this week.

@nixel2007
Copy link
Contributor Author

hello @philipphofmann! I've already solved my task with custom bean with "conditional on bean + depends on": https://github.com/1c-syntax/bsl-language-server/blob/develop/src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/SentryScopeConfigurer.java#L42-L59

Just want to highlight this problem in docs

@adinauer
Copy link
Member

@nixel2007 thank you for reporting this.

Another option is to implement SentryUserProvider registration in all modes, but it is a not "docs" issue, i guess.

There used to be an EventProcessor that attached the user but we changed that to a OncePerRequestFilter based approach as the static utils (SecurityContextHolder, RequestContextHolder) we use no longer contain the user when a transaction is finished (see getsentry/sentry-java#1430 (comment)).

We have this note on the docs (see https://docs.sentry.io/platforms/java/guides/spring-boot/record-user/):

Recording user information is available only in the Spring MVC integration.

Maybe we should move the record user page into https://docs.sentry.io/platforms/java/guides/spring-boot/enriching-events/identify-user/

@nixel2007
Copy link
Contributor Author

nixel2007 commented Jul 19, 2022

Recording user information is available only in the Spring MVC integration

This block looks like it applies to "auto" mode. Like "if you use spring mvc, you'll get this shiny thing out of the box. But you always can define custom user info provider with that interface".

My bad, I know, but it is how i've read it for the first time.

@kerenkhatiwada
Copy link
Member

Status changed based on the above. Please let me know if it should be updated to something else!

@getsantry
Copy link
Contributor

getsantry bot commented Feb 27, 2024

Routing to @getsentry/product-owners-sdks-web-backend for triage ⏲️

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

No branches or pull requests

8 participants