Skip to content

Commit 2b72ac2

Browse files
authored
Merge branch 'main' into main
2 parents 1e0b1f3 + 47caeab commit 2b72ac2

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
([#2151](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2151))
1212
- `opentelemetry-resource-detector-azure` Added 10s timeout to VM Resource Detector
1313
([#2119](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2119))
14+
- `opentelemetry-instrumentation-asyncpg` Allow AsyncPGInstrumentor to be instantiated multiple times
15+
([#1791](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1791))
1416
- `opentelemetry-instrumentation-confluent-kafka` Add support for higher versions until 2.3.0 of confluent_kafka
1517
([#2132](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2132))
1618
- `opentelemetry-resource-detector-azure` Changed timeout to 4 seconds due to [timeout bug](https://github.com/open-telemetry/opentelemetry-python/issues/3644)

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,13 @@ def _hydrate_span_from_args(connection, query, parameters) -> dict:
9696

9797

9898
class AsyncPGInstrumentor(BaseInstrumentor):
99+
100+
_leading_comment_remover = re.compile(r"^/\*.*?\*/")
101+
_tracer = None
102+
99103
def __init__(self, capture_parameters=False):
100104
super().__init__()
101105
self.capture_parameters = capture_parameters
102-
self._tracer = None
103-
self._leading_comment_remover = re.compile(r"^/\*.*?\*/")
104106

105107
def instrumentation_dependencies(self) -> Collection[str]:
106108
return _instruments

instrumentation/opentelemetry-instrumentation-asyncpg/tests/test_asyncpg_wrapper.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
class TestAsyncPGInstrumentation(TestBase):
8-
def test_duplicated_instrumentation(self):
8+
def test_duplicated_instrumentation_can_be_uninstrumented(self):
99
AsyncPGInstrumentor().instrument()
1010
AsyncPGInstrumentor().instrument()
1111
AsyncPGInstrumentor().instrument()
@@ -16,6 +16,14 @@ def test_duplicated_instrumentation(self):
1616
hasattr(method, "_opentelemetry_ext_asyncpg_applied")
1717
)
1818

19+
def test_duplicated_instrumentation_works(self):
20+
first = AsyncPGInstrumentor()
21+
first.instrument()
22+
second = AsyncPGInstrumentor()
23+
second.instrument()
24+
self.assertIsNotNone(first._tracer)
25+
self.assertIsNotNone(second._tracer)
26+
1927
def test_duplicated_uninstrumentation(self):
2028
AsyncPGInstrumentor().instrument()
2129
AsyncPGInstrumentor().uninstrument()

instrumentation/opentelemetry-instrumentation-kafka-python/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ Installation
1717
References
1818
----------
1919

20-
* `OpenTelemetry kafka-python Instrumentation <https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/kafka-python/kafka-python.html>`_
20+
* `OpenTelemetry kafka-python Instrumentation <https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/kafka_python/kafka_python.html>`_
2121
* `OpenTelemetry Project <https://opentelemetry.io/>`_
2222
* `OpenTelemetry Python Examples <https://github.com/open-telemetry/opentelemetry-python/tree/main/docs/examples>`_

0 commit comments

Comments
 (0)