Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use KeyValue.NONE_VALUE where possible #29342

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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