OpenFeign / feign

Feign makes writing java http clients easier
Apache License 2.0
9.47k stars 1.92k forks source link

Expose Original Interface Details in Request object #678

Open magrossi opened 6 years ago

magrossi commented 6 years ago

It would be great to be able access the original method's metadata (i.e. the method's name and potential custom annotations) defined in the interface in the Feign.Request object.

This would be especially useful when instrumenting Feign to do OpenTracing or Micrometer for example. From a REST perspective this will add value if you want to group all your metrics based on the original method name rather than the final URL that might contain a lot of path parameters and be too specific. From a SOAP perspective (where the URL is usually constant, only the body changes) this becomes invaluable as you can use the original interface method name as your identifier.

There are some attempts at doing this (ie. https://github.com/mwiede/metrics-feign/) but if you check the implementation, it has to go through hoops to achieve it because there are no easy integration options available. If this was freely available in all touch points via the Request object this would be a great.

slavaboiko commented 6 years ago

I would like it as well, does anyone have objections?

velo commented 6 years ago

Nop, sounds really fair in my opinion.

kdavisk6 commented 6 years ago

sounds like someone has volunteered a PR 😄