Skip to content

Commit da3545e

Browse files
authored
Merge branch 'main' into instrument-transport-instead-of-client
2 parents 7095cd0 + 52ff7bd commit da3545e

File tree

30 files changed

+880
-710
lines changed

30 files changed

+880
-710
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
1212
## Unreleased
1313

14+
### Added
15+
16+
- `opentelemetry-instrumentation-confluent-kafka` Add support for confluent-kafka <=2.7.0
17+
([#3100](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3100))
18+
- Add support to database stability opt-in in `_semconv` utilities and add tests
19+
([#3111](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3111))
20+
21+
### Fixed
22+
23+
- `opentelemetry-instrumentation-httpx` Fix `RequestInfo`/`ResponseInfo` type hints
24+
([#3105](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3105))
1425
- `opentelemetry-instrumentation-httpx` Add the `is_instrumented` flag to the transport
1526
([#3106](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3106))
1627

28+
1729
## Version 1.29.0/0.50b0 (2024-12-11)
1830

1931
### Added

dev-requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ pytest==7.4.4
88
pytest-cov==4.1.0
99
readme-renderer==42.0
1010
bleach==4.1.0 # transient dependency for readme-renderer
11-
protobuf~=3.13
1211
markupsafe>=2.0.1
1312
codespell==2.1.0
1413
requests==2.32.3

docs/nitpick-exceptions.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ py-class=
2929
httpx.SyncByteStream
3030
httpx.AsyncByteStream
3131
httpx.Response
32+
httpx.URL
33+
httpx.Headers
3234
aiohttp.web_request.Request
3335
yarl.URL
3436
cimpl.Producer
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
openai~=1.54.4
1+
openai~=1.57.3
22

3-
opentelemetry-sdk~=1.28.2
4-
opentelemetry-exporter-otlp-proto-grpc~=1.28.2
3+
opentelemetry-sdk~=1.29.0
4+
opentelemetry-exporter-otlp-proto-grpc~=1.29.0
55
opentelemetry-instrumentation-openai-v2~=2.0b0
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
openai~=1.54.4
1+
openai~=1.57.3
22

3-
opentelemetry-sdk~=1.28.2
4-
opentelemetry-exporter-otlp-proto-grpc~=1.28.2
5-
opentelemetry-distro~=0.49b2
3+
opentelemetry-sdk~=1.29.0
4+
opentelemetry-exporter-otlp-proto-grpc~=1.29.0
5+
opentelemetry-distro~=0.50b0
66
opentelemetry-instrumentation-openai-v2~=2.0b0

instrumentation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
| [opentelemetry-instrumentation-cassandra](./opentelemetry-instrumentation-cassandra) | cassandra-driver ~= 3.25,scylla-driver ~= 3.25 | No | experimental
1717
| [opentelemetry-instrumentation-celery](./opentelemetry-instrumentation-celery) | celery >= 4.0, < 6.0 | No | experimental
1818
| [opentelemetry-instrumentation-click](./opentelemetry-instrumentation-click) | click >= 8.1.3, < 9.0.0 | No | experimental
19-
| [opentelemetry-instrumentation-confluent-kafka](./opentelemetry-instrumentation-confluent-kafka) | confluent-kafka >= 1.8.2, <= 2.4.0 | No | experimental
19+
| [opentelemetry-instrumentation-confluent-kafka](./opentelemetry-instrumentation-confluent-kafka) | confluent-kafka >= 1.8.2, <= 2.7.0 | No | experimental
2020
| [opentelemetry-instrumentation-dbapi](./opentelemetry-instrumentation-dbapi) | dbapi | No | experimental
2121
| [opentelemetry-instrumentation-django](./opentelemetry-instrumentation-django) | django >= 1.10 | Yes | experimental
2222
| [opentelemetry-instrumentation-elasticsearch](./opentelemetry-instrumentation-elasticsearch) | elasticsearch >= 6.0 | No | experimental

instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ def response_hook(span: Span, params: typing.Union[
9292
from opentelemetry import trace
9393
from opentelemetry.instrumentation._semconv import (
9494
_get_schema_url,
95-
_HTTPStabilityMode,
9695
_OpenTelemetrySemanticConventionStability,
9796
_OpenTelemetryStabilitySignalType,
9897
_report_new,
9998
_set_http_method,
10099
_set_http_url,
101100
_set_status,
101+
_StabilityMode,
102102
)
103103
from opentelemetry.instrumentation.aiohttp_client.package import _instruments
104104
from opentelemetry.instrumentation.aiohttp_client.version import __version__
@@ -142,7 +142,7 @@ def _set_http_status_code_attribute(
142142
span,
143143
status_code,
144144
metric_attributes=None,
145-
sem_conv_opt_in_mode=_HTTPStabilityMode.DEFAULT,
145+
sem_conv_opt_in_mode=_StabilityMode.DEFAULT,
146146
):
147147
status_code_str = str(status_code)
148148
try:
@@ -169,7 +169,7 @@ def create_trace_config(
169169
request_hook: _RequestHookT = None,
170170
response_hook: _ResponseHookT = None,
171171
tracer_provider: TracerProvider = None,
172-
sem_conv_opt_in_mode: _HTTPStabilityMode = _HTTPStabilityMode.DEFAULT,
172+
sem_conv_opt_in_mode: _StabilityMode = _StabilityMode.DEFAULT,
173173
) -> aiohttp.TraceConfig:
174174
"""Create an aiohttp-compatible trace configuration.
175175
@@ -326,7 +326,7 @@ def _instrument(
326326
trace_configs: typing.Optional[
327327
typing.Sequence[aiohttp.TraceConfig]
328328
] = None,
329-
sem_conv_opt_in_mode: _HTTPStabilityMode = _HTTPStabilityMode.DEFAULT,
329+
sem_conv_opt_in_mode: _StabilityMode = _StabilityMode.DEFAULT,
330330
):
331331
"""Enables tracing of all ClientSessions
332332

instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
from opentelemetry.instrumentation import aiohttp_client
3030
from opentelemetry.instrumentation._semconv import (
3131
OTEL_SEMCONV_STABILITY_OPT_IN,
32-
_HTTPStabilityMode,
3332
_OpenTelemetrySemanticConventionStability,
33+
_StabilityMode,
3434
)
3535
from opentelemetry.instrumentation.aiohttp_client import (
3636
AioHttpClientInstrumentor,
@@ -150,7 +150,7 @@ def test_status_codes_new_semconv(self):
150150
path = "test-path?query=param#foobar"
151151
host, port = self._http_request(
152152
trace_config=aiohttp_client.create_trace_config(
153-
sem_conv_opt_in_mode=_HTTPStabilityMode.HTTP
153+
sem_conv_opt_in_mode=_StabilityMode.HTTP
154154
),
155155
url=f"/{path}",
156156
status_code=status_code,
@@ -173,7 +173,7 @@ def test_status_codes_both_semconv(self):
173173
path = "test-path?query=param#foobar"
174174
host, port = self._http_request(
175175
trace_config=aiohttp_client.create_trace_config(
176-
sem_conv_opt_in_mode=_HTTPStabilityMode.HTTP_DUP
176+
sem_conv_opt_in_mode=_StabilityMode.HTTP_DUP
177177
),
178178
url=f"/{path}",
179179
status_code=status_code,
@@ -213,7 +213,7 @@ def test_schema_url_new_semconv(self):
213213
with self.subTest(status_code=200):
214214
self._http_request(
215215
trace_config=aiohttp_client.create_trace_config(
216-
sem_conv_opt_in_mode=_HTTPStabilityMode.HTTP
216+
sem_conv_opt_in_mode=_StabilityMode.HTTP
217217
),
218218
url="/test-path?query=param#foobar",
219219
status_code=200,
@@ -230,7 +230,7 @@ def test_schema_url_both_semconv(self):
230230
with self.subTest(status_code=200):
231231
self._http_request(
232232
trace_config=aiohttp_client.create_trace_config(
233-
sem_conv_opt_in_mode=_HTTPStabilityMode.HTTP_DUP
233+
sem_conv_opt_in_mode=_StabilityMode.HTTP_DUP
234234
),
235235
url="/test-path?query=param#foobar",
236236
status_code=200,
@@ -398,7 +398,7 @@ async def request_handler(request):
398398

399399
host, port = self._http_request(
400400
trace_config=aiohttp_client.create_trace_config(
401-
sem_conv_opt_in_mode=_HTTPStabilityMode.HTTP
401+
sem_conv_opt_in_mode=_StabilityMode.HTTP
402402
),
403403
url="/test",
404404
request_handler=request_handler,
@@ -426,7 +426,7 @@ async def request_handler(request):
426426

427427
host, port = self._http_request(
428428
trace_config=aiohttp_client.create_trace_config(
429-
sem_conv_opt_in_mode=_HTTPStabilityMode.HTTP_DUP
429+
sem_conv_opt_in_mode=_StabilityMode.HTTP_DUP
430430
),
431431
url="/test",
432432
request_handler=request_handler,
@@ -546,7 +546,7 @@ async def do_request(url):
546546
def test_nonstandard_http_method_new_semconv(self):
547547
trace_configs = [
548548
aiohttp_client.create_trace_config(
549-
sem_conv_opt_in_mode=_HTTPStabilityMode.HTTP
549+
sem_conv_opt_in_mode=_StabilityMode.HTTP
550550
)
551551
]
552552
app = HttpServerMock("nonstandard_method")

instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ def client_response_hook(span: Span, scope: dict[str, Any], message: dict[str, A
205205
_filter_semconv_active_request_count_attr,
206206
_filter_semconv_duration_attrs,
207207
_get_schema_url,
208-
_HTTPStabilityMode,
209208
_OpenTelemetrySemanticConventionStability,
210209
_OpenTelemetryStabilitySignalType,
211210
_report_new,
@@ -225,6 +224,7 @@ def client_response_hook(span: Span, scope: dict[str, Any], message: dict[str, A
225224
_set_http_url,
226225
_set_http_user_agent,
227226
_set_status,
227+
_StabilityMode,
228228
)
229229
from opentelemetry.instrumentation.asgi.types import (
230230
ClientRequestHook,
@@ -324,7 +324,7 @@ def set(self, carrier: dict, key: str, value: str) -> None: # pylint: disable=n
324324

325325
# pylint: disable=too-many-branches
326326
def collect_request_attributes(
327-
scope, sem_conv_opt_in_mode=_HTTPStabilityMode.DEFAULT
327+
scope, sem_conv_opt_in_mode=_StabilityMode.DEFAULT
328328
):
329329
"""Collects HTTP request attributes from the ASGI scope and returns a
330330
dictionary to be used as span creation attributes."""
@@ -356,7 +356,7 @@ def collect_request_attributes(
356356
_set_http_url(
357357
result,
358358
remove_url_credentials(http_url),
359-
_HTTPStabilityMode.DEFAULT,
359+
_StabilityMode.DEFAULT,
360360
)
361361
http_method = scope.get("method", "")
362362
if http_method:
@@ -439,7 +439,7 @@ def set_status_code(
439439
span,
440440
status_code,
441441
metric_attributes=None,
442-
sem_conv_opt_in_mode=_HTTPStabilityMode.DEFAULT,
442+
sem_conv_opt_in_mode=_StabilityMode.DEFAULT,
443443
):
444444
"""Adds HTTP response attributes to span using the status_code argument."""
445445
status_code_str = str(status_code)
@@ -755,12 +755,12 @@ async def __call__(
755755
)
756756
duration_s = default_timer() - start
757757
duration_attrs_old = _parse_duration_attrs(
758-
attributes, _HTTPStabilityMode.DEFAULT
758+
attributes, _StabilityMode.DEFAULT
759759
)
760760
if target:
761761
duration_attrs_old[SpanAttributes.HTTP_TARGET] = target
762762
duration_attrs_new = _parse_duration_attrs(
763-
attributes, _HTTPStabilityMode.HTTP
763+
attributes, _StabilityMode.HTTP
764764
)
765765
if self.duration_histogram_old:
766766
self.duration_histogram_old.record(
@@ -960,7 +960,7 @@ async def otel_send(message: dict[str, Any]):
960960

961961

962962
def _parse_duration_attrs(
963-
req_attrs, sem_conv_opt_in_mode=_HTTPStabilityMode.DEFAULT
963+
req_attrs, sem_conv_opt_in_mode=_StabilityMode.DEFAULT
964964
):
965965
return _filter_semconv_duration_attrs(
966966
req_attrs,
@@ -971,7 +971,7 @@ def _parse_duration_attrs(
971971

972972

973973
def _parse_active_request_count_attrs(
974-
req_attrs, sem_conv_opt_in_mode=_HTTPStabilityMode.DEFAULT
974+
req_attrs, sem_conv_opt_in_mode=_StabilityMode.DEFAULT
975975
):
976976
return _filter_semconv_active_request_count_attr(
977977
req_attrs,

instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_middleware.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424
from opentelemetry import trace as trace_api
2525
from opentelemetry.instrumentation._semconv import (
2626
OTEL_SEMCONV_STABILITY_OPT_IN,
27-
_HTTPStabilityMode,
2827
_OpenTelemetrySemanticConventionStability,
2928
_server_active_requests_count_attrs_new,
3029
_server_active_requests_count_attrs_old,
3130
_server_duration_attrs_new,
3231
_server_duration_attrs_old,
32+
_StabilityMode,
3333
)
3434
from opentelemetry.instrumentation.propagators import (
3535
TraceResponsePropagator,
@@ -1652,7 +1652,7 @@ def test_request_attributes_new_semconv(self):
16521652

16531653
attrs = otel_asgi.collect_request_attributes(
16541654
self.scope,
1655-
_HTTPStabilityMode.HTTP,
1655+
_StabilityMode.HTTP,
16561656
)
16571657

16581658
self.assertDictEqual(
@@ -1677,7 +1677,7 @@ def test_request_attributes_both_semconv(self):
16771677

16781678
attrs = otel_asgi.collect_request_attributes(
16791679
self.scope,
1680-
_HTTPStabilityMode.HTTP_DUP,
1680+
_StabilityMode.HTTP_DUP,
16811681
)
16821682

16831683
self.assertDictEqual(
@@ -1715,7 +1715,7 @@ def test_query_string_new_semconv(self):
17151715
self.scope["query_string"] = b"foo=bar"
17161716
attrs = otel_asgi.collect_request_attributes(
17171717
self.scope,
1718-
_HTTPStabilityMode.HTTP,
1718+
_StabilityMode.HTTP,
17191719
)
17201720
self.assertEqual(attrs[URL_SCHEME], "http")
17211721
self.assertEqual(attrs[CLIENT_ADDRESS], "127.0.0.1")
@@ -1726,7 +1726,7 @@ def test_query_string_both_semconv(self):
17261726
self.scope["query_string"] = b"foo=bar"
17271727
attrs = otel_asgi.collect_request_attributes(
17281728
self.scope,
1729-
_HTTPStabilityMode.HTTP_DUP,
1729+
_StabilityMode.HTTP_DUP,
17301730
)
17311731
self.assertEqual(
17321732
attrs[SpanAttributes.HTTP_URL], "http://127.0.0.1/?foo=bar"
@@ -1762,7 +1762,7 @@ def test_response_attributes_new_semconv(self):
17621762
self.span,
17631763
404,
17641764
None,
1765-
_HTTPStabilityMode.HTTP,
1765+
_StabilityMode.HTTP,
17661766
)
17671767
expected = (mock.call(HTTP_RESPONSE_STATUS_CODE, 404),)
17681768
self.assertEqual(self.span.set_attribute.call_count, 1)
@@ -1774,7 +1774,7 @@ def test_response_attributes_both_semconv(self):
17741774
self.span,
17751775
404,
17761776
None,
1777-
_HTTPStabilityMode.HTTP_DUP,
1777+
_StabilityMode.HTTP_DUP,
17781778
)
17791779
expected = (mock.call(SpanAttributes.HTTP_STATUS_CODE, 404),)
17801780
expected2 = (mock.call(HTTP_RESPONSE_STATUS_CODE, 404),)

0 commit comments

Comments
 (0)