Record User Information
Recording user information is available only in the Spring MVC integration.
Record user information from an HTTP request or by registering a Spring bean for custom user information capture.
To record the user's IP address and Principal#name
as the username, set the personal information flag to true
.
Copied
sentry.send-default-pii=true
To record custom user information, you can register a bean that implements SentryUserProvider
interface.
Copied
import org.springframework.stereotype.Component;
import io.sentry.protocol.User;
import io.sentry.spring.SentryUserProvider;
@Component
class CustomSentryUserProvider implements SentryUserProvider {
public User provideUser() {
User user = new User();
// ... set user information
return user
}
}
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").
- Package:
- maven:io.sentry:sentry-spring-boot-starter
- Version:
- 7.8.0
- Repository:
- https://github.com/getsentry/sentry-java
- API Documentation:
- https://javadoc.io/doc/io.sentry