|
9 | 9 | from functools import cached_property, partial |
10 | 10 | from time import time |
11 | 11 | from types import TracebackType |
12 | | -from typing import ( |
13 | | - TYPE_CHECKING, |
14 | | - Any, |
15 | | - Callable, |
16 | | - ContextManager, |
17 | | - Iterable, |
18 | | - Literal, |
19 | | - Sequence, |
20 | | - TypeVar, |
21 | | - Union, |
22 | | - cast, |
23 | | -) |
| 12 | +from typing import TYPE_CHECKING, Any, Callable, ContextManager, Iterable, Literal, Sequence, TypeVar, Union, cast |
24 | 13 |
|
25 | 14 | import opentelemetry.context as context_api |
26 | 15 | import opentelemetry.trace as trace_api |
|
75 | 64 | from starlette.websockets import WebSocket |
76 | 65 | from typing_extensions import Unpack |
77 | 66 |
|
| 67 | + from .integrations.asyncpg import AsyncPGInstrumentKwargs |
78 | 68 | from .integrations.celery import CeleryInstrumentKwargs |
79 | 69 | from .integrations.flask import FlaskInstrumentKwargs |
| 70 | + from .integrations.httpx import HTTPXInstrumentKwargs |
80 | 71 | from .integrations.psycopg import PsycopgInstrumentKwargs |
81 | 72 | from .integrations.pymongo import PymongoInstrumentKwargs |
82 | 73 | from .integrations.redis import RedisInstrumentKwargs |
@@ -1033,14 +1024,14 @@ def instrument_anthropic( |
1033 | 1024 | is_async_client, |
1034 | 1025 | ) |
1035 | 1026 |
|
1036 | | - def instrument_asyncpg(self): |
| 1027 | + def instrument_asyncpg(self, **kwargs: Unpack[AsyncPGInstrumentKwargs]) -> None: |
1037 | 1028 | """Instrument the `asyncpg` module so that spans are automatically created for each query.""" |
1038 | 1029 | from .integrations.asyncpg import instrument_asyncpg |
1039 | 1030 |
|
1040 | 1031 | self._warn_if_not_initialized_for_instrumentation() |
1041 | | - return instrument_asyncpg() |
| 1032 | + return instrument_asyncpg(**kwargs) |
1042 | 1033 |
|
1043 | | - def instrument_httpx(self, **kwargs: Any): |
| 1034 | + def instrument_httpx(self, **kwargs: Unpack[HTTPXInstrumentKwargs]) -> None: |
1044 | 1035 | """Instrument the `httpx` module so that spans are automatically created for each request. |
1045 | 1036 |
|
1046 | 1037 | Uses the |
|
0 commit comments