sentry-docs
sentry-docs copied to clipboard
spring-boot/record-user page shoud mention that SentryUserProvider works only in web-app mode
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/
Another option is to implement SentryUserProvider registration in all modes, but it is a not "docs" issue, i guess.
Routing to @getsentry/team-mobile for triage. ⏲️
Thanks for opening the issue @nixel2007. @adinauer should be able to help you out during this week.
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
@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 https://github.com/getsentry/sentry-java/pull/1430#issuecomment-826753354).
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/
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.
Status changed based on the above. Please let me know if it should be updated to something else!
Routing to @getsentry/product-owners-sdks-web-backend for triage ⏲️