Skip to content

Commit 3ef049e

Browse files
authored
Merge branch 'main' into add-type-hints-to-dbapi
2 parents 3c7d60c + 1092344 commit 3ef049e

File tree

71 files changed

+284
-21
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+284
-21
lines changed

_template/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ REPLACE_ME = "opentelemetry.instrumentation.<REPLACE>"
4141
# url of the instrumentation e.g
4242
# Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-sqlalchemy"
4343
Homepage = "<REPLACE ME>"
44+
Repository = "https://github.com/open-telemetry/opentelemetry-python-contrib"
4445

4546
[tool.hatch.version]
4647
# REPLACE ME: the path to the version file e.g

exporter/opentelemetry-exporter-prometheus-remote-write/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ dependencies = [
3535

3636
[project.urls]
3737
Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/exporter/opentelemetry-exporter-prometheus-remote-write"
38+
Repository = "https://github.com/open-telemetry/opentelemetry-python-contrib"
3839

3940
[tool.hatch.version]
4041
path = "src/opentelemetry/exporter/prometheus_remote_write/version.py"

exporter/opentelemetry-exporter-richconsole/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ dependencies = [
3333

3434
[project.urls]
3535
Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/exporter/opentelemetry-exporter-richconsole"
36+
Repository = "https://github.com/open-telemetry/opentelemetry-python-contrib"
3637

3738
[tool.hatch.version]
3839
path = "src/opentelemetry/exporter/richconsole/version.py"

instrumentation-genai/opentelemetry-instrumentation-openai-v2/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ openai = "opentelemetry.instrumentation.openai_v2:OpenAIInstrumentor"
4040

4141
[project.urls]
4242
Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation-genai/opentelemetry-instrumentation-openai-v2"
43+
Repository = "https://github.com/open-telemetry/opentelemetry-python-contrib"
4344

4445
[tool.hatch.version]
4546
path = "src/opentelemetry/instrumentation/openai_v2/version.py"

instrumentation/opentelemetry-instrumentation-aio-pika/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ aio-pika = "opentelemetry.instrumentation.aio_pika:AioPikaInstrumentor"
4040

4141
[project.urls]
4242
Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-aio-pika"
43+
Repository = "https://github.com/open-telemetry/opentelemetry-python-contrib"
4344

4445
[tool.hatch.version]
4546
path = "src/opentelemetry/instrumentation/aio_pika/version.py"

instrumentation/opentelemetry-instrumentation-aiohttp-client/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ aiohttp-client = "opentelemetry.instrumentation.aiohttp_client:AioHttpClientInst
4242

4343
[project.urls]
4444
Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-aiohttp-client"
45+
Repository = "https://github.com/open-telemetry/opentelemetry-python-contrib"
4546

4647
[tool.hatch.version]
4748
path = "src/opentelemetry/instrumentation/aiohttp_client/version.py"

instrumentation/opentelemetry-instrumentation-aiohttp-server/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ aiohttp-server = "opentelemetry.instrumentation.aiohttp_server:AioHttpServerInst
4242

4343
[project.urls]
4444
Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-aiohttp-server"
45+
Repository = "https://github.com/open-telemetry/opentelemetry-python-contrib"
4546

4647
[tool.hatch.version]
4748
path = "src/opentelemetry/instrumentation/aiohttp_server/version.py"

instrumentation/opentelemetry-instrumentation-aiokafka/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ aiokafka = "opentelemetry.instrumentation.aiokafka:AIOKafkaInstrumentor"
3838

3939
[project.urls]
4040
Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-aiokafka"
41+
Repository = "https://github.com/open-telemetry/opentelemetry-python-contrib"
4142

4243
[tool.hatch.version]
4344
path = "src/opentelemetry/instrumentation/aiokafka/version.py"

instrumentation/opentelemetry-instrumentation-aiopg/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ aiopg = "opentelemetry.instrumentation.aiopg:AiopgInstrumentor"
4141

4242
[project.urls]
4343
Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-aiopg"
44+
Repository = "https://github.com/open-telemetry/opentelemetry-python-contrib"
4445

4546
[tool.hatch.version]
4647
path = "src/opentelemetry/instrumentation/aiopg/version.py"

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,39 @@
2525
2626
import aiopg
2727
from opentelemetry.instrumentation.aiopg import AiopgInstrumentor
28-
28+
# Call instrument() to wrap all database connections
2929
AiopgInstrumentor().instrument()
3030
3131
cnx = await aiopg.connect(database='Database')
3232
cursor = await cnx.cursor()
33+
await cursor.execute("CREATE TABLE IF NOT EXISTS test (testField INTEGER)")
3334
await cursor.execute("INSERT INTO test (testField) VALUES (123)")
3435
cursor.close()
3536
cnx.close()
3637
3738
pool = await aiopg.create_pool(database='Database')
39+
3840
cnx = await pool.acquire()
3941
cursor = await cnx.cursor()
42+
await cursor.execute("CREATE TABLE IF NOT EXISTS test (testField INTEGER)")
4043
await cursor.execute("INSERT INTO test (testField) VALUES (123)")
4144
cursor.close()
4245
cnx.close()
4346
47+
.. code-block:: python
48+
49+
import aiopg
50+
from opentelemetry.instrumentation.aiopg import AiopgInstrumentor
51+
52+
# Alternatively, use instrument_connection for an individual connection
53+
cnx = await aiopg.connect(database='Database')
54+
instrumented_cnx = AiopgInstrumentor().instrument_connection(cnx)
55+
cursor = await instrumented_cnx.cursor()
56+
await cursor.execute("CREATE TABLE IF NOT EXISTS test (testField INTEGER)")
57+
await cursor.execute("INSERT INTO test (testField) VALUES (123)")
58+
cursor.close()
59+
instrumented_cnx.close()
60+
4461
API
4562
---
4663
"""

0 commit comments

Comments
 (0)