|
1 | 1 | import httpx |
2 | 2 | from logfire import Logfire as Logfire |
| 3 | +from logfire._internal.main import set_user_attributes_on_raw_span as set_user_attributes_on_raw_span |
| 4 | +from logfire._internal.utils import handle_internal_errors as handle_internal_errors |
3 | 5 | from opentelemetry.instrumentation.httpx import AsyncRequestHook, AsyncResponseHook, RequestHook, RequestInfo, ResponseHook, ResponseInfo |
4 | 6 | from opentelemetry.trace import Span |
5 | 7 | from typing import Any, Callable, Literal, ParamSpec, TypeVar, TypedDict, Unpack, overload |
@@ -27,17 +29,20 @@ AsyncHook = TypeVar('AsyncHook', AsyncRequestHook, AsyncResponseHook) |
27 | 29 | P = ParamSpec('P') |
28 | 30 |
|
29 | 31 | @overload |
30 | | -def instrument_httpx(logfire_instance: Logfire, client: httpx.Client, capture_request_headers: bool, capture_response_headers: bool, **kwargs: Unpack[ClientKwargs]) -> None: ... |
| 32 | +def instrument_httpx(logfire_instance: Logfire, client: httpx.Client, capture_request_headers: bool, capture_response_headers: bool, capture_request_json_body: bool, **kwargs: Unpack[ClientKwargs]) -> None: ... |
31 | 33 | @overload |
32 | | -def instrument_httpx(logfire_instance: Logfire, client: httpx.AsyncClient, capture_request_headers: bool, capture_response_headers: bool, **kwargs: Unpack[AsyncClientKwargs]) -> None: ... |
| 34 | +def instrument_httpx(logfire_instance: Logfire, client: httpx.AsyncClient, capture_request_headers: bool, capture_response_headers: bool, capture_request_json_body: bool, **kwargs: Unpack[AsyncClientKwargs]) -> None: ... |
33 | 35 | @overload |
34 | | -def instrument_httpx(logfire_instance: Logfire, client: None, capture_request_headers: bool, capture_response_headers: bool, **kwargs: Unpack[HTTPXInstrumentKwargs]) -> None: ... |
35 | | -def make_capture_response_headers_hook(hook: ResponseHook | None) -> ResponseHook: ... |
36 | | -def make_capture_async_response_headers_hook(hook: AsyncResponseHook | None) -> AsyncResponseHook: ... |
37 | | -def make_capture_request_headers_hook(hook: RequestHook | None) -> RequestHook: ... |
38 | | -def make_capture_async_request_headers_hook(hook: AsyncRequestHook | None) -> AsyncRequestHook: ... |
| 36 | +def instrument_httpx(logfire_instance: Logfire, client: None, capture_request_headers: bool, capture_response_headers: bool, capture_request_json_body: bool, **kwargs: Unpack[HTTPXInstrumentKwargs]) -> None: ... |
| 37 | +def make_request_hook(hook: RequestHook | None, should_capture_headers: bool, should_capture_json: bool) -> RequestHook | None: ... |
| 38 | +def make_async_request_hook(hook: AsyncRequestHook | RequestHook | None, should_capture_headers: bool, should_capture_json: bool) -> AsyncRequestHook | None: ... |
| 39 | +def make_response_hook(hook: ResponseHook | None, should_capture_headers: bool) -> ResponseHook | None: ... |
| 40 | +def make_async_response_hook(hook: ResponseHook | AsyncResponseHook | None, should_capture_headers: bool) -> AsyncResponseHook | None: ... |
39 | 41 | async def run_async_hook(hook: Callable[P, Any] | None, *args: P.args, **kwargs: P.kwargs) -> None: ... |
40 | 42 | def run_hook(hook: Callable[P, Any] | None, *args: P.args, **kwargs: P.kwargs) -> None: ... |
41 | | -def capture_response_headers(span: Span, request: RequestInfo, response: ResponseInfo) -> None: ... |
| 43 | +def capture_response_headers(span: Span, response: ResponseInfo) -> None: ... |
42 | 44 | def capture_request_headers(span: Span, request: RequestInfo) -> None: ... |
43 | 45 | def capture_headers(span: Span, headers: httpx.Headers, request_or_response: Literal['request', 'response']) -> None: ... |
| 46 | +def get_charset(content_type: str) -> str: ... |
| 47 | +def decode_body(body: bytes, content_type: str): ... |
| 48 | +def capture_request_body(span: Span, request: RequestInfo) -> None: ... |
0 commit comments