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

Adds a client tag to the default micrometer observation #2333

Merged
merged 3 commits into from
Feb 29, 2024

Conversation

iCiaran
Copy link
Contributor

@iCiaran iCiaran commented Feb 21, 2024

Include a client tag on the default feign micrometer observation, so it's added to the http.client.requests meters, in the same way it's added to the feign.* meters.

This is useful for applications with more than one feign client, to avoid merging unrelated metrics, and improve observability of multiple downstreams which may have different latency etc

Opened to address #2332

Comment on lines 98 to 104
private void assertTags() {
Id requestsId = meterRegistry.get(METER_NAME).meter().getId();

assertMetricIdIncludesMethod(requestsId);
assertMetricIdIncludesURI(requestsId);
assertMetricIdIncludesStatus(requestsId);
assertsMetricIdIncludesClient(requestsId);
}
Copy link
Contributor Author

@iCiaran iCiaran Feb 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might not be the right place for these tests, however since they're only applicable to the micrometer observation meters adding to AbstractMetricsTestBase.java would require some changes to the dropwizard 4/5 and MicrometerCapability tests too so I've avoided that for now.

@iCiaran iCiaran force-pushed the observation-capability-client-tag branch from 4401f37 to 3d0621b Compare February 21, 2024 11:57
@velo velo merged commit d08dac0 into OpenFeign:master Feb 29, 2024
3 checks passed
@iCiaran iCiaran deleted the observation-capability-client-tag branch February 29, 2024 11:36
@@ -48,14 +49,16 @@ public String getContextualName(FeignContext context) {

@Override
public KeyValues getLowCardinalityKeyValues(FeignContext context) {
String templatedUrl = context.getCarrier().requestTemplate().methodMetadata().template().url();
RequestTemplate requestTemplate = context.getCarrier().requestTemplate();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey guys, just came across this PR, as I needed to include the client name and was writing a similar implementation, but noticed something in this change. Isn't context.getCarrier() nullable and shouldn't we check for null like it is done in getMethodString(@Nullable Request request) a bit further down?

velo pushed a commit that referenced this pull request Oct 7, 2024
* Add client tag to default micrometer observation

* Update license headers

* Update tag name to clientName
velo pushed a commit that referenced this pull request Oct 8, 2024
* Add client tag to default micrometer observation

* Update license headers

* Update tag name to clientName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants