Skip to content

Commit 2134737

Browse files
authored
Release 0.48.1 (#345)
1 parent a9b0019 commit 2134737

File tree

13 files changed

+52
-13
lines changed

13 files changed

+52
-13
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+
## [v0.48.1] (2024-07-29)
4+
5+
* Handle newer opentelemetry versions by @alexmojaki in https://github.com/pydantic/logfire/pull/337
6+
* More lenient handling of loguru message mismatch and better warnings by @alexmojaki in https://github.com/pydantic/logfire/pull/338
7+
* Add better type hints for HTTPX and AsyncPG by @Kludex in https://github.com/pydantic/logfire/pull/342
8+
* Handle `setuptools` changing `sys.path` for importing `packaging.version` by @alexmojaki in https://github.com/pydantic/logfire/pull/344
9+
310
## [v0.48.0] (2024-07-24)
411

512
* Add `instrument_celery` method by @Kludex in https://github.com/pydantic/logfire/pull/322
@@ -221,6 +228,7 @@ First release from new repo!
221228
* Ensure `logfire.testing` doesn't depend on pydantic and eval_type_backport by @alexmojaki in https://github.com/pydantic/logfire/pull/40
222229
* Allow using pydantic plugin with models defined before calling logfire.configure by @alexmojaki in https://github.com/pydantic/logfire/pull/36
223230

231+
[v0.48.1]: https://github.com/pydantic/logfire/compare/v0.48.0...v0.48.1
224232
[v0.48.0]: https://github.com/pydantic/logfire/compare/v0.47.0...v0.48.0
225233
[v0.47.0]: https://github.com/pydantic/logfire/compare/v0.46.1...v0.47.0
226234
[v0.46.1]: https://github.com/pydantic/logfire/compare/v0.46.0...v0.46.1

logfire-api/logfire_api/_internal/config.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ from .exporters.tail_sampling import TailSamplingOptions as TailSamplingOptions,
1515
from .integrations.executors import instrument_executors as instrument_executors
1616
from .metrics import ProxyMeterProvider as ProxyMeterProvider, configure_metrics as configure_metrics
1717
from .scrubbing import BaseScrubber as BaseScrubber, NOOP_SCRUBBER as NOOP_SCRUBBER, ScrubCallback as ScrubCallback, Scrubber as Scrubber, ScrubbingOptions as ScrubbingOptions
18-
from .stack_info import get_user_frame_and_stacklevel as get_user_frame_and_stacklevel
18+
from .stack_info import warn_at_user_stacklevel as warn_at_user_stacklevel
1919
from .tracer import PendingSpanProcessor as PendingSpanProcessor, ProxyTracerProvider as ProxyTracerProvider
2020
from .utils import UnexpectedResponse as UnexpectedResponse, ensure_data_dir_exists as ensure_data_dir_exists, get_version as get_version, read_toml_file as read_toml_file, suppress_instrumentation as suppress_instrumentation
2121
from _typeshed import Incomplete

logfire-api/logfire_api/_internal/constants.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ DISABLE_CONSOLE_KEY: Incomplete
2323
ATTRIBUTES_JSON_SCHEMA_KEY: Incomplete
2424
ATTRIBUTES_LOGGING_ARGS_KEY: Incomplete
2525
ATTRIBUTES_VALIDATION_ERROR_KEY: str
26-
ATTRIBUTES_SCRUBBED_KEY: str
26+
ATTRIBUTES_SCRUBBED_KEY: Incomplete
2727
NULL_ARGS_KEY: str
2828
PENDING_SPAN_NAME_SUFFIX: str
2929
LOGFIRE_BASE_URL: str

logfire-api/logfire_api/_internal/formatter.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import executing
33
import types
44
from .constants import ATTRIBUTES_SCRUBBED_KEY as ATTRIBUTES_SCRUBBED_KEY, MESSAGE_FORMATTED_VALUE_LENGTH_LIMIT as MESSAGE_FORMATTED_VALUE_LENGTH_LIMIT
55
from .scrubbing import BaseScrubber as BaseScrubber, NOOP_SCRUBBER as NOOP_SCRUBBER, ScrubbedNote as ScrubbedNote
6+
from .stack_info import warn_at_user_stacklevel as warn_at_user_stacklevel
67
from .utils import log_internal_error as log_internal_error, truncate_string as truncate_string
78
from _typeshed import Incomplete
8-
from logfire._internal.stack_info import get_user_frame_and_stacklevel as get_user_frame_and_stacklevel
99
from string import Formatter
1010
from types import CodeType as CodeType
1111
from typing import Any, Final, Literal

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
def instrument_asyncpg() -> None:
1+
from typing_extensions import TypedDict, Unpack
2+
3+
class AsyncPGInstrumentKwargs(TypedDict, total=False):
4+
skip_dep_check: bool
5+
6+
def instrument_asyncpg(**kwargs: Unpack[AsyncPGInstrumentKwargs]) -> None:
27
"""Instrument the `asyncpg` module so that spans are automatically created for each query.
38
49
See the `Logfire.instrument_asyncpg` method for details.

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1-
from typing import Any
1+
from _typeshed import Incomplete
2+
from typing import TypedDict, Unpack
23

3-
def instrument_httpx(**kwargs: Any):
4+
RequestHook: Incomplete
5+
ResponseHook: Incomplete
6+
AsyncRequestHook: Incomplete
7+
AsyncResponseHook: Incomplete
8+
9+
class HTTPXInstrumentKwargs(TypedDict, total=False):
10+
request_hook: RequestHook
11+
response_hook: ResponseHook
12+
async_request_hook: AsyncRequestHook
13+
async_response_hook: AsyncResponseHook
14+
skip_dep_check: bool
15+
16+
def instrument_httpx(**kwargs: Unpack[HTTPXInstrumentKwargs]) -> None:
417
"""Instrument the `httpx` module so that spans are automatically created for each request.
518
619
See the `Logfire.instrument_httpx` method for details.

logfire-api/logfire_api/_internal/main.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ from .config import GLOBAL_CONFIG as GLOBAL_CONFIG, LogfireConfig as LogfireConf
99
from .constants import ATTRIBUTES_JSON_SCHEMA_KEY as ATTRIBUTES_JSON_SCHEMA_KEY, ATTRIBUTES_MESSAGE_KEY as ATTRIBUTES_MESSAGE_KEY, ATTRIBUTES_MESSAGE_TEMPLATE_KEY as ATTRIBUTES_MESSAGE_TEMPLATE_KEY, ATTRIBUTES_SAMPLE_RATE_KEY as ATTRIBUTES_SAMPLE_RATE_KEY, ATTRIBUTES_SPAN_TYPE_KEY as ATTRIBUTES_SPAN_TYPE_KEY, ATTRIBUTES_TAGS_KEY as ATTRIBUTES_TAGS_KEY, ATTRIBUTES_VALIDATION_ERROR_KEY as ATTRIBUTES_VALIDATION_ERROR_KEY, DISABLE_CONSOLE_KEY as DISABLE_CONSOLE_KEY, LevelName as LevelName, NULL_ARGS_KEY as NULL_ARGS_KEY, OTLP_MAX_INT_SIZE as OTLP_MAX_INT_SIZE, log_level_attributes as log_level_attributes
1010
from .formatter import logfire_format as logfire_format, logfire_format_with_magic as logfire_format_with_magic
1111
from .instrument import LogfireArgs as LogfireArgs, instrument as instrument
12+
from .integrations.asyncpg import AsyncPGInstrumentKwargs as AsyncPGInstrumentKwargs
1213
from .integrations.celery import CeleryInstrumentKwargs as CeleryInstrumentKwargs
1314
from .integrations.flask import FlaskInstrumentKwargs as FlaskInstrumentKwargs
15+
from .integrations.httpx import HTTPXInstrumentKwargs as HTTPXInstrumentKwargs
1416
from .integrations.psycopg import PsycopgInstrumentKwargs as PsycopgInstrumentKwargs
1517
from .integrations.pymongo import PymongoInstrumentKwargs as PymongoInstrumentKwargs
1618
from .integrations.redis import RedisInstrumentKwargs as RedisInstrumentKwargs
@@ -503,9 +505,9 @@ class Logfire:
503505
A context manager that will revert the instrumentation when exited.
504506
Use of this context manager is optional.
505507
"""
506-
def instrument_asyncpg(self):
508+
def instrument_asyncpg(self, **kwargs: Unpack[AsyncPGInstrumentKwargs]) -> None:
507509
"""Instrument the `asyncpg` module so that spans are automatically created for each query."""
508-
def instrument_httpx(self, **kwargs: Any):
510+
def instrument_httpx(self, **kwargs: Unpack[HTTPXInstrumentKwargs]) -> None:
509511
"""Instrument the `httpx` module so that spans are automatically created for each request.
510512
511513
Uses the

logfire-api/logfire_api/_internal/metrics.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from abc import ABC
44
from opentelemetry.metrics import CallbackT as CallbackT, Counter, Histogram, Instrument, Meter, MeterProvider, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter, _Gauge
55
from opentelemetry.util.types import Attributes
66
from threading import Lock
7-
from typing import Generic, Sequence, TypeVar
7+
from typing import Any, Generic, Sequence, TypeVar
88
from weakref import WeakSet
99

1010
Gauge: Incomplete
@@ -20,7 +20,7 @@ class ProxyMeterProvider(MeterProvider):
2020
provider: MeterProvider
2121
meters: WeakSet[_ProxyMeter] = ...
2222
lock: Lock = ...
23-
def get_meter(self, name: str, version: str | None = None, schema_url: str | None = None) -> Meter: ...
23+
def get_meter(self, name: str, version: str | None = None, schema_url: str | None = None, *args: Any, **kwargs: Any) -> Meter: ...
2424
def set_meter_provider(self, meter_provider: MeterProvider) -> None: ...
2525
def shutdown(self, timeout_millis: float = 30000) -> None: ...
2626
def force_flush(self, timeout_millis: float = 30000) -> None: ...

logfire-api/logfire_api/_internal/stack_info.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ def is_user_code(code: CodeType) -> bool:
3737
and they are always called directly from the enclosing function so it makes sense to skip them.
3838
On the other hand, generator expressions and lambdas might be called far away from where they are defined.
3939
"""
40+
def warn_at_user_stacklevel(msg: str, category: type[Warning]): ...

logfire-api/logfire_api/_internal/tracer.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ProxyTracerProvider(TracerProvider):
2222
tracers: WeakKeyDictionary[_ProxyTracer, Callable[[], Tracer]] = ...
2323
lock: Lock = ...
2424
def set_provider(self, provider: SDKTracerProvider) -> None: ...
25-
def get_tracer(self, instrumenting_module_name: str, instrumenting_library_version: str | None = None, schema_url: str | None = None, is_span_tracer: bool = True) -> _ProxyTracer: ...
25+
def get_tracer(self, *args: Any, is_span_tracer: bool = True, **kwargs: Any) -> _ProxyTracer: ...
2626
def add_span_processor(self, span_processor: Any) -> None: ...
2727
def shutdown(self) -> None: ...
2828
@property

0 commit comments

Comments
 (0)