Skip to content

Commit

Permalink
Release v0.50.0 (#366)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmojaki committed Aug 6, 2024
1 parent be319da commit b10f6e9
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 8 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Release Notes

## [v0.50.0] (2024-08-06)

* **BREAKING CHANGES:** Separate sending to Logfire from using standard OTEL environment variables by @alexmojaki in https://github.com/pydantic/logfire/pull/351. See https://docs.pydantic.dev/logfire/guides/advanced/alternative_backends/ for details. Highlights:
* `OTEL_EXPORTER_OTLP_ENDPOINT` is no longer just an alternative to `LOGFIRE_BASE_URL`. Setting `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT`, and/or `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT` will set up appropriate exporters *in addition* to sending to Logfire, which must be turned off separately if desired. These are basic exporters relying on OTEL defaults. In particular they don't use our custom retrying logic.
* `LOGFIRE_BASE_URL` / `logfire.configure(base_url=...)` is now only intended for actual alternative Logfire backends, which are currently only available to Logfire developers, and unlike `OTEL_EXPORTER_OTLP_ENDPOINT` requires authenticating with Logfire.
* Pending spans are only sent to logfire-specific exporters.
* Add `capture_statement` to Redis instrumentation by @Kludex in https://github.com/pydantic/logfire/pull/355

## [v0.49.1] (2024-08-05)

* Add missing return on instrument methods by @Kludex in https://github.com/pydantic/logfire/pull/360
Expand Down Expand Up @@ -242,6 +250,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.50.0]: https://github.com/pydantic/logfire/compare/v0.49.1...v0.50.0
[v0.49.1]: https://github.com/pydantic/logfire/compare/v0.49.0...v0.49.1
[v0.49.0]: https://github.com/pydantic/logfire/compare/v0.48.1...v0.49.0
[v0.48.1]: https://github.com/pydantic/logfire/compare/v0.48.0...v0.48.1
Expand Down
3 changes: 1 addition & 2 deletions logfire-api/logfire_api/_internal/config.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import dataclasses
import requests
from ..testing import TestExporter as TestExporter
from .auth import DEFAULT_FILE as DEFAULT_FILE, DefaultFile as DefaultFile, is_logged_in as is_logged_in
from .collect_system_info import collect_package_info as collect_package_info
from .config_params import ParamManager as ParamManager, PydanticPluginRecordValues as PydanticPluginRecordValues
Expand Down Expand Up @@ -93,8 +94,6 @@ def configure(*, send_to_logfire: bool | Literal['if-token-present'] | None = No
metric_readers: Legacy argument, use `additional_metric_readers` instead.
additional_metric_readers: Sequence of metric readers to be used in addition to the default reader
which exports metrics to Logfire's API.
Ensure that `preferred_temporality=logfire.METRICS_PREFERRED_TEMPORALITY`
is passed to the constructor of metric readers/exporters that accept the `preferred_temporality` argument.
pydantic_plugin: Configuration for the Pydantic plugin. If `None` uses the `LOGFIRE_PYDANTIC_PLUGIN_*` environment
variables, otherwise defaults to `PydanticPlugin(record='off')`.
fast_shutdown: Whether to shut down exporters and providers quickly, mostly used for tests. Defaults to `False`.
Expand Down
8 changes: 7 additions & 1 deletion logfire-api/logfire_api/_internal/integrations/redis.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from logfire._internal.constants import ATTRIBUTES_MESSAGE_KEY as ATTRIBUTES_MESSAGE_KEY
from logfire._internal.utils import truncate_string as truncate_string
from opentelemetry.trace import Span
from redis import Connection
from typing import Any
Expand All @@ -14,8 +16,12 @@ class RedisInstrumentKwargs(TypedDict, total=False):
response_hook: ResponseHook | None
skip_dep_check: bool

def instrument_redis(**kwargs: Unpack[RedisInstrumentKwargs]) -> None:
def instrument_redis(capture_statement: bool = False, **kwargs: Unpack[RedisInstrumentKwargs]) -> None:
"""Instrument the `redis` module so that spans are automatically created for each operation.
See the `Logfire.instrument_redis` method for details.
Args:
capture_statement: Whether to capture the statement being executed. Defaults to False.
**kwargs: Additional keyword arguments to pass to the `RedisInstrumentor.instrument` method.
"""
6 changes: 5 additions & 1 deletion logfire-api/logfire_api/_internal/main.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -617,12 +617,16 @@ class Logfire:
[OpenTelemetry pymongo Instrumentation](https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/pymongo/pymongo.html)
library, specifically `PymongoInstrumentor().instrument()`, to which it passes `**kwargs`.
"""
def instrument_redis(self, **kwargs: Unpack[RedisInstrumentKwargs]) -> None:
def instrument_redis(self, capture_statement: bool = False, **kwargs: Unpack[RedisInstrumentKwargs]) -> None:
"""Instrument the `redis` module so that spans are automatically created for each operation.
Uses the
[OpenTelemetry Redis Instrumentation](https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/redis/redis.html)
library, specifically `RedisInstrumentor().instrument()`, to which it passes `**kwargs`.
Args:
capture_statement: Set to `True` to capture the statement in the span attributes.
kwargs: Additional keyword arguments to pass to the OpenTelemetry `instrument` methods.
"""
def instrument_mysql(self, conn: MySQLConnection = None, **kwargs: Unpack[MySQLInstrumentKwargs]) -> MySQLConnection:
"""Instrument the `mysql` module or a specific MySQL connection so that spans are automatically created for each operation.
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.49.1"
version = "0.50.0"
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.49.1"
version = "0.50.0"
description = "The best Python observability tool! 🪵🔥"
authors = [
{ name = "Pydantic Team", email = "[email protected]" },
Expand Down
5 changes: 3 additions & 2 deletions tests/otel_integrations/test_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ def redis_container() -> Iterator[RedisContainer]:


@pytest.fixture
def redis(redis_container: RedisContainer) -> Redis:
return redis_container.get_client() # type: ignore
def redis(redis_container: RedisContainer):
with redis_container.get_client() as redis: # type: ignore
yield redis


@pytest.fixture
Expand Down

0 comments on commit b10f6e9

Please sign in to comment.