Browse Source

Replace Tag to KeyValues adapter code

Closes gh-32876
pull/32844/head
Moritz Halbritter 3 years ago
parent
commit
05c5b1225c
  1. 6
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/web/client/ClientHttpObservationConventionAdapter.java
  2. 6
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/web/client/ClientObservationConventionAdapter.java
  3. 6
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/web/reactive/ServerRequestObservationConventionAdapter.java
  4. 6
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/web/servlet/ServerRequestObservationConventionAdapter.java

6
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/web/client/ClientHttpObservationConventionAdapter.java

@ -46,11 +46,7 @@ class ClientHttpObservationConventionAdapter implements ClientRequestObservation @@ -46,11 +46,7 @@ class ClientHttpObservationConventionAdapter implements ClientRequestObservation
public KeyValues getLowCardinalityKeyValues(ClientRequestObservationContext context) {
Iterable<Tag> tags = this.tagsProvider.getTags(context.getUriTemplate(), context.getCarrier(),
context.getResponse());
KeyValues keyValues = KeyValues.empty();
for (Tag tag : tags) {
keyValues = keyValues.and(tag.getKey(), tag.getValue());
}
return keyValues;
return KeyValues.of(tags, Tag::getKey, Tag::getValue);
}
@Override

6
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/web/client/ClientObservationConventionAdapter.java

@ -57,11 +57,7 @@ class ClientObservationConventionAdapter implements ClientRequestObservationConv @@ -57,11 +57,7 @@ class ClientObservationConventionAdapter implements ClientRequestObservationConv
public KeyValues getLowCardinalityKeyValues(ClientRequestObservationContext context) {
mutateClientRequest(context);
Iterable<Tag> tags = this.tagsProvider.tags(context.getCarrier(), context.getResponse(), context.getError());
KeyValues keyValues = KeyValues.empty();
for (Tag tag : tags) {
keyValues = keyValues.and(tag.getKey(), tag.getValue());
}
return keyValues;
return KeyValues.of(tags, Tag::getKey, Tag::getValue);
}
private void mutateClientRequest(ClientRequestObservationContext context) {

6
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/web/reactive/ServerRequestObservationConventionAdapter.java

@ -59,11 +59,7 @@ class ServerRequestObservationConventionAdapter implements ServerRequestObservat @@ -59,11 +59,7 @@ class ServerRequestObservationConventionAdapter implements ServerRequestObservat
@Override
public KeyValues getLowCardinalityKeyValues(ServerRequestObservationContext context) {
Iterable<Tag> tags = this.tagsProvider.httpRequestTags(context.getServerWebExchange(), context.getError());
KeyValues keyValues = KeyValues.empty();
for (Tag tag : tags) {
keyValues = keyValues.and(tag.getKey(), tag.getValue());
}
return keyValues;
return KeyValues.of(tags, Tag::getKey, Tag::getValue);
}
}

6
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/web/servlet/ServerRequestObservationConventionAdapter.java

@ -66,11 +66,7 @@ class ServerRequestObservationConventionAdapter implements ServerRequestObservat @@ -66,11 +66,7 @@ class ServerRequestObservationConventionAdapter implements ServerRequestObservat
public KeyValues getLowCardinalityKeyValues(ServerRequestObservationContext context) {
Iterable<Tag> tags = this.tagsProvider.getTags(context.getCarrier(), context.getResponse(), getHandler(context),
context.getError());
KeyValues keyValues = KeyValues.empty();
for (Tag tag : tags) {
keyValues = keyValues.and(tag.getKey(), tag.getValue());
}
return keyValues;
return KeyValues.of(tags, Tag::getKey, Tag::getValue);
}
private Object getHandler(ServerRequestObservationContext context) {

Loading…
Cancel
Save