Skip to content

Commit 7f01b35

Browse files
authored
Fix broken botocore tests, minor change to HTTPX instrumentation test, remove _ExtendedAttributes import from logging instrumentation (#4646)
* Few fixes * Fix broken test and missing import * Address comment
1 parent 26c975f commit 7f01b35

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

instrumentation/opentelemetry-instrumentation-botocore/test-requirements-2.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ aws-xray-sdk==2.12.1
33
boto3==1.29.4
44
botocore==1.32.4
55
aiobotocore==2.8.0
6+
aiohttp==3.9.1 #TODO: https://github.com/open-telemetry/opentelemetry-python-contrib/issues/4645 - fix issue with aiohttp in a better way.
67
certifi==2024.7.4
78
cffi==1.17.0
89
charset-normalizer==3.3.2

instrumentation/opentelemetry-instrumentation-botocore/test-requirements-3.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ aws-xray-sdk==2.12.1
33
boto3==1.35.16
44
botocore==1.35.16
55
aiobotocore==2.15.0
6+
aiohttp==3.9.3 #TODO: https://github.com/open-telemetry/opentelemetry-python-contrib/issues/4645 - fix issue with aiohttp in a better way.
67
certifi==2024.7.4
78
cffi==1.17.0
89
charset-normalizer==3.3.2

instrumentation/opentelemetry-instrumentation-httpx/tests/test_httpx_integration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def _response_hook(span, request: "RequestInfo", response: "ResponseInfo"):
9999
assert _is_url_tuple(request) or isinstance(request.url, httpx.URL)
100100
span.set_attribute(
101101
HTTP_RESPONSE_BODY,
102-
b"".join(response[2]),
102+
"".join([part.decode() for part in response[2]]),
103103
)
104104

105105

@@ -109,7 +109,7 @@ async def _async_response_hook(
109109
assert _is_url_tuple(request) or isinstance(request.url, httpx.URL)
110110
span.set_attribute(
111111
HTTP_RESPONSE_BODY,
112-
b"".join([part async for part in response[2]]),
112+
"".join([part.decode() async for part in response[2]]),
113113
)
114114

115115

instrumentation/opentelemetry-instrumentation-logging/src/opentelemetry/instrumentation/logging/handler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import traceback
1010
from contextvars import ContextVar
1111
from time import time_ns
12-
from typing import Callable
12+
from typing import Callable, Mapping
1313

1414
from opentelemetry._logs import (
1515
LoggerProvider,
@@ -22,7 +22,7 @@
2222
from opentelemetry.context import get_current
2323
from opentelemetry.semconv._incubating.attributes import code_attributes
2424
from opentelemetry.semconv.attributes import exception_attributes
25-
from opentelemetry.util.types import _ExtendedAttributes
25+
from opentelemetry.util.types import AnyValue
2626

2727
_internal_logger = logging.getLogger(__name__ + ".internal")
2828
_internal_logger.propagate = False
@@ -132,7 +132,7 @@ def __init__(
132132

133133
def _get_attributes(
134134
self, record: logging.LogRecord
135-
) -> _ExtendedAttributes:
135+
) -> Mapping[str, AnyValue]:
136136
attributes = {
137137
k: v for k, v in vars(record).items() if k not in _RESERVED_ATTRS
138138
}

0 commit comments

Comments
 (0)