Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ default KeyValue withValue(String value) {
return KeyValue.of(this, value);
}

/**
* Creates a key value for the given key name with {@value KeyValue#NONE_VALUE}.
* @return key value
*/
default KeyValue withoutValue() {
return KeyValue.of(this, KeyValue.NONE_VALUE);
}

/**
* Creates a key value for the given key name.
* @param value value for key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class DefaultApacheHttpClientObservationConvention implements ApacheHttpC

private static final KeyValue STATUS_CLIENT_ERROR = ApacheHttpClientKeyNames.STATUS.withValue("CLIENT_ERROR");

private static final KeyValue EXCEPTION_NONE = ApacheHttpClientKeyNames.EXCEPTION.withValue(KeyValue.NONE_VALUE);
private static final KeyValue EXCEPTION_NONE = ApacheHttpClientKeyNames.EXCEPTION.withoutValue();

private static final KeyValue OUTCOME_UNKNOWN = ApacheHttpClientKeyNames.OUTCOME.withValue(Outcome.UNKNOWN.name());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package io.micrometer.core.instrument.binder.httpcomponents.hc5;

import io.micrometer.common.KeyValue;
import org.apache.hc.client5.http.HttpRoute;
import org.apache.hc.client5.http.async.methods.SimpleHttpRequest;
import org.apache.hc.client5.http.async.methods.SimpleHttpResponse;
Expand Down Expand Up @@ -67,8 +66,7 @@ void shouldHaveDefaultContextName() {
void shouldContributeExceptionNoneWhenSuccess() {
HttpClientContext clientContext = HttpClientContext.create();
ApacheHttpClientContext context = new ApacheHttpClientContext(null, clientContext);
assertThat(observationConvention.getLowCardinalityKeyValues(context))
.contains(EXCEPTION.withValue(KeyValue.NONE_VALUE));
assertThat(observationConvention.getLowCardinalityKeyValues(context)).contains(EXCEPTION.withoutValue());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package io.micrometer.core.instrument.binder.httpcomponents.hc5;

import io.micrometer.common.KeyValue;
import io.micrometer.common.lang.Nullable;
import io.micrometer.observation.tck.TestObservationRegistry;
import org.apache.hc.client5.http.HttpRoute;
Expand Down Expand Up @@ -165,7 +164,7 @@ void shouldInstrumentCancelledRequests() throws Exception {
assertThat(observationRegistry).hasObservationWithNameEqualTo("httpcomponents.httpclient.request")
.that()
.hasLowCardinalityKeyValue(OUTCOME.withValue("UNKNOWN"))
.hasLowCardinalityKeyValue(EXCEPTION.withValue(KeyValue.NONE_VALUE));
.hasLowCardinalityKeyValue(EXCEPTION.withoutValue());
}

}
Expand Down