Skip to content

Commit f8c349c

Browse files
committed
* updates to pass PR checks
1 parent 0b12d9b commit f8c349c

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818

1919
### Added
2020

21-
- `opentelemtetry-instrumentation-psycopg3` Inital Instrumentation for psycopg3 including asynchronous instrumentation.
21+
- `opentelemtetry-instrumentation-psycopg3` Initial Instrumentation for psycopg3 including async instrumentation.
2222
([#2146](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2146))
2323
- `opentelemetry-instrumentation` Added Otel semantic convention opt-in mechanism
2424
([#1987](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1987))

docs-requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ kafka-python>=2.0,<3.0
3636
mysql-connector-python~=8.0
3737
mysqlclient~=2.1.1
3838
psutil>=5
39-
psycopg>=3.117
39+
psycopg>=3.1.17
4040
pika>=0.12.0
4141
pymongo~=3.1
4242
PyMySQL~=0.9.3

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

+12-4
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@ def instrument_connection(connection, tracer_provider=None):
191191
connection._is_instrumented_by_opentelemetry = False
192192

193193
if not connection._is_instrumented_by_opentelemetry:
194-
setattr(connection, _OTEL_CURSOR_FACTORY_KEY, connection.cursor_factory)
194+
setattr(
195+
connection, _OTEL_CURSOR_FACTORY_KEY, connection.cursor_factory
196+
)
195197
connection.cursor_factory = _new_cursor_factory(
196198
tracer_provider=tracer_provider
197199
)
@@ -205,7 +207,9 @@ def instrument_connection(connection, tracer_provider=None):
205207
# TODO(owais): check if core dbapi can do this for all dbapi implementations e.g, pymysql and mysql
206208
@staticmethod
207209
def uninstrument_connection(connection):
208-
connection.cursor_factory = getattr(connection, _OTEL_CURSOR_FACTORY_KEY, None)
210+
connection.cursor_factory = getattr(
211+
connection, _OTEL_CURSOR_FACTORY_KEY, None
212+
)
209213

210214
return connection
211215

@@ -241,7 +245,9 @@ async def wrapped_connection(
241245
new_factory_kwargs = {"db_api": self}
242246
if base_cursor_factory:
243247
new_factory_kwargs["base_factory"] = base_cursor_factory
244-
kwargs["cursor_factory"] = _new_cursor_async_factory(**new_factory_kwargs)
248+
kwargs["cursor_factory"] = _new_cursor_async_factory(
249+
**new_factory_kwargs
250+
)
245251
connection = await connect_method(*args, **kwargs)
246252
self.get_connection_attributes(connection)
247253
return connection
@@ -305,7 +311,9 @@ def callproc(self, *args, **kwargs):
305311
return TracedCursorFactory
306312

307313

308-
def _new_cursor_async_factory(db_api=None, base_factory=None, tracer_provider=None):
314+
def _new_cursor_async_factory(
315+
db_api=None, base_factory=None, tracer_provider=None
316+
):
309317
if not db_api:
310318
db_api = DatabaseApiAsyncIntegration(
311319
__name__,

instrumentation/opentelemetry-instrumentation-psycopg3/tests/test_psycopg3_integration.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ def setUp(self):
139139
"opentelemetry.instrumentation.psycopg3.pg_cursor", MockCursor
140140
)
141141
self.cursor_async_mock = mock.patch(
142-
"opentelemetry.instrumentation.psycopg3.pg_async_cursor", MockAsyncCursor
142+
"opentelemetry.instrumentation.psycopg3.pg_async_cursor",
143+
MockAsyncCursor,
143144
)
144145
self.connection_mock = mock.patch("psycopg.connect", MockConnection)
145146
self.connection_sync_mock = mock.patch(

opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
"instrumentation": "opentelemetry-instrumentation-psycopg2==0.44b0.dev",
126126
},
127127
{
128-
"library": "psycopg >= 3.1.12",
128+
"library": "psycopg >= 3.1.17",
129129
"instrumentation": "opentelemetry-instrumentation-psycopg3==0.44b0.dev",
130130
},
131131
{

0 commit comments

Comments
 (0)