opentelemetry-instrumentation-urllib: add explicit http duration buckets for stable semconv (#3519)
* opentelemetry-instrumentation-urllib: add explicit http duration buckets for stable semconv * Update CHANGELOG.md --------- Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
This commit is contained in:
parent
df275921a9
commit
1953d97958
|
|
@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
- `opentelemetry-instrumentation-fastapi`: fix wrapping of middlewares
|
||||
([#3012](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3012))
|
||||
- `opentelemetry-instrumentation-urllib`: proper bucket boundaries in stable semconv http duration metrics
|
||||
([#3519](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3519))
|
||||
- `opentelemetry-instrumentation-falcon`: proper bucket boundaries in stable semconv http duration
|
||||
([#3525](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3525))
|
||||
- `opentelemetry-instrumentation-wsgi`: add explicit http duration buckets for stable semconv
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ from urllib.request import ( # pylint: disable=no-name-in-module,import-error
|
|||
)
|
||||
|
||||
from opentelemetry.instrumentation._semconv import (
|
||||
HTTP_DURATION_HISTOGRAM_BUCKETS_NEW,
|
||||
_client_duration_attrs_new,
|
||||
_client_duration_attrs_old,
|
||||
_filter_semconv_duration_attrs,
|
||||
|
|
@ -434,6 +435,7 @@ def _create_client_histograms(
|
|||
name=HTTP_CLIENT_REQUEST_DURATION,
|
||||
unit="s",
|
||||
description="Duration of HTTP client requests.",
|
||||
explicit_bucket_boundaries_advisory=HTTP_DURATION_HISTOGRAM_BUCKETS_NEW,
|
||||
)
|
||||
histograms[HTTP_CLIENT_REQUEST_BODY_SIZE] = (
|
||||
create_http_client_request_body_size(meter)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import httpretty
|
|||
from pytest import mark
|
||||
|
||||
from opentelemetry.instrumentation._semconv import (
|
||||
HTTP_DURATION_HISTOGRAM_BUCKETS_NEW,
|
||||
OTEL_SEMCONV_STABILITY_OPT_IN,
|
||||
_OpenTelemetrySemanticConventionStability,
|
||||
)
|
||||
|
|
@ -76,10 +77,17 @@ class TestUrllibMetricsInstrumentation(TestBase):
|
|||
httpretty.disable()
|
||||
|
||||
# Return Sequence with one histogram
|
||||
def create_histogram_data_points(self, sum_data_point, attributes):
|
||||
def create_histogram_data_points(
|
||||
self, sum_data_point, attributes, explicit_bounds=None
|
||||
):
|
||||
return [
|
||||
self.create_histogram_data_point(
|
||||
sum_data_point, 1, sum_data_point, sum_data_point, attributes
|
||||
sum_data_point,
|
||||
1,
|
||||
sum_data_point,
|
||||
sum_data_point,
|
||||
attributes,
|
||||
explicit_bounds=explicit_bounds,
|
||||
)
|
||||
]
|
||||
|
||||
|
|
@ -176,6 +184,7 @@ class TestUrllibMetricsInstrumentation(TestBase):
|
|||
"http.request.method": "GET",
|
||||
"network.protocol.version": "1.1",
|
||||
},
|
||||
explicit_bounds=HTTP_DURATION_HISTOGRAM_BUCKETS_NEW,
|
||||
),
|
||||
est_value_delta=40,
|
||||
)
|
||||
|
|
@ -295,6 +304,7 @@ class TestUrllibMetricsInstrumentation(TestBase):
|
|||
"http.request.method": "GET",
|
||||
"network.protocol.version": "1.1",
|
||||
},
|
||||
explicit_bounds=HTTP_DURATION_HISTOGRAM_BUCKETS_NEW,
|
||||
),
|
||||
est_value_delta=40,
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue