Skip to content

Commit

Permalink
Update tag name to clientName
Browse files Browse the repository at this point in the history
  • Loading branch information
iCiaran committed Feb 21, 2024
1 parent cdfafd1 commit 3d0621b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ public String asString() {
return "net.peer.port";
}
},
CLIENT {
CLIENT_NAME {
@Override
public String asString() {
return "client";
return "clientName";
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -101,7 +100,7 @@ private void assertTags() {
assertMetricIdIncludesMethod(requestsId);
assertMetricIdIncludesURI(requestsId);
assertMetricIdIncludesStatus(requestsId);
assertsMetricIdIncludesClient(requestsId);
assertsMetricIdIncludesClientName(requestsId);
}

private void assertMetricIdIncludesMethod(Id metricId) {
Expand All @@ -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");
Expand Down

0 comments on commit 3d0621b

Please sign in to comment.