From dbeeec23259dc6e0bfa84ede6201bcd84fa2ad45 Mon Sep 17 00:00:00 2001 From: Mateusz Rzeszutek Date: Mon, 9 Oct 2023 15:26:23 +0200 Subject: [PATCH 1/2] Update HTTP metrics' descriptions --- .../instrumenter/http/HttpClientExperimentalMetrics.java | 4 ++-- .../api/instrumenter/http/HttpClientMetrics.java | 2 +- .../instrumenter/http/HttpServerExperimentalMetrics.java | 6 +++--- .../api/instrumenter/http/HttpServerMetrics.java | 2 +- .../http/HttpServerExperimentalMetricsTest.java | 2 -- .../HttpClientExperimentalMetricsStableSemconvTest.java | 2 ++ .../http/HttpClientMetricsStableSemconvTest.java | 1 + .../HttpServerExperimentalMetricsStableSemconvTest.java | 5 +++-- .../http/HttpServerMetricsStableSemconvTest.java | 1 + 9 files changed, 14 insertions(+), 11 deletions(-) diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientExperimentalMetrics.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientExperimentalMetrics.java index f9c57d75cefa..84c07318753e 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientExperimentalMetrics.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientExperimentalMetrics.java @@ -53,7 +53,7 @@ private HttpClientExperimentalMetrics(Meter meter) { meter .histogramBuilder("http.client.request.size") .setUnit("By") - .setDescription("The size of HTTP request messages") + .setDescription("Size of HTTP client request bodies.") .ofLongs(); HttpMetricsAdvice.applyClientRequestSizeAdvice(requestSizeBuilder); requestSize = requestSizeBuilder.build(); @@ -61,7 +61,7 @@ private HttpClientExperimentalMetrics(Meter meter) { meter .histogramBuilder("http.client.response.size") .setUnit("By") - .setDescription("The size of HTTP response messages") + .setDescription("Size of HTTP client response bodies.") .ofLongs(); HttpMetricsAdvice.applyClientRequestSizeAdvice(responseSizeBuilder); responseSize = responseSizeBuilder.build(); diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientMetrics.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientMetrics.java index d368fbbb491f..5e61b9046d25 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientMetrics.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientMetrics.java @@ -53,7 +53,7 @@ private HttpClientMetrics(Meter meter) { if (SemconvStability.emitStableHttpSemconv()) { DoubleHistogramBuilder stableDurationBuilder = createStableDurationHistogramBuilder( - meter, "http.client.request.duration", "The duration of the outbound HTTP request"); + meter, "http.client.request.duration", "Duration of HTTP client requests."); HttpMetricsAdvice.applyStableClientDurationAdvice(stableDurationBuilder); stableDuration = stableDurationBuilder.build(); } else { diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerExperimentalMetrics.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerExperimentalMetrics.java index 79543de1ba07..39150ce3cacf 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerExperimentalMetrics.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerExperimentalMetrics.java @@ -58,14 +58,14 @@ private HttpServerExperimentalMetrics(Meter meter) { meter .upDownCounterBuilder("http.server.active_requests") .setUnit("{requests}") - .setDescription("The number of concurrent HTTP requests that are currently in-flight"); + .setDescription("Number of active HTTP server requests."); HttpMetricsAdvice.applyServerActiveRequestsAdvice(activeRequestsBuilder); activeRequests = activeRequestsBuilder.build(); LongHistogramBuilder requestSizeBuilder = meter .histogramBuilder("http.server.request.size") .setUnit("By") - .setDescription("The size of HTTP request messages") + .setDescription("Size of HTTP server request bodies.") .ofLongs(); HttpMetricsAdvice.applyServerRequestSizeAdvice(requestSizeBuilder); requestSize = requestSizeBuilder.build(); @@ -73,7 +73,7 @@ private HttpServerExperimentalMetrics(Meter meter) { meter .histogramBuilder("http.server.response.size") .setUnit("By") - .setDescription("The size of HTTP response messages") + .setDescription("Size of HTTP server response bodies.") .ofLongs(); HttpMetricsAdvice.applyServerRequestSizeAdvice(responseSizeBuilder); responseSize = responseSizeBuilder.build(); diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerMetrics.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerMetrics.java index 13cbd7b725ce..4c53a47c620c 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerMetrics.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerMetrics.java @@ -53,7 +53,7 @@ private HttpServerMetrics(Meter meter) { if (SemconvStability.emitStableHttpSemconv()) { DoubleHistogramBuilder stableDurationBuilder = createStableDurationHistogramBuilder( - meter, "http.server.request.duration", "The duration of the inbound HTTP request"); + meter, "http.server.request.duration", "Duration of HTTP server requests."); HttpMetricsAdvice.applyStableServerDurationAdvice(stableDurationBuilder); stableDuration = stableDurationBuilder.build(); } else { diff --git a/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerExperimentalMetricsTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerExperimentalMetricsTest.java index 5507de000e2c..e9a16d9bdba6 100644 --- a/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerExperimentalMetricsTest.java +++ b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerExperimentalMetricsTest.java @@ -79,8 +79,6 @@ void collectsMetrics() { metric -> assertThat(metric) .hasName("http.server.active_requests") - .hasDescription( - "The number of concurrent HTTP requests that are currently in-flight") .hasUnit("{requests}") .hasLongSumSatisfying( sum -> diff --git a/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientExperimentalMetricsStableSemconvTest.java b/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientExperimentalMetricsStableSemconvTest.java index c3def5c219bc..37a95d3ac8a1 100644 --- a/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientExperimentalMetricsStableSemconvTest.java +++ b/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientExperimentalMetricsStableSemconvTest.java @@ -81,6 +81,7 @@ void collectsMetrics() { assertThat(metric) .hasName("http.client.request.size") .hasUnit("By") + .hasDescription("Size of HTTP client request bodies.") .hasHistogramSatisfying( histogram -> histogram.hasPointsSatisfying( @@ -109,6 +110,7 @@ void collectsMetrics() { assertThat(metric) .hasName("http.client.response.size") .hasUnit("By") + .hasDescription("Size of HTTP client response bodies.") .hasHistogramSatisfying( histogram -> histogram.hasPointsSatisfying( diff --git a/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientMetricsStableSemconvTest.java b/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientMetricsStableSemconvTest.java index abe819dd15fb..e35ec8f9c049 100644 --- a/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientMetricsStableSemconvTest.java +++ b/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientMetricsStableSemconvTest.java @@ -83,6 +83,7 @@ void collectsMetrics() { assertThat(metric) .hasName("http.client.request.duration") .hasUnit("s") + .hasDescription("Duration of HTTP client requests.") .hasHistogramSatisfying( histogram -> histogram.hasPointsSatisfying( diff --git a/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerExperimentalMetricsStableSemconvTest.java b/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerExperimentalMetricsStableSemconvTest.java index 16c719c38e74..1a96811b8f54 100644 --- a/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerExperimentalMetricsStableSemconvTest.java +++ b/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerExperimentalMetricsStableSemconvTest.java @@ -78,9 +78,8 @@ void collectsMetrics() { metric -> assertThat(metric) .hasName("http.server.active_requests") - .hasDescription( - "The number of concurrent HTTP requests that are currently in-flight") .hasUnit("{requests}") + .hasDescription("Number of active HTTP server requests.") .hasLongSumSatisfying( sum -> sum.hasPointsSatisfying( @@ -144,6 +143,7 @@ void collectsMetrics() { assertThat(metric) .hasName("http.server.request.size") .hasUnit("By") + .hasDescription("Size of HTTP server request bodies.") .hasHistogramSatisfying( histogram -> histogram.hasPointsSatisfying( @@ -168,6 +168,7 @@ void collectsMetrics() { assertThat(metric) .hasName("http.server.response.size") .hasUnit("By") + .hasDescription("Size of HTTP server response bodies.") .hasHistogramSatisfying( histogram -> histogram.hasPointsSatisfying( diff --git a/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerMetricsStableSemconvTest.java b/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerMetricsStableSemconvTest.java index e2ed2cb950be..8b5d47b04016 100644 --- a/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerMetricsStableSemconvTest.java +++ b/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerMetricsStableSemconvTest.java @@ -85,6 +85,7 @@ void collectsMetrics() { metric -> assertThat(metric) .hasName("http.server.request.duration") + .hasDescription("Duration of HTTP server requests.") .hasUnit("s") .hasHistogramSatisfying( histogram -> From cb57a56e0d2b6730623b2c269bd1f8e4f09efec4 Mon Sep 17 00:00:00 2001 From: Mateusz Rzeszutek Date: Mon, 9 Oct 2023 16:29:45 +0200 Subject: [PATCH 2/2] http server/client tests --- .../testing/junit/http/AbstractHttpClientTest.java | 6 +++++- .../testing/junit/http/AbstractHttpServerTest.java | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpClientTest.java b/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpClientTest.java index 50d4ef081ea2..8802434b7b5f 100644 --- a/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpClientTest.java +++ b/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpClientTest.java @@ -731,6 +731,10 @@ void httpClientMetrics() throws Exception { SemconvStability.emitStableHttpSemconv() ? "http.client.request.duration" : "http.client.duration"; + String durationInstrumentDescription = + SemconvStability.emitStableHttpSemconv() + ? "Duration of HTTP client requests." + : "The duration of the outbound HTTP request"; testing.waitAndAssertMetrics( instrumentationName.get(), @@ -739,7 +743,7 @@ void httpClientMetrics() throws Exception { metrics.anySatisfy( metric -> assertThat(metric) - .hasDescription("The duration of the outbound HTTP request") + .hasDescription(durationInstrumentDescription) .hasUnit(SemconvStability.emitStableHttpSemconv() ? "s" : "ms") .hasHistogramSatisfying( histogram -> diff --git a/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpServerTest.java b/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpServerTest.java index 01ded41360f9..40b6f9fa0ae1 100644 --- a/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpServerTest.java +++ b/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpServerTest.java @@ -346,6 +346,10 @@ void httpServerMetrics() { SemconvStability.emitStableHttpSemconv() ? "http.server.request.duration" : "http.server.duration"; + String durationInstrumentDescription = + SemconvStability.emitStableHttpSemconv() + ? "Duration of HTTP server requests." + : "The duration of the inbound HTTP request"; String metricsInstrumentationName = options.metricsInstrumentationName.get(); if (metricsInstrumentationName == null) { @@ -358,7 +362,7 @@ void httpServerMetrics() { metrics.anySatisfy( metric -> assertThat(metric) - .hasDescription("The duration of the inbound HTTP request") + .hasDescription(durationInstrumentDescription) .hasUnit(SemconvStability.emitStableHttpSemconv() ? "s" : "ms") .hasHistogramSatisfying( histogram ->