Skip to content

Commit

Permalink
Merge branch 'main' into fix-asyncio-trace-to-thread-partial-function
Browse files Browse the repository at this point in the history
  • Loading branch information
xrmx authored Oct 22, 2024
2 parents d83f8f2 + cef28d6 commit ba28b43
Show file tree
Hide file tree
Showing 104 changed files with 267 additions and 265 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- `opentelemetry-instrumentation-aiokafka` Wrap `AIOKafkaConsumer.getone()` instead of `AIOKafkaConsumer.__anext__`
([#2874](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2874))
- `opentelemetry-instrumentation-confluent-kafka` Fix to allow `topic` to be extracted from `kwargs` in `produce()`
([#2901])(https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2901)

### Breaking changes

- Deprecation of pkg_resource in favor of importlib.metadata
([#2871](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2871))

## Version 1.27.0/0.48b0 (2024-08-28)

### Added

- `opentelemetry-instrumentation-kafka-python` Instrument temporary fork, kafka-python-ng
inside kafka-python's instrumentation
- `opentelemetry-instrumentation-kafka-python` Instrument temporary fork, kafka-python-ng inside kafka-python's instrumentation
([#2537](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2537))
- `opentelemetry-instrumentation-asgi`, `opentelemetry-instrumentation-fastapi` Add ability to disable internal HTTP send and receive spans
([#2802](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2802))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ cramjam==2.1.0; platform_python_implementation == "PyPy"
cramjam==2.8.1; platform_python_implementation != "PyPy"
Deprecated==1.2.14
idna==3.7
importlib-metadata==6.11.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
asgiref==3.8.1
Deprecated==1.2.14
flaky==3.7.0
importlib-metadata==6.11.0
iniconfig==2.0.0
markdown-it-py==3.0.0
mdurl==0.1.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ aiormq==6.2.3
asgiref==3.8.1
Deprecated==1.2.14
idna==3.7
importlib-metadata==6.11.0
iniconfig==2.0.0
multidict==6.0.5
packaging==24.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ aiormq==6.6.4
asgiref==3.8.1
Deprecated==1.2.14
idna==3.7
importlib-metadata==6.11.0
iniconfig==2.0.0
multidict==6.0.5
packaging==24.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ aiormq==6.7.1
asgiref==3.8.1
Deprecated==1.2.14
idna==3.7
importlib-metadata==6.11.0
iniconfig==2.0.0
multidict==6.0.5
packaging==24.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ aiormq==6.8.0
asgiref==3.8.1
Deprecated==1.2.14
idna==3.7
importlib-metadata==6.11.0
iniconfig==2.0.0
multidict==6.0.5
packaging==24.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Flask==3.0.2
frozenlist==1.4.1
http_server_mock==1.7
idna==3.7
importlib-metadata==6.11.0
iniconfig==2.0.0
itsdangerous==2.1.2
Jinja2==3.1.4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import aiohttp.test_utils
import yarl
from http_server_mock import HttpServerMock
from pkg_resources import iter_entry_points

from opentelemetry import trace as trace_api
from opentelemetry.instrumentation import aiohttp_client
Expand All @@ -47,6 +46,7 @@
from opentelemetry.semconv.trace import SpanAttributes
from opentelemetry.test.test_base import TestBase
from opentelemetry.trace import Span, StatusCode
from opentelemetry.util._importlib_metadata import entry_points


def run_with_test_server(
Expand Down Expand Up @@ -886,9 +886,9 @@ def response_hook(

class TestLoadingAioHttpInstrumentor(unittest.TestCase):
def test_loading_instrumentor(self):
entry_points = iter_entry_points(
"opentelemetry_instrumentor", "aiohttp-client"
(entry_point,) = entry_points(
group="opentelemetry_instrumentor", name="aiohttp-client"
)

instrumentor = next(entry_points).load()()
instrumentor = entry_point.load()()
self.assertIsInstance(instrumentor, AioHttpClientInstrumentor)
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ async-timeout==4.0.3
Deprecated==1.2.14
frozenlist==1.4.1
idna==3.7
importlib-metadata==6.11.0
iniconfig==2.0.0
multidict==6.0.5
packaging==24.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ aiopg==1.4.0
asgiref==3.8.1
async-timeout==4.0.3
Deprecated==1.2.14
importlib-metadata==6.11.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
asgiref==3.8.1
Deprecated==1.2.14
importlib-metadata==6.11.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
asgiref==3.8.1
Deprecated==1.2.14
importlib-metadata==6.11.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ asgiref==3.8.1
async-timeout==4.0.3
asyncpg==0.29.0
Deprecated==1.2.14
importlib-metadata==6.11.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
asgiref==3.8.1
Deprecated==1.2.14
importlib-metadata==6.11.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ cryptography==43.0.1
Deprecated==1.2.14
docker==7.0.0
idna==3.7
importlib-metadata==6.11.0
iniconfig==2.0.0
Jinja2==3.1.4
jmespath==1.0.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ asgiref==3.8.1
boto3==1.34.44
botocore==1.34.44
Deprecated==1.2.14
importlib-metadata==6.11.0
iniconfig==2.0.0
jmespath==1.0.1
packaging==24.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ cryptography==43.0.1
Deprecated==1.2.14
docker==7.0.0
idna==3.7
importlib-metadata==6.11.0
iniconfig==2.0.0
Jinja2==3.1.4
jmespath==1.0.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pyasyncore==1.0.4 # for python 3.13 (should removed when cassandra-driver repla
click==8.1.7
Deprecated==1.2.14
geomet==0.2.1.post1
importlib-metadata==6.11.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ click-didyoumean==0.3.0
click-plugins==1.1.1
click-repl==0.3.0
Deprecated==1.2.14
importlib-metadata==6.11.0
iniconfig==2.0.0
kombu==5.3.5
packaging==24.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ click-didyoumean==0.3.0
click-plugins==1.1.1
click-repl==0.3.0
Deprecated==1.2.14
importlib-metadata==6.11.0
iniconfig==2.0.0
kombu==5.3.5
packaging==24.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,9 @@ def wrap_produce(func, instance, tracer, args, kwargs):
headers = []
kwargs["headers"] = headers

topic = KafkaPropertiesExtractor.extract_produce_topic(args)
topic = KafkaPropertiesExtractor.extract_produce_topic(
args, kwargs
)
_enrich_span(
span,
topic,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ def _extract_argument(key, position, default_value, args, kwargs):
return kwargs.get(key, default_value)

@staticmethod
def extract_produce_topic(args):
def extract_produce_topic(args, kwargs):
"""extract topic from `produce` method arguments in Producer class"""
if len(args) > 0:
return args[0]
return "unknown"
return kwargs.get("topic") or (args[0] if args else "unknown")

@staticmethod
def extract_produce_headers(args, kwargs):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
asgiref==3.8.1
confluent-kafka==2.4.0
Deprecated==1.2.14
importlib-metadata==6.11.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,15 @@ def _compare_spans(self, spans, expected_spans):
expected_attribute_value, span.attributes[attribute_key]
)

def _assert_topic(self, span, expected_topic: str) -> None:
self.assertEqual(
span.attributes[SpanAttributes.MESSAGING_DESTINATION],
expected_topic,
)

def _assert_span_count(self, span_list, expected_count: int) -> None:
self.assertEqual(len(span_list), expected_count)

def test_producer_poll(self) -> None:
instrumentation = ConfluentKafkaInstrumentor()
message_queue = []
Expand All @@ -299,6 +308,9 @@ def test_producer_poll(self) -> None:
producer.produce(topic="topic-1", key="key-1", value="value-1")
msg = producer.poll()
self.assertIsNotNone(msg)
span_list = self.memory_exporter.get_finished_spans()
self._assert_span_count(span_list, 1)
self._assert_topic(span_list[0], "topic-1")

def test_producer_flush(self) -> None:
instrumentation = ConfluentKafkaInstrumentor()
Expand All @@ -315,3 +327,6 @@ def test_producer_flush(self) -> None:
producer.produce(topic="topic-1", key="key-1", value="value-1")
msg = producer.flush()
self.assertIsNotNone(msg)
span_list = self.memory_exporter.get_finished_spans()
self._assert_span_count(span_list, 1)
self._assert_topic(span_list[0], "topic-1")
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
asgiref==3.8.1
Deprecated==1.2.14
importlib-metadata==6.11.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
asgiref==3.8.1
Deprecated==1.2.14
Django==2.2.28
importlib-metadata==6.11.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
asgiref==3.8.1
Deprecated==1.2.14
Django==3.2.25
importlib-metadata==6.11.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ asgiref==3.8.1
backports.zoneinfo==0.2.1
Deprecated==1.2.14
Django==4.2.15
importlib-metadata==6.11.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
asgiref==3.8.1
Deprecated==1.2.14
Django==4.2.15
importlib-metadata==6.11.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ asgiref==3.8.1
Deprecated==1.2.14
elasticsearch==6.8.2
elasticsearch-dsl==6.4.0
importlib-metadata==6.11.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ asgiref==3.8.1
Deprecated==1.2.14
elasticsearch==7.17.9
elasticsearch-dsl==7.4.1
importlib-metadata==6.11.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Deprecated==1.2.14
elasticsearch==8.13.1
elasticsearch-dsl==8.13.1
elastic-transport==8.13.0
importlib-metadata==6.11.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
asgiref==3.8.1
Deprecated==1.2.14
falcon==1.4.1
importlib-metadata==6.11.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
asgiref==3.8.1
Deprecated==1.2.14
falcon==2.0.0
importlib-metadata==6.11.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
asgiref==3.8.1
Deprecated==1.2.14
falcon==3.1.1
importlib-metadata==6.11.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ h11==0.14.0
httpcore==1.0.4
httpx==0.27.0
idna==3.7
importlib-metadata==6.11.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
Expand Down
Loading

0 comments on commit ba28b43

Please sign in to comment.