Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Observation KeyValue inconsistency with Spring #2508

Open
sunruh opened this issue Aug 13, 2024 · 3 comments
Open

Observation KeyValue inconsistency with Spring #2508

sunruh opened this issue Aug 13, 2024 · 3 comments
Labels
help wanted Issues we need help with tackling

Comments

@sunruh
Copy link

sunruh commented Aug 13, 2024

Feign-Micrometer supplies observation integration through a Capability, creating an observation with the name http.client.requests, low-cardinality KeyNames are:

  • http.status_code
  • http.method
  • http.url
  • ...

Spring supplies observation integration for other "HTTP clients", like their own RestTemplate and WebClient, with the identical observation name but different KeyNames:

  • status
  • method
  • uri
  • ...

This causes problems in at least the Prometheus instrumentation of Micrometer as the list of KeyNames must be consistent across all regarding meters with the same name.

If they are not, the first one called wins (only it's KeyNames are valid from that point on) and any other observation (that has KeyNames not matching this first set) is being ignored. So when one starts up an application that one time first uses a RestTemplate and on a subsequent start an OpenFeign client, that makes a difference.

Very unsure how this could be solved properly.

  • Changing the KeyNames in feign-micrometer would be a breaking change for anyone relying on the current names and would require maintenance, aligning with further changes on Sping's side
  • Changing the (default) name of the observation would also be a breaking change, as a workaround already possible now as Spring Boot allows overriding the bean definition
  • Fix it in Spring Boot, changing the behavior of Micrometer-Feign completely, possibly rewriting everything there.
@gxdgodgxd
Copy link

facing the same issue. my solution for now is just renaming feign convention to "feign.http.client.requests"

@sunruh
Copy link
Author

sunruh commented Aug 21, 2024

We (as a temporary fix) created a MeterFilter that converts the tags set by feign-micrometer into the ones that Spring generates.

@kdavisk6 kdavisk6 added help wanted Issues we need help with tackling labels Sep 11, 2024
@Nazukin-Dmitry
Copy link
Contributor

As a workaround I created custom convention, which provides same key names like spring for WebClient/RestTemplate

https://gist.github.com/Nazukin-Dmitry/c020cf8c71adccde7186a89e5bad7989

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issues we need help with tackling
Projects
None yet
Development

No branches or pull requests

4 participants