Skip to content

Commit

Permalink
Release 0.48.1 (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmojaki authored Jul 29, 2024
1 parent a9b0019 commit 2134737
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 13 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release Notes

## [v0.48.1] (2024-07-29)

* Handle newer opentelemetry versions by @alexmojaki in https://github.com/pydantic/logfire/pull/337
* More lenient handling of loguru message mismatch and better warnings by @alexmojaki in https://github.com/pydantic/logfire/pull/338
* Add better type hints for HTTPX and AsyncPG by @Kludex in https://github.com/pydantic/logfire/pull/342
* Handle `setuptools` changing `sys.path` for importing `packaging.version` by @alexmojaki in https://github.com/pydantic/logfire/pull/344

## [v0.48.0] (2024-07-24)

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

[v0.48.1]: https://github.com/pydantic/logfire/compare/v0.48.0...v0.48.1
[v0.48.0]: https://github.com/pydantic/logfire/compare/v0.47.0...v0.48.0
[v0.47.0]: https://github.com/pydantic/logfire/compare/v0.46.1...v0.47.0
[v0.46.1]: https://github.com/pydantic/logfire/compare/v0.46.0...v0.46.1
Expand Down
2 changes: 1 addition & 1 deletion logfire-api/logfire_api/_internal/config.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ from .exporters.tail_sampling import TailSamplingOptions as TailSamplingOptions,
from .integrations.executors import instrument_executors as instrument_executors
from .metrics import ProxyMeterProvider as ProxyMeterProvider, configure_metrics as configure_metrics
from .scrubbing import BaseScrubber as BaseScrubber, NOOP_SCRUBBER as NOOP_SCRUBBER, ScrubCallback as ScrubCallback, Scrubber as Scrubber, ScrubbingOptions as ScrubbingOptions
from .stack_info import get_user_frame_and_stacklevel as get_user_frame_and_stacklevel
from .stack_info import warn_at_user_stacklevel as warn_at_user_stacklevel
from .tracer import PendingSpanProcessor as PendingSpanProcessor, ProxyTracerProvider as ProxyTracerProvider
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
from _typeshed import Incomplete
Expand Down
2 changes: 1 addition & 1 deletion logfire-api/logfire_api/_internal/constants.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ DISABLE_CONSOLE_KEY: Incomplete
ATTRIBUTES_JSON_SCHEMA_KEY: Incomplete
ATTRIBUTES_LOGGING_ARGS_KEY: Incomplete
ATTRIBUTES_VALIDATION_ERROR_KEY: str
ATTRIBUTES_SCRUBBED_KEY: str
ATTRIBUTES_SCRUBBED_KEY: Incomplete
NULL_ARGS_KEY: str
PENDING_SPAN_NAME_SUFFIX: str
LOGFIRE_BASE_URL: str
Expand Down
2 changes: 1 addition & 1 deletion logfire-api/logfire_api/_internal/formatter.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import executing
import types
from .constants import ATTRIBUTES_SCRUBBED_KEY as ATTRIBUTES_SCRUBBED_KEY, MESSAGE_FORMATTED_VALUE_LENGTH_LIMIT as MESSAGE_FORMATTED_VALUE_LENGTH_LIMIT
from .scrubbing import BaseScrubber as BaseScrubber, NOOP_SCRUBBER as NOOP_SCRUBBER, ScrubbedNote as ScrubbedNote
from .stack_info import warn_at_user_stacklevel as warn_at_user_stacklevel
from .utils import log_internal_error as log_internal_error, truncate_string as truncate_string
from _typeshed import Incomplete
from logfire._internal.stack_info import get_user_frame_and_stacklevel as get_user_frame_and_stacklevel
from string import Formatter
from types import CodeType as CodeType
from typing import Any, Final, Literal
Expand Down
7 changes: 6 additions & 1 deletion logfire-api/logfire_api/_internal/integrations/asyncpg.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
def instrument_asyncpg() -> None:
from typing_extensions import TypedDict, Unpack

class AsyncPGInstrumentKwargs(TypedDict, total=False):
skip_dep_check: bool

def instrument_asyncpg(**kwargs: Unpack[AsyncPGInstrumentKwargs]) -> None:
"""Instrument the `asyncpg` module so that spans are automatically created for each query.
See the `Logfire.instrument_asyncpg` method for details.
Expand Down
17 changes: 15 additions & 2 deletions logfire-api/logfire_api/_internal/integrations/httpx.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
from typing import Any
from _typeshed import Incomplete
from typing import TypedDict, Unpack

def instrument_httpx(**kwargs: Any):
RequestHook: Incomplete
ResponseHook: Incomplete
AsyncRequestHook: Incomplete
AsyncResponseHook: Incomplete

class HTTPXInstrumentKwargs(TypedDict, total=False):
request_hook: RequestHook
response_hook: ResponseHook
async_request_hook: AsyncRequestHook
async_response_hook: AsyncResponseHook
skip_dep_check: bool

def instrument_httpx(**kwargs: Unpack[HTTPXInstrumentKwargs]) -> None:
"""Instrument the `httpx` module so that spans are automatically created for each request.
See the `Logfire.instrument_httpx` method for details.
Expand Down
6 changes: 4 additions & 2 deletions logfire-api/logfire_api/_internal/main.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ from .config import GLOBAL_CONFIG as GLOBAL_CONFIG, LogfireConfig as LogfireConf
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
from .formatter import logfire_format as logfire_format, logfire_format_with_magic as logfire_format_with_magic
from .instrument import LogfireArgs as LogfireArgs, instrument as instrument
from .integrations.asyncpg import AsyncPGInstrumentKwargs as AsyncPGInstrumentKwargs
from .integrations.celery import CeleryInstrumentKwargs as CeleryInstrumentKwargs
from .integrations.flask import FlaskInstrumentKwargs as FlaskInstrumentKwargs
from .integrations.httpx import HTTPXInstrumentKwargs as HTTPXInstrumentKwargs
from .integrations.psycopg import PsycopgInstrumentKwargs as PsycopgInstrumentKwargs
from .integrations.pymongo import PymongoInstrumentKwargs as PymongoInstrumentKwargs
from .integrations.redis import RedisInstrumentKwargs as RedisInstrumentKwargs
Expand Down Expand Up @@ -503,9 +505,9 @@ class Logfire:
A context manager that will revert the instrumentation when exited.
Use of this context manager is optional.
"""
def instrument_asyncpg(self):
def instrument_asyncpg(self, **kwargs: Unpack[AsyncPGInstrumentKwargs]) -> None:
"""Instrument the `asyncpg` module so that spans are automatically created for each query."""
def instrument_httpx(self, **kwargs: Any):
def instrument_httpx(self, **kwargs: Unpack[HTTPXInstrumentKwargs]) -> None:
"""Instrument the `httpx` module so that spans are automatically created for each request.
Uses the
Expand Down
4 changes: 2 additions & 2 deletions logfire-api/logfire_api/_internal/metrics.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ from abc import ABC
from opentelemetry.metrics import CallbackT as CallbackT, Counter, Histogram, Instrument, Meter, MeterProvider, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter, _Gauge
from opentelemetry.util.types import Attributes
from threading import Lock
from typing import Generic, Sequence, TypeVar
from typing import Any, Generic, Sequence, TypeVar
from weakref import WeakSet

Gauge: Incomplete
Expand All @@ -20,7 +20,7 @@ class ProxyMeterProvider(MeterProvider):
provider: MeterProvider
meters: WeakSet[_ProxyMeter] = ...
lock: Lock = ...
def get_meter(self, name: str, version: str | None = None, schema_url: str | None = None) -> Meter: ...
def get_meter(self, name: str, version: str | None = None, schema_url: str | None = None, *args: Any, **kwargs: Any) -> Meter: ...
def set_meter_provider(self, meter_provider: MeterProvider) -> None: ...
def shutdown(self, timeout_millis: float = 30000) -> None: ...
def force_flush(self, timeout_millis: float = 30000) -> None: ...
Expand Down
1 change: 1 addition & 0 deletions logfire-api/logfire_api/_internal/stack_info.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ def is_user_code(code: CodeType) -> bool:
and they are always called directly from the enclosing function so it makes sense to skip them.
On the other hand, generator expressions and lambdas might be called far away from where they are defined.
"""
def warn_at_user_stacklevel(msg: str, category: type[Warning]): ...
2 changes: 1 addition & 1 deletion logfire-api/logfire_api/_internal/tracer.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ProxyTracerProvider(TracerProvider):
tracers: WeakKeyDictionary[_ProxyTracer, Callable[[], Tracer]] = ...
lock: Lock = ...
def set_provider(self, provider: SDKTracerProvider) -> None: ...
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: ...
def get_tracer(self, *args: Any, is_span_tracer: bool = True, **kwargs: Any) -> _ProxyTracer: ...
def add_span_processor(self, span_processor: Any) -> None: ...
def shutdown(self) -> None: ...
@property
Expand Down
10 changes: 10 additions & 0 deletions logfire-api/logfire_api/integrations/loguru.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
from .._internal.constants import ATTRIBUTES_LOGGING_ARGS_KEY as ATTRIBUTES_LOGGING_ARGS_KEY, ATTRIBUTES_MESSAGE_KEY as ATTRIBUTES_MESSAGE_KEY, ATTRIBUTES_MESSAGE_TEMPLATE_KEY as ATTRIBUTES_MESSAGE_TEMPLATE_KEY
from .._internal.stack_info import warn_at_user_stacklevel as warn_at_user_stacklevel
from .logging import LogfireLoggingHandler as LogfireLoggingHandler
from _typeshed import Incomplete
from logging import LogRecord
from typing import Any

LOGURU_PATH: Incomplete

class LoguruInspectionFailed(RuntimeWarning):
"""Warning raised when magic introspection of loguru stack frames fails.
This may happen if the loguru library changes in a way that breaks the introspection.
"""

class LogfireHandler(LogfireLoggingHandler):
"""A loguru handler that sends logs to **Logfire**."""
custom_scope_suffix: str
Expand Down
2 changes: 1 addition & 1 deletion logfire-api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "logfire-api"
version = "0.48.0"
version = "0.48.1"
description = "Shim for the Logfire SDK which does nothing unless Logfire is installed"
authors = [
{ name = "Pydantic Team", email = "[email protected]" },
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "logfire"
version = "0.48.0"
version = "0.48.1"
description = "The best Python observability tool! 🪵🔥"
authors = [
{ name = "Pydantic Team", email = "[email protected]" },
Expand Down

0 comments on commit 2134737

Please sign in to comment.