Skip to content

Commit

Permalink
Merge #2593 into 2.0.0-M4
Browse files Browse the repository at this point in the history
  • Loading branch information
violetagg committed Nov 29, 2022
2 parents 1338a50 + aedc1d5 commit 9ac3216
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Expand Up @@ -61,6 +61,8 @@
import reactor.netty5.tcp.SslProvider;
import reactor.netty5.transport.ClientTransport;
import reactor.netty5.transport.ProxyProvider;
import reactor.util.Logger;
import reactor.util.Loggers;
import reactor.util.annotation.Nullable;

/**
Expand Down Expand Up @@ -1036,6 +1038,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.
* <p><strong>Note:</strong>
* 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.
* <p><strong>Note:</strong>
* It is strongly recommended applications to configure an upper limit for the number of the URI tags.
* For example:
* <pre class="code">
Expand All @@ -1058,6 +1063,12 @@ public final HttpClient metrics(boolean enable, Function<String, String> uriTagV
"To enable metrics, you must add the dependencies to `io.micrometer:micrometer-core`" +
" and `io.micrometer:micrometer-tracing` to the class path first");
}
if (uriTagValue == Function.<String>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;
Expand Down Expand Up @@ -1389,6 +1400,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";
Expand Down
Expand Up @@ -431,6 +431,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.
* <p><strong>Note:</strong>
* 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.
* <p><strong>Note:</strong>
* It is strongly recommended applications to configure an upper limit for the number of the URI tags.
* For example:
* <pre class="code">
Expand All @@ -453,6 +456,12 @@ public final HttpServer metrics(boolean enable, Function<String, String> uriTagV
"To enable metrics, you must add the dependencies to `io.micrometer:micrometer-core`" +
" and `io.micrometer:micrometer-tracing` to the class path first");
}
if (uriTagValue == Function.<String>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;
Expand Down

0 comments on commit 9ac3216

Please sign in to comment.