I'm utilizing Spring Boot 3 with starter validation / Jakarta Validation via the Controller methods, and @Valid and @Validated annotations, and am using actuator for metrics.
There is a lot of "Spring Magic" for free metrics with a lot of these spring boot libraries.
I was wondering, is there a metric available by default in spring boot 3 / spring boot starter validation, where I can see a metric for number of requests rejected (400 error) due to json serialization or validation error?
Basically I need a metric for # of 400 errors that occurred, where the request never entered the Controller due to a validation error or a serialization error. This is different from the request entering the controller, and then manually returning a 400 due to domain-level validation errors.
What I've tried:
- Starting the app and looking for validation metrics specifically via
localhost:8080/metrics. (don't see any) - Checking actuator documentation
If this isn't available by default, can I add a hook to the code for API level validation failures so that I can increment my own metric?
Thanks for any help finding existing/free spring boot metrics, or how to add one for this use case.