diff --git a/reactor-netty-http/src/main/java/reactor/netty/http/client/HttpClient.java b/reactor-netty-http/src/main/java/reactor/netty/http/client/HttpClient.java index d53913f495..3d7ba7f28f 100644 --- a/reactor-netty-http/src/main/java/reactor/netty/http/client/HttpClient.java +++ b/reactor-netty-http/src/main/java/reactor/netty/http/client/HttpClient.java @@ -62,6 +62,8 @@ import reactor.netty.tcp.SslProvider; import reactor.netty.tcp.TcpClient; import reactor.netty.transport.ClientTransport; +import reactor.util.Logger; +import reactor.util.Loggers; import reactor.util.Metrics; import reactor.util.annotation.Nullable; @@ -1158,6 +1160,9 @@ public final HttpClient mapConnect( * For example instead of using the actual uri {@code "/users/1"} as uri tag value, templated uri * {@code "/users/{id}"} can be used. *

Note: + * It is strongly recommended to provide template-like form for the URIs. Without a conversion to a template-like form, + * each distinct URI leads to the creation of a distinct tag, which takes a lot of memory for the metrics. + *

Note: * It is strongly recommended applications to configure an upper limit for the number of the URI tags. * For example: *

@@ -1180,6 +1185,12 @@ public final HttpClient metrics(boolean enable, Function uriTagV
 						"To enable metrics, you must add the dependency `io.micrometer:micrometer-core`" +
 								" to the class path first");
 			}
+			if (uriTagValue == Function.identity()) {
+				log.debug("Metrics are enabled with [uriTagValue=Function#identity]. " +
+						"It is strongly recommended to provide template-like form for the URIs. " +
+						"Without a conversion to a template-like form, each distinct URI leads " +
+						"to the creation of a distinct tag, which takes a lot of memory for the metrics.");
+			}
 			HttpClient dup = duplicate();
 			dup.configuration().metricsRecorder(() -> configuration().defaultMetricsRecorder());
 			dup.configuration().uriTagValue = uriTagValue;
@@ -1582,6 +1593,8 @@ static String reactorNettyVersion() {
 		               .orElse("dev");
 	}
 
+	static final Logger log = Loggers.getLogger(HttpClient.class);
+
 	static final String HTTP_SCHEME = "http";
 
 	static final String HTTPS_SCHEME = "https";
diff --git a/reactor-netty-http/src/main/java/reactor/netty/http/server/HttpServer.java b/reactor-netty-http/src/main/java/reactor/netty/http/server/HttpServer.java
index ad0b26627f..2aa730f237 100644
--- a/reactor-netty-http/src/main/java/reactor/netty/http/server/HttpServer.java
+++ b/reactor-netty-http/src/main/java/reactor/netty/http/server/HttpServer.java
@@ -577,6 +577,9 @@ public final HttpServer maxKeepAliveRequests(int maxKeepAliveRequests) {
 	 * For example instead of using the actual uri {@code "/users/1"} as uri tag value, templated uri
 	 * {@code "/users/{id}"} can be used.
 	 * 

Note: + * It is strongly recommended to provide template-like form for the URIs. Without a conversion to a template-like form, + * each distinct URI leads to the creation of a distinct tag, which takes a lot of memory for the metrics. + *

Note: * It is strongly recommended applications to configure an upper limit for the number of the URI tags. * For example: *

@@ -599,6 +602,12 @@ public final HttpServer metrics(boolean enable, Function uriTagV
 						"To enable metrics, you must add the dependency `io.micrometer:micrometer-core`" +
 								" to the class path first");
 			}
+			if (uriTagValue == Function.identity()) {
+				log.debug("Metrics are enabled with [uriTagValue=Function#identity]. " +
+						"It is strongly recommended to provide template-like form for the URIs. " +
+						"Without a conversion to a template-like form, each distinct URI leads " +
+						"to the creation of a distinct tag, which takes a lot of memory for the metrics.");
+			}
 			HttpServer dup = duplicate();
 			dup.configuration().metricsRecorder(() -> configuration().defaultMetricsRecorder());
 			dup.configuration().uriTagValue = uriTagValue;