Skip to content

Commit 12a29ac

Browse files
authored
Release 0.53.0 (#429)
1 parent 63a0950 commit 12a29ac

File tree

7 files changed

+27
-30
lines changed

7 files changed

+27
-30
lines changed

CHANGELOG.md

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

3+
## [v0.53.0] (2024-09-17)
4+
5+
* Tail sampling by @alexmojaki in https://github.com/pydantic/logfire/pull/407
6+
* Use OTEL scopes better, especially instead of tags by @alexmojaki in https://github.com/pydantic/logfire/pull/420
7+
* Deprecate `project_name` in `logfire.configure()`, remove old kwargs from signature by @alexmojaki in https://github.com/pydantic/logfire/pull/428
8+
* Fix websocket span messages by @alexmojaki in https://github.com/pydantic/logfire/pull/426
9+
* Remove warning about attribute/variable name conflicts in f-string magic by @alexmojaki in https://github.com/pydantic/logfire/pull/418
10+
311
## [v0.52.0] (2024-09-05)
412

513
* Handle FastAPI update with SolvedDependencies by @alexmojaki in https://github.com/pydantic/logfire/pull/415
@@ -274,6 +282,7 @@ First release from new repo!
274282
* Ensure `logfire.testing` doesn't depend on pydantic and eval_type_backport by @alexmojaki in https://github.com/pydantic/logfire/pull/40
275283
* Allow using pydantic plugin with models defined before calling logfire.configure by @alexmojaki in https://github.com/pydantic/logfire/pull/36
276284

285+
[v0.53.0]: https://github.com/pydantic/logfire/compare/v0.52.0...v0.53.0
277286
[v0.52.0]: https://github.com/pydantic/logfire/compare/v0.51.0...v0.52.0
278287
[v0.51.0]: https://github.com/pydantic/logfire/compare/v0.50.1...v0.51.0
279288
[v0.50.0]: https://github.com/pydantic/logfire/compare/v0.49.1...v0.50.0

logfire-api/logfire_api/_internal/config.pyi

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ from .exporters.test import TestExporter as TestExporter
1414
from .integrations.executors import instrument_executors as instrument_executors
1515
from .main import FastLogfireSpan as FastLogfireSpan, LogfireSpan as LogfireSpan
1616
from .metrics import ProxyMeterProvider as ProxyMeterProvider
17-
from .scrubbing import BaseScrubber as BaseScrubber, NOOP_SCRUBBER as NOOP_SCRUBBER, ScrubCallback as ScrubCallback, Scrubber as Scrubber, ScrubbingOptions as ScrubbingOptions
17+
from .scrubbing import BaseScrubber as BaseScrubber, NOOP_SCRUBBER as NOOP_SCRUBBER, Scrubber as Scrubber, ScrubbingOptions as ScrubbingOptions
1818
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
@@ -30,8 +30,8 @@ from opentelemetry.sdk.metrics.export import MetricReader as MetricReader
3030
from opentelemetry.sdk.trace import SpanProcessor
3131
from opentelemetry.sdk.trace.id_generator import IdGenerator
3232
from pathlib import Path
33-
from typing import Any, Callable, Literal, Sequence
34-
from typing_extensions import Self
33+
from typing import Any, Callable, Literal, Sequence, TypedDict
34+
from typing_extensions import Self, Unpack
3535
from weakref import WeakSet
3636

3737
OPEN_SPANS: WeakSet[LogfireSpan | FastLogfireSpan]
@@ -56,23 +56,19 @@ class PydanticPlugin:
5656
include: set[str] = ...
5757
exclude: set[str] = ...
5858

59-
def configure(*, send_to_logfire: bool | Literal['if-token-present'] | None = None, token: str | None = None, project_name: str | None = None, service_name: str | None = None, service_version: str | None = None, trace_sample_rate: float | None = None, console: ConsoleOptions | Literal[False] | None = None, show_summary: bool | None = None, config_dir: Path | str | None = None, data_dir: Path | str | None = None, base_url: str | None = None, collect_system_metrics: None = None, id_generator: IdGenerator | None = None, ns_timestamp_generator: Callable[[], int] | None = None, processors: None = None, additional_span_processors: Sequence[SpanProcessor] | None = None, metric_readers: None = None, additional_metric_readers: Sequence[MetricReader] | None = None, pydantic_plugin: PydanticPlugin | None = None, fast_shutdown: bool = False, scrubbing_patterns: Sequence[str] | None = None, scrubbing_callback: ScrubCallback | None = None, scrubbing: ScrubbingOptions | Literal[False] | None = None, inspect_arguments: bool | None = None, sampling: SamplingOptions | None = None) -> None:
59+
class DeprecatedKwargs(TypedDict): ...
60+
61+
def configure(*, send_to_logfire: bool | Literal['if-token-present'] | None = None, token: str | None = None, service_name: str | None = None, service_version: str | None = None, console: ConsoleOptions | Literal[False] | None = None, show_summary: bool | None = None, config_dir: Path | str | None = None, data_dir: Path | str | None = None, base_url: str | None = None, id_generator: IdGenerator | None = None, ns_timestamp_generator: Callable[[], int] | None = None, additional_span_processors: Sequence[SpanProcessor] | None = None, additional_metric_readers: Sequence[MetricReader] | None = None, pydantic_plugin: PydanticPlugin | None = None, fast_shutdown: bool = False, scrubbing: ScrubbingOptions | Literal[False] | None = None, inspect_arguments: bool | None = None, sampling: SamplingOptions | None = None, **deprecated_kwargs: Unpack[DeprecatedKwargs]) -> None:
6062
"""Configure the logfire SDK.
6163
6264
Args:
6365
send_to_logfire: Whether to send logs to logfire.dev. Defaults to the `LOGFIRE_SEND_TO_LOGFIRE` environment
6466
variable if set, otherwise defaults to `True`. If `if-token-present` is provided, logs will only be sent if
6567
a token is present.
6668
token: The project token. Defaults to the `LOGFIRE_TOKEN` environment variable.
67-
project_name: Name to request when creating a new project. Defaults to the `LOGFIRE_PROJECT_NAME` environment
68-
variable, or the current directory name.
69-
Project name accepts a string value containing alphanumeric characters and
70-
hyphens (-). The hyphen character must not be located at the beginning or end of the string and should
71-
appear in between alphanumeric characters.
7269
service_name: Name of this service. Defaults to the `LOGFIRE_SERVICE_NAME` environment variable.
7370
service_version: Version of this service. Defaults to the `LOGFIRE_SERVICE_VERSION` environment variable, or the
7471
current git commit hash if available.
75-
trace_sample_rate: Deprecated, use `sampling` instead.
7672
console: Whether to control terminal output. If `None` uses the `LOGFIRE_CONSOLE_*` environment variables,
7773
otherwise defaults to `ConsoleOption(colors='auto', indent_spans=True, include_timestamps=True, verbose=False)`.
7874
If `False` disables console output. It can also be disabled by setting `LOGFIRE_CONSOLE` environment variable to `false`.
@@ -82,26 +78,21 @@ def configure(*, send_to_logfire: bool | Literal['if-token-present'] | None = No
8278
`LOGFIRE_CONFIG_DIR` environment variable, otherwise defaults to the current working directory.
8379
data_dir: Directory to store credentials, and logs. If `None` uses the `LOGFIRE_CREDENTIALS_DIR` environment variable, otherwise defaults to `'.logfire'`.
8480
base_url: Root URL for the Logfire API. If `None` uses the `LOGFIRE_BASE_URL` environment variable, otherwise defaults to https://logfire-api.pydantic.dev.
85-
collect_system_metrics: Legacy argument, use [`logfire.instrument_system_metrics()`](https://docs.pydantic.dev/logfire/integrations/system_metrics/) instead.
8681
id_generator: Generator for span IDs. Defaults to `RandomIdGenerator()` from the OpenTelemetry SDK.
8782
ns_timestamp_generator: Generator for nanosecond timestamps. Defaults to [`time.time_ns`][time.time_ns] from the
8883
Python standard library.
89-
processors: Legacy argument, use `additional_span_processors` instead.
9084
additional_span_processors: Span processors to use in addition to the default processor which exports spans to Logfire's API.
91-
metric_readers: Legacy argument, use `additional_metric_readers` instead.
9285
additional_metric_readers: Sequence of metric readers to be used in addition to the default reader
9386
which exports metrics to Logfire's API.
9487
pydantic_plugin: Configuration for the Pydantic plugin. If `None` uses the `LOGFIRE_PYDANTIC_PLUGIN_*` environment
9588
variables, otherwise defaults to `PydanticPlugin(record='off')`.
9689
fast_shutdown: Whether to shut down exporters and providers quickly, mostly used for tests. Defaults to `False`.
9790
scrubbing: Options for scrubbing sensitive data. Set to `False` to disable.
98-
scrubbing_patterns: Deprecated, use `scrubbing=logfire.ScrubbingOptions(extra_patterns=[...])` instead.
99-
scrubbing_callback: Deprecated, use `scrubbing=logfire.ScrubbingOptions(callback=...)` instead.
10091
inspect_arguments: Whether to enable
10192
[f-string magic](https://docs.pydantic.dev/logfire/guides/onboarding_checklist/add_manual_tracing/#f-strings).
10293
If `None` uses the `LOGFIRE_INSPECT_ARGUMENTS` environment variable.
10394
Defaults to `True` if and only if the Python version is at least 3.11.
104-
sampling: Sampling options. TODO document this.
95+
sampling: Sampling options. See the [sampling guide](https://docs.pydantic.dev/logfire/guides/advanced/sampling/).
10596
"""
10697

10798
@dataclasses.dataclass
@@ -118,7 +109,6 @@ class _LogfireConfigData:
118109
base_url: str
119110
send_to_logfire: bool | Literal['if-token-present']
120111
token: str | None
121-
project_name: str | None
122112
service_name: str
123113
service_version: str | None
124114
console: ConsoleOptions | Literal[False] | None
@@ -134,14 +124,14 @@ class _LogfireConfigData:
134124
sampling: SamplingOptions
135125

136126
class LogfireConfig(_LogfireConfigData):
137-
def __init__(self, base_url: str | None = None, send_to_logfire: bool | None = None, token: str | None = None, project_name: str | None = None, service_name: str | None = None, service_version: str | None = None, console: ConsoleOptions | Literal[False] | None = None, show_summary: bool | None = None, config_dir: Path | None = None, data_dir: Path | None = None, id_generator: IdGenerator | None = None, ns_timestamp_generator: Callable[[], int] | None = None, additional_span_processors: Sequence[SpanProcessor] | None = None, additional_metric_readers: Sequence[MetricReader] | None = None, pydantic_plugin: PydanticPlugin | None = None, fast_shutdown: bool = False, scrubbing: ScrubbingOptions | Literal[False] | None = None, inspect_arguments: bool | None = None, sampling: SamplingOptions | None = None) -> None:
127+
def __init__(self, base_url: str | None = None, send_to_logfire: bool | None = None, token: str | None = None, service_name: str | None = None, service_version: str | None = None, console: ConsoleOptions | Literal[False] | None = None, show_summary: bool | None = None, config_dir: Path | None = None, data_dir: Path | None = None, id_generator: IdGenerator | None = None, ns_timestamp_generator: Callable[[], int] | None = None, additional_span_processors: Sequence[SpanProcessor] | None = None, additional_metric_readers: Sequence[MetricReader] | None = None, pydantic_plugin: PydanticPlugin | None = None, fast_shutdown: bool = False, scrubbing: ScrubbingOptions | Literal[False] | None = None, inspect_arguments: bool | None = None, sampling: SamplingOptions | None = None) -> None:
138128
"""Create a new LogfireConfig.
139129
140130
Users should never need to call this directly, instead use `logfire.configure`.
141131
142132
See `_LogfireConfigData` for parameter documentation.
143133
"""
144-
def configure(self, base_url: str | None, send_to_logfire: bool | Literal['if-token-present'] | None, token: str | None, project_name: str | None, service_name: str | None, service_version: str | None, console: ConsoleOptions | Literal[False] | None, show_summary: bool | None, config_dir: Path | None, data_dir: Path | None, id_generator: IdGenerator | None, ns_timestamp_generator: Callable[[], int] | None, additional_span_processors: Sequence[SpanProcessor] | None, additional_metric_readers: Sequence[MetricReader] | None, pydantic_plugin: PydanticPlugin | None, fast_shutdown: bool, scrubbing: ScrubbingOptions | Literal[False] | None, inspect_arguments: bool | None, sampling: SamplingOptions | None) -> None: ...
134+
def configure(self, base_url: str | None, send_to_logfire: bool | Literal['if-token-present'] | None, token: str | None, service_name: str | None, service_version: str | None, console: ConsoleOptions | Literal[False] | None, show_summary: bool | None, config_dir: Path | None, data_dir: Path | None, id_generator: IdGenerator | None, ns_timestamp_generator: Callable[[], int] | None, additional_span_processors: Sequence[SpanProcessor] | None, additional_metric_readers: Sequence[MetricReader] | None, pydantic_plugin: PydanticPlugin | None, fast_shutdown: bool, scrubbing: ScrubbingOptions | Literal[False] | None, inspect_arguments: bool | None, sampling: SamplingOptions | None) -> None: ...
145135
def initialize(self) -> ProxyTracerProvider:
146136
"""Configure internals to start exporting traces and metrics."""
147137
def force_flush(self, timeout_millis: int = 30000) -> bool:
@@ -250,7 +240,7 @@ class LogfireCredentials:
250240
LogfireConfigError: If there was an error configuring the project.
251241
"""
252242
@classmethod
253-
def create_new_project(cls, *, session: requests.Session, logfire_api_url: str, organization: str | None = None, default_organization: bool = False, project_name: str | None = None, force_project_name_prompt: bool = False) -> dict[str, Any]:
243+
def create_new_project(cls, *, session: requests.Session, logfire_api_url: str, organization: str | None = None, default_organization: bool = False, project_name: str | None = None) -> dict[str, Any]:
254244
"""Create a new project and configure it to be used by Logfire.
255245
256246
It creates the project under the organization if both project and organization are valid.
@@ -262,8 +252,6 @@ class LogfireCredentials:
262252
organization: The organization name of the new project.
263253
default_organization: Whether to create the project under the user default organization.
264254
project_name: The default name of the project.
265-
force_project_name_prompt: Whether to force a prompt for the project name.
266-
service_name: Name of the service.
267255
268256
Returns:
269257
The created project informations.
@@ -272,13 +260,11 @@ class LogfireCredentials:
272260
LogfireConfigError: If there was an error creating projects.
273261
"""
274262
@classmethod
275-
def initialize_project(cls, *, logfire_api_url: str, project_name: str | None, session: requests.Session) -> Self:
263+
def initialize_project(cls, *, logfire_api_url: str, session: requests.Session) -> Self:
276264
"""Create a new project or use an existing project on logfire.dev requesting the given project name.
277265
278266
Args:
279267
logfire_api_url: The Logfire API base URL.
280-
project_name: Name for the project.
281-
user_token: The user's token to use to create the new project.
282268
session: HTTP client session used to communicate with the Logfire API.
283269
284270
Returns:

logfire-api/logfire_api/_internal/config_params.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class _DefaultCallback:
3232
BASE_URL: Incomplete
3333
SEND_TO_LOGFIRE: Incomplete
3434
TOKEN: Incomplete
35-
PROJECT_NAME: Incomplete
3635
SERVICE_NAME: Incomplete
3736
SERVICE_VERSION: Incomplete
3837
SHOW_SUMMARY: Incomplete

logfire-api/logfire_api/_internal/scrubbing.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ JsonPath: typing_extensions.TypeAlias
1414

1515
@dataclass
1616
class ScrubMatch:
17-
"""An object passed to the [`scrubbing_callback`][logfire.configure(scrubbing_callback)] function."""
17+
"""An object passed to a [`ScrubbingOptions.callback`][logfire.ScrubbingOptions.callback] function."""
1818
path: JsonPath
1919
value: Any
2020
pattern_match: re.Match[str]

logfire-api/logfire_api/sampling/_tail_sampling.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ class TailSamplingSpanInfo:
5858

5959
@dataclass
6060
class SamplingOptions:
61-
"""Options for [`logfire.configure(sampling=...)`][logfire.configure(sampling)]."""
61+
"""Options for [`logfire.configure(sampling=...)`][logfire.configure(sampling)].
62+
63+
See the [sampling guide](https://docs.pydantic.dev/logfire/guides/advanced/sampling/).
64+
"""
6265
head: float | Sampler = ...
6366
tail: Callable[[TailSamplingSpanInfo], float] | None = ...
6467
@classmethod

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 = "0.52.0"
7+
version = "0.53.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 = "0.52.0"
7+
version = "0.53.0"
88
description = "The best Python observability tool! 🪵🔥"
99
authors = [
1010
{ name = "Pydantic Team", email = "[email protected]" },

0 commit comments

Comments
 (0)