Skip to content

Commit

Permalink
Use KeyValue.NONE_VALUE where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
izeye authored and bclozel committed Oct 19, 2022
1 parent b7ee797 commit 5dca43e
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 22 deletions.
Expand Up @@ -16,6 +16,7 @@

package org.springframework.http.client.observation;

import io.micrometer.common.KeyValue;
import io.micrometer.common.docs.KeyName;
import io.micrometer.observation.Observation;
import io.micrometer.observation.ObservationConvention;
Expand Down Expand Up @@ -57,7 +58,7 @@ public KeyName[] getHighCardinalityKeyNames() {
public enum LowCardinalityKeyNames implements KeyName {

/**
* Name of HTTP request method or {@code "none"} if the request could not be created.
* Name of HTTP request method or {@value KeyValue#NONE_VALUE} if the request could not be created.
*/
METHOD {
@Override
Expand All @@ -68,7 +69,7 @@ public String asString() {
},

/**
* URI template used for HTTP request, or {@code "none"} if none was provided.
* URI template used for HTTP request, or {@value KeyValue#NONE_VALUE} if none was provided.
*/
URI {
@Override
Expand All @@ -89,7 +90,7 @@ public String asString() {
},

/**
* Name of the exception thrown during the exchange, or {@code "none"} if no exception happened.
* Name of the exception thrown during the exchange, or {@value KeyValue#NONE_VALUE} if no exception happened.
*/
EXCEPTION {
@Override
Expand Down
Expand Up @@ -37,9 +37,9 @@ public class DefaultClientRequestObservationConvention implements ClientRequestO

private static final String DEFAULT_NAME = "http.client.requests";

private static final KeyValue URI_NONE = KeyValue.of(ClientHttpObservationDocumentation.LowCardinalityKeyNames.URI, "none");
private static final KeyValue URI_NONE = KeyValue.of(ClientHttpObservationDocumentation.LowCardinalityKeyNames.URI, KeyValue.NONE_VALUE);

private static final KeyValue METHOD_NONE = KeyValue.of(ClientHttpObservationDocumentation.LowCardinalityKeyNames.METHOD, "none");
private static final KeyValue METHOD_NONE = KeyValue.of(ClientHttpObservationDocumentation.LowCardinalityKeyNames.METHOD, KeyValue.NONE_VALUE);

private static final KeyValue STATUS_IO_ERROR = KeyValue.of(ClientHttpObservationDocumentation.LowCardinalityKeyNames.STATUS, "IO_ERROR");

Expand All @@ -49,11 +49,11 @@ public class DefaultClientRequestObservationConvention implements ClientRequestO

private static final KeyValue HTTP_OUTCOME_UNKNOWN = KeyValue.of(ClientHttpObservationDocumentation.LowCardinalityKeyNames.OUTCOME, "UNKNOWN");

private static final KeyValue EXCEPTION_NONE = KeyValue.of(ClientHttpObservationDocumentation.LowCardinalityKeyNames.EXCEPTION, "none");
private static final KeyValue EXCEPTION_NONE = KeyValue.of(ClientHttpObservationDocumentation.LowCardinalityKeyNames.EXCEPTION, KeyValue.NONE_VALUE);

private static final KeyValue HTTP_URL_NONE = KeyValue.of(ClientHttpObservationDocumentation.HighCardinalityKeyNames.HTTP_URL, "none");
private static final KeyValue HTTP_URL_NONE = KeyValue.of(ClientHttpObservationDocumentation.HighCardinalityKeyNames.HTTP_URL, KeyValue.NONE_VALUE);

private static final KeyValue CLIENT_NAME_NONE = KeyValue.of(ClientHttpObservationDocumentation.HighCardinalityKeyNames.CLIENT_NAME, "none");
private static final KeyValue CLIENT_NAME_NONE = KeyValue.of(ClientHttpObservationDocumentation.HighCardinalityKeyNames.CLIENT_NAME, KeyValue.NONE_VALUE);


private final String name;
Expand Down
Expand Up @@ -48,7 +48,7 @@ public class DefaultServerRequestObservationConvention implements ServerRequestO

private static final KeyValue URI_REDIRECTION = KeyValue.of(ServerHttpObservationDocumentation.LowCardinalityKeyNames.URI, "REDIRECTION");

private static final KeyValue EXCEPTION_NONE = KeyValue.of(ServerHttpObservationDocumentation.LowCardinalityKeyNames.EXCEPTION, "none");
private static final KeyValue EXCEPTION_NONE = KeyValue.of(ServerHttpObservationDocumentation.LowCardinalityKeyNames.EXCEPTION, KeyValue.NONE_VALUE);

private static final KeyValue HTTP_URL_UNKNOWN = KeyValue.of(ServerHttpObservationDocumentation.HighCardinalityKeyNames.HTTP_URL, "UNKNOWN");

Expand Down
Expand Up @@ -16,6 +16,7 @@

package org.springframework.http.observation;

import io.micrometer.common.KeyValue;
import io.micrometer.common.docs.KeyName;
import io.micrometer.observation.Observation;
import io.micrometer.observation.ObservationConvention;
Expand Down Expand Up @@ -55,7 +56,7 @@ public KeyName[] getHighCardinalityKeyNames() {
public enum LowCardinalityKeyNames implements KeyName {

/**
* Name of HTTP request method or {@code "none"} if the request was not received properly.
* Name of HTTP request method or {@value KeyValue#NONE_VALUE} if the request was not received properly.
*/
METHOD {
@Override
Expand Down Expand Up @@ -88,7 +89,7 @@ public String asString() {
},

/**
* Name of the exception thrown during the exchange, or {@code "none"} if no exception happened.
* Name of the exception thrown during the exchange, or {@value KeyValue#NONE_VALUE}} if no exception happened.
*/
EXCEPTION {
@Override
Expand Down
Expand Up @@ -50,7 +50,7 @@ public class DefaultServerRequestObservationConvention implements ServerRequestO

private static final KeyValue URI_REDIRECTION = KeyValue.of(ServerHttpObservationDocumentation.LowCardinalityKeyNames.URI, "REDIRECTION");

private static final KeyValue EXCEPTION_NONE = KeyValue.of(ServerHttpObservationDocumentation.LowCardinalityKeyNames.EXCEPTION, "none");
private static final KeyValue EXCEPTION_NONE = KeyValue.of(ServerHttpObservationDocumentation.LowCardinalityKeyNames.EXCEPTION, KeyValue.NONE_VALUE);

private static final KeyValue HTTP_URL_UNKNOWN = KeyValue.of(ServerHttpObservationDocumentation.HighCardinalityKeyNames.HTTP_URL, "UNKNOWN");

Expand Down
Expand Up @@ -16,6 +16,7 @@

package org.springframework.http.observation.reactive;

import io.micrometer.common.KeyValue;
import io.micrometer.common.docs.KeyName;
import io.micrometer.observation.Observation;
import io.micrometer.observation.ObservationConvention;
Expand Down Expand Up @@ -55,7 +56,7 @@ public KeyName[] getHighCardinalityKeyNames() {
public enum LowCardinalityKeyNames implements KeyName {

/**
* Name of HTTP request method or {@code "none"} if the request was not received properly.
* Name of HTTP request method or {@value KeyValue#NONE_VALUE} if the request was not received properly.
*/
METHOD {
@Override
Expand Down Expand Up @@ -88,7 +89,7 @@ public String asString() {
},

/**
* Name of the exception thrown during the exchange, or {@code "none"} if no exception happened.
* Name of the exception thrown during the exchange, or {@value KeyValue#NONE_VALUE} if no exception happened.
*/
EXCEPTION {
@Override
Expand Down
Expand Up @@ -16,6 +16,7 @@

package org.springframework.web.reactive.function.client;

import io.micrometer.common.KeyValue;
import io.micrometer.common.docs.KeyName;
import io.micrometer.observation.Observation;
import io.micrometer.observation.ObservationConvention;
Expand Down Expand Up @@ -54,7 +55,7 @@ public KeyName[] getHighCardinalityKeyNames() {
public enum LowCardinalityKeyNames implements KeyName {

/**
* Name of HTTP request method or {@code "none"} if the request could not be created.
* Name of HTTP request method or {@value KeyValue#NONE_VALUE} if the request could not be created.
*/
METHOD {
@Override
Expand All @@ -65,7 +66,7 @@ public String asString() {
},

/**
* URI template used for HTTP request, or {@code "none"} if none was provided.
* URI template used for HTTP request, or {@value KeyValue#NONE_VALUE} if none was provided.
*/
URI {
@Override
Expand All @@ -86,7 +87,7 @@ public String asString() {
},

/**
* Name of the exception thrown during the exchange, or {@code "none"} if no exception happened.
* Name of the exception thrown during the exchange, or {@value KeyValue#NONE_VALUE} if no exception happened.
*/
EXCEPTION {
@Override
Expand Down
Expand Up @@ -36,9 +36,9 @@ public class DefaultClientRequestObservationConvention implements ClientRequestO

private static final String DEFAULT_NAME = "http.client.requests";

private static final KeyValue URI_NONE = KeyValue.of(ClientHttpObservationDocumentation.LowCardinalityKeyNames.URI, "none");
private static final KeyValue URI_NONE = KeyValue.of(ClientHttpObservationDocumentation.LowCardinalityKeyNames.URI, KeyValue.NONE_VALUE);

private static final KeyValue METHOD_NONE = KeyValue.of(ClientHttpObservationDocumentation.LowCardinalityKeyNames.METHOD, "none");
private static final KeyValue METHOD_NONE = KeyValue.of(ClientHttpObservationDocumentation.LowCardinalityKeyNames.METHOD, KeyValue.NONE_VALUE);

private static final KeyValue STATUS_IO_ERROR = KeyValue.of(ClientHttpObservationDocumentation.LowCardinalityKeyNames.STATUS, "IO_ERROR");

Expand All @@ -48,11 +48,11 @@ public class DefaultClientRequestObservationConvention implements ClientRequestO

private static final KeyValue HTTP_OUTCOME_UNKNOWN = KeyValue.of(ClientHttpObservationDocumentation.LowCardinalityKeyNames.OUTCOME, "UNKNOWN");

private static final KeyValue EXCEPTION_NONE = KeyValue.of(ClientHttpObservationDocumentation.LowCardinalityKeyNames.EXCEPTION, "none");
private static final KeyValue EXCEPTION_NONE = KeyValue.of(ClientHttpObservationDocumentation.LowCardinalityKeyNames.EXCEPTION, KeyValue.NONE_VALUE);

private static final KeyValue HTTP_URL_NONE = KeyValue.of(ClientHttpObservationDocumentation.HighCardinalityKeyNames.HTTP_URL, "none");
private static final KeyValue HTTP_URL_NONE = KeyValue.of(ClientHttpObservationDocumentation.HighCardinalityKeyNames.HTTP_URL, KeyValue.NONE_VALUE);

private static final KeyValue CLIENT_NAME_NONE = KeyValue.of(ClientHttpObservationDocumentation.HighCardinalityKeyNames.CLIENT_NAME, "none");
private static final KeyValue CLIENT_NAME_NONE = KeyValue.of(ClientHttpObservationDocumentation.HighCardinalityKeyNames.CLIENT_NAME, KeyValue.NONE_VALUE);

private final String name;

Expand Down

0 comments on commit 5dca43e

Please sign in to comment.