Skip to content

Commit feecb67

Browse files
authored
Release v2.11.1 (#743)
1 parent 1ec90f4 commit feecb67

File tree

8 files changed

+27
-28
lines changed

8 files changed

+27
-28
lines changed

CHANGELOG.md

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

3+
## [v2.11.1] (2024-12-30)
4+
5+
* Handle errors from `sqlalchemy.inspect` by @alexmojaki in [#733](https://github.com/pydantic/logfire/pull/733)
6+
37
## [v2.11.0] (2024-12-23)
48

59
* Add `capture_request_text_body` param to `instrument_httpx` by @alexmojaki in [#722](https://github.com/pydantic/logfire/pull/722)
@@ -499,3 +503,4 @@ First release from new repo!
499503
[v2.9.0]: https://github.com/pydantic/logfire/compare/v2.8.0...v2.9.0
500504
[v2.10.0]: https://github.com/pydantic/logfire/compare/v2.9.0...v2.10.0
501505
[v2.11.0]: https://github.com/pydantic/logfire/compare/v2.10.0...v2.11.0
506+
[v2.11.1]: https://github.com/pydantic/logfire/compare/v2.11.0...v2.11.1

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import sqlite3
22
from opentelemetry.trace import TracerProvider
3-
from typing import TypeVar, TypedDict, Unpack
3+
from typing import Any, TypeVar
44

5-
SQLite3Connection = TypeVar('SQLite3Connection', bound=sqlite3.Connection | None)
5+
SQLite3Connection = TypeVar('SQLite3Connection', sqlite3.Connection, None)
66

7-
class SQLite3InstrumentKwargs(TypedDict, total=False):
8-
skip_dep_check: bool
9-
10-
def instrument_sqlite3(*, conn: SQLite3Connection, tracer_provider: TracerProvider, **kwargs: Unpack[SQLite3InstrumentKwargs]) -> SQLite3Connection:
7+
def instrument_sqlite3(*, conn: SQLite3Connection, tracer_provider: TracerProvider, **kwargs: Any) -> SQLite3Connection:
118
"""Instrument the `sqlite3` module so that spans are automatically created for each query.
129
1310
See the `Logfire.instrument_sqlite3` method for details.

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

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
1-
from logfire import Logfire as Logfire
21
from logfire._internal.utils import maybe_capture_server_headers as maybe_capture_server_headers
3-
from opentelemetry.trace import Span
4-
from typing import Callable, Protocol, TypedDict
5-
from typing_extensions import Unpack
6-
from wsgiref.types import WSGIApplication, WSGIEnvironment
2+
from logfire.integrations.wsgi import RequestHook as RequestHook, ResponseHook as ResponseHook
3+
from typing import Any
4+
from wsgiref.types import WSGIApplication
75

8-
class ResponseHook(Protocol):
9-
def __call__(self, span: Span, environ: WSGIEnvironment, status_code: int, response_headers: list[tuple[str, str]]) -> None: ...
10-
RequestHook = Callable[[Span, WSGIEnvironment], None]
11-
12-
class WSGIInstrumentKwargs(TypedDict, total=False):
13-
request_hook: RequestHook | None
14-
response_hook: ResponseHook | None
15-
16-
def instrument_wsgi(logfire_instance: Logfire, app: WSGIApplication, *, capture_headers: bool = False, **kwargs: Unpack[WSGIInstrumentKwargs]) -> WSGIApplication:
6+
def instrument_wsgi(app: WSGIApplication, *, capture_headers: bool = False, request_hook: RequestHook | None = None, response_hook: ResponseHook | None = None, **kwargs: Any) -> WSGIApplication:
177
"""Instrument `app` so that spans are automatically created for each request.
188
199
See the `Logfire.instrument_wsgi` method for details.

logfire-api/logfire_api/_internal/main.pyi

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import opentelemetry.trace as trace_api
55
import requests
66
from . import async_ as async_
77
from ..integrations.flask import CommenterOptions as CommenterOptions, RequestHook as FlaskRequestHook, ResponseHook as FlaskResponseHook
8+
from ..integrations.wsgi import RequestHook as WSGIRequestHook, ResponseHook as WSGIResponseHook
89
from ..version import VERSION as VERSION
910
from .auto_trace import AutoTraceModule as AutoTraceModule, install_auto_tracing as install_auto_tracing
1011
from .config import GLOBAL_CONFIG as GLOBAL_CONFIG, LogfireConfig as LogfireConfig
@@ -20,9 +21,8 @@ from .integrations.psycopg import PsycopgInstrumentKwargs as PsycopgInstrumentKw
2021
from .integrations.pymongo import PymongoInstrumentKwargs as PymongoInstrumentKwargs
2122
from .integrations.redis import RedisInstrumentKwargs as RedisInstrumentKwargs
2223
from .integrations.sqlalchemy import SQLAlchemyInstrumentKwargs as SQLAlchemyInstrumentKwargs
23-
from .integrations.sqlite3 import SQLite3Connection as SQLite3Connection, SQLite3InstrumentKwargs as SQLite3InstrumentKwargs
24+
from .integrations.sqlite3 import SQLite3Connection as SQLite3Connection
2425
from .integrations.system_metrics import Base as SystemMetricsBase, Config as SystemMetricsConfig
25-
from .integrations.wsgi import WSGIInstrumentKwargs as WSGIInstrumentKwargs
2626
from .json_encoder import logfire_json_dumps as logfire_json_dumps
2727
from .json_schema import JsonSchemaProperties as JsonSchemaProperties, attributes_json_schema as attributes_json_schema, attributes_json_schema_properties as attributes_json_schema_properties, create_json_schema as create_json_schema
2828
from .metrics import ProxyMeterProvider as ProxyMeterProvider
@@ -685,7 +685,7 @@ class Logfire:
685685
Returns:
686686
The instrumented ASGI application.
687687
"""
688-
def instrument_wsgi(self, app: WSGIApplication, capture_headers: bool = False, **kwargs: Unpack[WSGIInstrumentKwargs]) -> WSGIApplication:
688+
def instrument_wsgi(self, app: WSGIApplication, capture_headers: bool = False, request_hook: WSGIRequestHook | None = None, response_hook: WSGIResponseHook | None = None, **kwargs: Any) -> WSGIApplication:
689689
"""Instrument `app` so that spans are automatically created for each request.
690690
691691
Uses the WSGI [`OpenTelemetryMiddleware`][opentelemetry.instrumentation.wsgi.OpenTelemetryMiddleware] under
@@ -697,6 +697,8 @@ class Logfire:
697697
Args:
698698
app: The WSGI application to instrument.
699699
capture_headers: Set to `True` to capture all request and response headers.
700+
request_hook: A function called right after a span is created for a request.
701+
response_hook: A function called right before a span is finished for the response.
700702
**kwargs: Additional keyword arguments to pass to the OpenTelemetry WSGI middleware.
701703
702704
Returns:
@@ -720,7 +722,7 @@ class Logfire:
720722
engine: The `sqlalchemy` engine to instrument, or `None` to instrument all engines.
721723
**kwargs: Additional keyword arguments to pass to the OpenTelemetry `instrument` methods.
722724
"""
723-
def instrument_sqlite3(self, conn: SQLite3Connection = None, **kwargs: Unpack[SQLite3InstrumentKwargs]) -> SQLite3Connection:
725+
def instrument_sqlite3(self, conn: SQLite3Connection = None, **kwargs: Any) -> SQLite3Connection:
724726
"""Instrument the `sqlite3` module or a specific connection so that spans are automatically created for each operation.
725727
726728
Uses the
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from _typeshed import Incomplete
2+
from wsgiref.types import WSGIEnvironment as WSGIEnvironment
3+
4+
ResponseHook: Incomplete
5+
RequestHook: Incomplete

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 = "2.11.0"
7+
version = "2.11.1"
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 = "2.11.0"
7+
version = "2.11.1"
88
description = "The best Python observability tool! 🪵🔥"
99
requires-python = ">=3.8"
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)