spring-data-commons icon indicating copy to clipboard operation
spring-data-commons copied to clipboard

Provide invocation arguments for RepositoryMethodInvocation

Open roookeee opened this issue 3 years ago • 2 comments

RepositoryTagsProvider of spring-boot-actuator is based on RepositoryMethodInvocation which is defined here. We would like to tag our repository metrics based on the passed arguments to provide more granular metrics. For example: We have a query that takes a List<String> and we want to track metrics for each size of the given parameter, as the query has / may have difference performance characteristics when being passed 1 vs. 100 ids. This would skew the gathered metrics and overall make the metrics unusable as they can't be interpreted correctly (1 size calls skews min, 100 skews max, average is a hot mess).

From reading the code RepositoryMethodInvocation could be passed the arguments of the actual invocation which would then be available to the RepositoryTagsProvider. Is there any downside to this? Are the arguments only the repository method call arguments or are there some framework related arguments present?

Thank you for your time. I would be willing to do a PR for this if you agree that this should be done.

roookeee avatar Aug 18 '22 11:08 roookeee

Generally speaking, providing arguments would be possible but any argument-post-processing (unwrapping Optional, Future) would be up to your code. Also, any reactive arguments (Mono<Person>) would be passed on as-is and you are not able to consume those parameters in an non-blocking way.

Feel free to submit a pull request.

mp911de avatar Aug 18 '22 12:08 mp911de

I created a PR for this issue here. Let me know if you want any adjustments via comments in there

roookeee avatar Aug 26 '22 07:08 roookeee