ryantenney / metrics-spring

Spring integration for Metrics
http://www.ryantenney.com/metrics-spring/
Apache License 2.0
701 stars 226 forks source link

Timing futures #209

Open tstavinoha opened 7 years ago

tstavinoha commented 7 years ago

Hi! Spring MVC supports returning CompletableFuture from controllers. Behind the scenes, it will wait for those futures to complete and return the response. However, the only thing that we can annotate are methods in the controller that return those futures, ending almost immediately, while the actual execution could take a significantly longer time.

What would be a good way to time the actual execution time of those CompletableFutures? Could the project somehow be changed to differentiate returning of regular objects and completable futures and optionally measure total execution time for futures?

Br,