diff --git a/micrometer-commons/src/main/java/io/micrometer/common/KeyValue.java b/micrometer-commons/src/main/java/io/micrometer/common/KeyValue.java index 0d59132cc8..83fae2d3b8 100644 --- a/micrometer-commons/src/main/java/io/micrometer/common/KeyValue.java +++ b/micrometer-commons/src/main/java/io/micrometer/common/KeyValue.java @@ -57,6 +57,24 @@ static KeyValue of(KeyName keyName, String value) { return KeyValue.of(keyName.asString(), value); } + /** + * Creates a {@link KeyValue} for the given key and {@value NONE_VALUE}. + * @param key key of the KeyValue + * @return KeyValue + */ + static KeyValue of(String key) { + return of(key, NONE_VALUE); + } + + /** + * Creates a {@link KeyValue} for the given {@link KeyName} and {@value NONE_VALUE}. + * @param keyName name of the key of the KeyValue + * @return KeyValue + */ + static KeyValue of(KeyName keyName) { + return of(keyName, NONE_VALUE); + } + /** * Creates a {@link KeyValue} for the given key and value and additionally validates * it with the {@link Predicate}.