From 3d0621b4455fc23607a5ae0b859b0323da6146d2 Mon Sep 17 00:00:00 2001 From: Ciaran Moran Date: Wed, 21 Feb 2024 11:55:02 +0000 Subject: [PATCH] Update tag name to clientName --- .../micrometer/DefaultFeignObservationConvention.java | 5 ++--- .../feign/micrometer/FeignObservationDocumentation.java | 4 ++-- .../feign/micrometer/FeignHeaderInstrumentationTest.java | 9 ++++----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/micrometer/src/main/java/feign/micrometer/DefaultFeignObservationConvention.java b/micrometer/src/main/java/feign/micrometer/DefaultFeignObservationConvention.java index a5a5ecce0..ad76af129 100644 --- a/micrometer/src/main/java/feign/micrometer/DefaultFeignObservationConvention.java +++ b/micrometer/src/main/java/feign/micrometer/DefaultFeignObservationConvention.java @@ -35,8 +35,7 @@ public class DefaultFeignObservationConvention implements FeignObservationConven // There is no need to instantiate this class multiple times, but it may be extended, // hence protected visibility. - protected DefaultFeignObservationConvention() { - } + protected DefaultFeignObservationConvention() {} @Override public String getName() { @@ -58,7 +57,7 @@ public KeyValues getLowCardinalityKeyValues(FeignContext context) { .withValue(requestTemplate.methodMetadata().template().url()), FeignObservationDocumentation.HttpClientTags.STATUS .withValue(getStatusValue(context.getResponse())), - FeignObservationDocumentation.HttpClientTags.CLIENT + FeignObservationDocumentation.HttpClientTags.CLIENT_NAME .withValue(requestTemplate.feignTarget().type().getName())); } diff --git a/micrometer/src/main/java/feign/micrometer/FeignObservationDocumentation.java b/micrometer/src/main/java/feign/micrometer/FeignObservationDocumentation.java index 7f0033438..6bea04786 100644 --- a/micrometer/src/main/java/feign/micrometer/FeignObservationDocumentation.java +++ b/micrometer/src/main/java/feign/micrometer/FeignObservationDocumentation.java @@ -76,10 +76,10 @@ public String asString() { return "net.peer.port"; } }, - CLIENT { + CLIENT_NAME { @Override public String asString() { - return "client"; + return "clientName"; } } diff --git a/micrometer/src/test/java/feign/micrometer/FeignHeaderInstrumentationTest.java b/micrometer/src/test/java/feign/micrometer/FeignHeaderInstrumentationTest.java index cd245ec00..23a40b709 100644 --- a/micrometer/src/test/java/feign/micrometer/FeignHeaderInstrumentationTest.java +++ b/micrometer/src/test/java/feign/micrometer/FeignHeaderInstrumentationTest.java @@ -22,7 +22,6 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static com.github.tomakehurst.wiremock.client.WireMock.verify; import static org.assertj.core.api.Assertions.assertThat; - import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; import com.github.tomakehurst.wiremock.junit5.WireMockTest; import feign.AsyncFeign; @@ -101,7 +100,7 @@ private void assertTags() { assertMetricIdIncludesMethod(requestsId); assertMetricIdIncludesURI(requestsId); assertMetricIdIncludesStatus(requestsId); - assertsMetricIdIncludesClient(requestsId); + assertsMetricIdIncludesClientName(requestsId); } private void assertMetricIdIncludesMethod(Id metricId) { @@ -125,9 +124,9 @@ private void assertMetricIdIncludesStatus(Id metricId) { assertThat(tag).as("Expect status to be 200: " + metricId).isEqualTo("200"); } - private void assertsMetricIdIncludesClient(Id metricId) { - String tag = metricId.getTag("client"); - assertThat(tag).as("Expect all metric names to have tag 'client': " + metricId).isNotNull(); + private void assertsMetricIdIncludesClientName(Id metricId) { + String tag = metricId.getTag("clientName"); + assertThat(tag).as("Expect all metric names to have tag 'clientName': " + metricId).isNotNull(); assertThat(tag).as("Expect class to be present: " + metricId) .startsWith("feign.micrometer.FeignHeaderInstrumentationTest$"); assertThat(tag).endsWith("TestClient");