Skip to content

Commit 1e65974

Browse files
authored
Release v4.18.0 (#1624)
1 parent e7b89a6 commit 1e65974

File tree

7 files changed

+34
-8
lines changed

7 files changed

+34
-8
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Release Notes
22

3+
## [v4.18.0] (2026-01-12)
4+
5+
* Adds `aiohttp` request body capture. by @adtyavrdhn in [#1595](https://github.com/pydantic/logfire/pull/1595)
6+
* Claude SDK instrumentation by @alexmojaki in [#1618](https://github.com/pydantic/logfire/pull/1618)
7+
38
## [v4.17.0] (2026-01-07)
49

510
* `logfire.instrument_surrealdb` by @alexmojaki in [#1573](https://github.com/pydantic/logfire/pull/1573)
@@ -994,3 +999,4 @@ First release from new repo!
994999
[v4.15.1]: https://github.com/pydantic/logfire/compare/v4.15.0...v4.15.1
9951000
[v4.16.0]: https://github.com/pydantic/logfire/compare/v4.15.1...v4.16.0
9961001
[v4.17.0]: https://github.com/pydantic/logfire/compare/v4.16.0...v4.17.0
1002+
[v4.18.0]: https://github.com/pydantic/logfire/compare/v4.17.0...v4.18.0

logfire-api/logfire_api/_internal/config_params.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ IGNORE_NO_CONFIG: Incomplete
5353
BASE_URL: Incomplete
5454
DISTRIBUTED_TRACING: Incomplete
5555
HTTPX_CAPTURE_ALL: Incomplete
56+
AIOHTTP_CLIENT_CAPTURE_ALL: Incomplete
5657
CONFIG_PARAMS: Incomplete
5758

5859
@dataclass

logfire-api/logfire_api/_internal/integrations/aiohttp_client.pyi

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
from _typeshed import Incomplete
12
from aiohttp.client_reqrep import ClientResponse
23
from aiohttp.tracing import TraceRequestEndParams, TraceRequestExceptionParams, TraceRequestStartParams
4+
from email.headerregistry import ContentTypeHeader
35
from logfire import Logfire as Logfire, LogfireSpan as LogfireSpan
6+
from logfire._internal.config import GLOBAL_CONFIG as GLOBAL_CONFIG
7+
from logfire._internal.main import set_user_attributes_on_raw_span as set_user_attributes_on_raw_span
8+
from logfire._internal.stack_info import warn_at_user_stacklevel as warn_at_user_stacklevel
49
from logfire._internal.utils import handle_internal_errors as handle_internal_errors
510
from logfire.integrations.aiohttp_client import AioHttpRequestHeaders as AioHttpRequestHeaders, AioHttpResponseHeaders as AioHttpResponseHeaders, RequestHook as RequestHook, ResponseHook as ResponseHook
611
from opentelemetry.trace import Span
@@ -9,18 +14,30 @@ from yarl import URL
914

1015
P = ParamSpec('P')
1116

12-
def instrument_aiohttp_client(logfire_instance: Logfire, capture_response_body: bool, capture_headers: bool, request_hook: RequestHook | None, response_hook: ResponseHook | None, **kwargs: Any) -> None:
17+
def instrument_aiohttp_client(logfire_instance: Logfire, capture_all: bool | None, capture_request_body: bool, capture_response_body: bool, capture_headers: bool, request_hook: RequestHook | None, response_hook: ResponseHook | None, **kwargs: Any) -> None:
1318
"""Instrument the `aiohttp` module so that spans are automatically created for each client request.
1419
1520
See the `Logfire.instrument_aiohttp_client` method for details.
1621
"""
1722

1823
class LogfireClientInfoMixin:
24+
"""Mixin providing content-type header parsing for charset detection."""
1925
headers: AioHttpRequestHeaders
26+
@property
27+
def content_type_header_object(self) -> ContentTypeHeader:
28+
"""Parse the Content-Type header into a structured object."""
29+
@property
30+
def content_type_header_string(self) -> str:
31+
"""Get the raw Content-Type header value."""
32+
@property
33+
def content_type_charset(self) -> str:
34+
"""Extract charset from Content-Type header, defaulting to utf-8."""
2035

2136
class LogfireAioHttpRequestInfo(TraceRequestStartParams, LogfireClientInfoMixin):
2237
span: Span
2338
def capture_headers(self) -> None: ...
39+
@handle_internal_errors
40+
def capture_body_if_text(self, attr_name: str = 'http.request.body.text'): ...
2441

2542
class LogfireAioHttpResponseInfo(LogfireClientInfoMixin):
2643
span: Span
@@ -37,9 +54,11 @@ class LogfireAioHttpResponseInfo(LogfireClientInfoMixin):
3754
@classmethod
3855
def create_from_trace_params(cls, span: Span, params: TraceRequestEndParams | TraceRequestExceptionParams, logfire_instance: Logfire) -> LogfireAioHttpResponseInfo: ...
3956

40-
def make_request_hook(hook: RequestHook | None, capture_headers: bool) -> RequestHook | None: ...
57+
def make_request_hook(hook: RequestHook | None, capture_headers: bool, capture_request_body: bool) -> RequestHook | None: ...
4158
def make_response_hook(hook: ResponseHook | None, logfire_instance: Logfire, capture_headers: bool, capture_response_body: bool) -> ResponseHook | None: ...
42-
def capture_request(span: Span, request: TraceRequestStartParams, capture_headers: bool) -> LogfireAioHttpRequestInfo: ...
59+
def capture_request(span: Span, request: TraceRequestStartParams, capture_headers: bool, capture_request_body: bool) -> LogfireAioHttpRequestInfo: ...
4360
def capture_response(span: Span, response: TraceRequestEndParams | TraceRequestExceptionParams, logfire_instance: Logfire, capture_headers: bool, capture_response_body: bool) -> LogfireAioHttpResponseInfo: ...
4461
def run_hook(hook: Callable[P, Any] | None, *args: P.args, **kwargs: P.kwargs) -> None: ...
4562
def capture_request_or_response_headers(span: Span, headers: AioHttpRequestHeaders | AioHttpResponseHeaders, request_or_response: Literal['request', 'response']) -> None: ...
63+
64+
CODES_FOR_METHODS_WITH_DATA_OR_JSON_PARAM: Incomplete

logfire-api/logfire_api/_internal/main.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ class Logfire:
775775
Returns:
776776
The instrumented WSGI application.
777777
"""
778-
def instrument_aiohttp_client(self, *, capture_headers: bool = False, capture_response_body: bool = False, request_hook: AiohttpClientRequestHook | None = None, response_hook: AiohttpClientResponseHook | None = None, **kwargs: Any) -> None:
778+
def instrument_aiohttp_client(self, *, capture_all: bool | None = None, capture_headers: bool = False, capture_request_body: bool = False, capture_response_body: bool = False, request_hook: AiohttpClientRequestHook | None = None, response_hook: AiohttpClientResponseHook | None = None, **kwargs: Any) -> None:
779779
"""Instrument the `aiohttp` module so that spans are automatically created for each client request.
780780
781781
Uses the

logfire-api/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "logfire-api"
7-
version = "4.17.0"
7+
version = "4.18.0"
88
description = "Shim for the Logfire SDK which does nothing unless Logfire is installed"
99
authors = [
1010
{ name = "Pydantic Team", email = "[email protected]" },

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "logfire"
7-
version = "4.17.0"
7+
version = "4.18.0"
88
description = "The best Python observability tool! 🪵🔥"
99
requires-python = ">=3.9"
1010
authors = [

uv.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)