Skip to content

Commit f35cacc

Browse files
authored
Release v3.12.0 (#971)
1 parent 746b964 commit f35cacc

File tree

10 files changed

+30
-10
lines changed

10 files changed

+30
-10
lines changed

CHANGELOG.md

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

3+
## [v3.12.0] (2025-03-31)
4+
5+
* Add `logfire.instrument_mcp()` method by @alexmojaki in [#966](https://github.com/pydantic/logfire/pull/966)
6+
* Merge headers if passed via `client_kwargs` in query client by @Kludex in [#958](https://github.com/pydantic/logfire/pull/958)
7+
* Warn user if f-string expression contains `await` by @Sbargaoui in [#944](https://github.com/pydantic/logfire/pull/944)
8+
* Handle new MCP span in OpenAI Agents SDK by @alexmojaki in [#963](https://github.com/pydantic/logfire/pull/963)
9+
310
## [v3.11.0] (2025-03-26)
411

512
* Add `record_return` flag to `@logfire.instrument` by @alexmojaki in [#955](https://github.com/pydantic/logfire/pull/955)
@@ -649,3 +656,4 @@ First release from new repo!
649656
[v3.9.1]: https://github.com/pydantic/logfire/compare/v3.9.0...v3.9.1
650657
[v3.10.0]: https://github.com/pydantic/logfire/compare/v3.9.1...v3.10.0
651658
[v3.11.0]: https://github.com/pydantic/logfire/compare/v3.10.0...v3.11.0
659+
[v3.12.0]: https://github.com/pydantic/logfire/compare/v3.11.0...v3.12.0

logfire-api/logfire_api/__init__.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ from .version import VERSION as VERSION
1313
from logfire.sampling import SamplingOptions as SamplingOptions
1414
from typing import Any
1515

16-
__all__ = ['Logfire', 'LogfireSpan', 'LevelName', 'AdvancedOptions', 'ConsoleOptions', 'CodeSource', 'PydanticPlugin', 'configure', 'span', 'instrument', 'log', 'trace', 'debug', 'notice', 'info', 'warn', 'warning', 'error', 'exception', 'fatal', 'force_flush', 'log_slow_async_callbacks', 'install_auto_tracing', 'instrument_asgi', 'instrument_wsgi', 'instrument_pydantic', 'instrument_pydantic_ai', 'instrument_fastapi', 'instrument_openai', 'instrument_openai_agents', 'instrument_anthropic', 'instrument_asyncpg', 'instrument_httpx', 'instrument_celery', 'instrument_requests', 'instrument_psycopg', 'instrument_django', 'instrument_flask', 'instrument_starlette', 'instrument_aiohttp_client', 'instrument_sqlalchemy', 'instrument_sqlite3', 'instrument_aws_lambda', 'instrument_redis', 'instrument_pymongo', 'instrument_mysql', 'instrument_system_metrics', 'AutoTraceModule', 'with_tags', 'with_settings', 'suppress_scopes', 'shutdown', 'no_auto_trace', 'ScrubMatch', 'ScrubbingOptions', 'VERSION', 'add_non_user_code_prefix', 'suppress_instrumentation', 'StructlogProcessor', 'LogfireLoggingHandler', 'loguru_handler', 'SamplingOptions', 'MetricsOptions', 'logfire_info']
16+
__all__ = ['Logfire', 'LogfireSpan', 'LevelName', 'AdvancedOptions', 'ConsoleOptions', 'CodeSource', 'PydanticPlugin', 'configure', 'span', 'instrument', 'log', 'trace', 'debug', 'notice', 'info', 'warn', 'warning', 'error', 'exception', 'fatal', 'force_flush', 'log_slow_async_callbacks', 'install_auto_tracing', 'instrument_asgi', 'instrument_wsgi', 'instrument_pydantic', 'instrument_pydantic_ai', 'instrument_fastapi', 'instrument_openai', 'instrument_openai_agents', 'instrument_anthropic', 'instrument_asyncpg', 'instrument_httpx', 'instrument_celery', 'instrument_requests', 'instrument_psycopg', 'instrument_django', 'instrument_flask', 'instrument_starlette', 'instrument_aiohttp_client', 'instrument_sqlalchemy', 'instrument_sqlite3', 'instrument_aws_lambda', 'instrument_redis', 'instrument_pymongo', 'instrument_mysql', 'instrument_system_metrics', 'instrument_mcp', 'AutoTraceModule', 'with_tags', 'with_settings', 'suppress_scopes', 'shutdown', 'no_auto_trace', 'ScrubMatch', 'ScrubbingOptions', 'VERSION', 'add_non_user_code_prefix', 'suppress_instrumentation', 'StructlogProcessor', 'LogfireLoggingHandler', 'loguru_handler', 'SamplingOptions', 'MetricsOptions', 'logfire_info']
1717

1818
DEFAULT_LOGFIRE_INSTANCE = Logfire()
1919
span = DEFAULT_LOGFIRE_INSTANCE.span
@@ -45,6 +45,7 @@ instrument_redis = DEFAULT_LOGFIRE_INSTANCE.instrument_redis
4545
instrument_pymongo = DEFAULT_LOGFIRE_INSTANCE.instrument_pymongo
4646
instrument_mysql = DEFAULT_LOGFIRE_INSTANCE.instrument_mysql
4747
instrument_system_metrics = DEFAULT_LOGFIRE_INSTANCE.instrument_system_metrics
48+
instrument_mcp = DEFAULT_LOGFIRE_INSTANCE.instrument_mcp
4849
suppress_scopes = DEFAULT_LOGFIRE_INSTANCE.suppress_scopes
4950
shutdown = DEFAULT_LOGFIRE_INSTANCE.shutdown
5051
with_tags = DEFAULT_LOGFIRE_INSTANCE.with_tags

logfire-api/logfire_api/_internal/exporters/quiet_metrics.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from .wrapper import WrapperMetricExporter as WrapperMetricExporter
2-
from opentelemetry.sdk.metrics._internal.export import MetricExportResult
3-
from opentelemetry.sdk.metrics._internal.point import MetricsData
2+
from opentelemetry.sdk.metrics.export import MetricExportResult, MetricsData
43
from typing import Any
54

65
class QuietMetricExporter(WrapperMetricExporter):

logfire-api/logfire_api/_internal/formatter.pyi

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ class KnownFormattingError(Exception):
5454
In other words this should correspond to errors that would be raised when using `str.format`,
5555
and generally indicate a user error, most likely that they weren't trying to pass a template string at all.
5656
"""
57+
class FStringAwaitError(Exception):
58+
"""An error raised when an await expression is found in an f-string.
59+
60+
This is a specific case that can't be handled by f-string introspection and requires
61+
pre-evaluating the await expression before logging.
62+
"""
5763
class FormattingFailedWarning(UserWarning): ...
5864

5965
def warn_formatting(msg: str): ...
66+
def warn_fstring_await(msg: str): ...
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from logfire import Logfire as Logfire
2+
3+
def instrument_mcp(logfire_instance: Logfire): ...

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import contextvars
22
from _typeshed import Incomplete
33
from abc import abstractmethod
4-
from agents import Span, Trace
4+
from agents import Span, SpanData, Trace
55
from agents.tracing import ResponseSpanData
66
from agents.tracing.setup import TraceProvider
7-
from agents.tracing.spans import SpanData, SpanError, TSpanData
7+
from agents.tracing.spans import SpanError, TSpanData
88
from dataclasses import dataclass
99
from logfire import Logfire as Logfire, LogfireSpan as LogfireSpan
1010
from logfire._internal.formatter import logfire_format as logfire_format

logfire-api/logfire_api/_internal/main.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,8 @@ class Logfire:
401401
modules in `sys.modules` (i.e. modules that have already been imported) match the modules to trace.
402402
Set to `'warn'` to issue a warning instead, or `'ignore'` to skip the check.
403403
"""
404+
def instrument_mcp(self) -> None:
405+
"""Instrument [MCP](https://modelcontextprotocol.io/) requests such as tool calls."""
404406
def instrument_pydantic(self, record: PydanticPluginRecordValues = 'all', include: Iterable[str] = (), exclude: Iterable[str] = ()) -> None:
405407
"""Instrument Pydantic model validations.
406408

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 = "3.11.0"
7+
version = "3.12.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 = "3.11.0"
7+
version = "3.12.0"
88
description = "The best Python observability tool! 🪵🔥"
99
requires-python = ">=3.8"
1010
authors = [

uv.lock

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

0 commit comments

Comments
 (0)