Skip to content

Commit 108ae4b

Browse files
authored
Release v0.51.0 (#396)
1 parent ec5f440 commit 108ae4b

File tree

7 files changed

+32
-5
lines changed

7 files changed

+32
-5
lines changed

CHANGELOG.md

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

3+
## [v0.51.0] (2024-08-22)
4+
5+
### BREAKING CHANGES
6+
7+
* **System metrics are no longer collected by default** when the correct dependency is installed. Use [`logfire.instrument_system_metrics()`](https://docs.pydantic.dev/logfire/integrations/system_metrics/) to enable system metrics collection. **If you are simply using the old 'Basic System Metrics' dashboard, then no further code changes are required, but that dashboard will no longer work properly and you should create a new dashboard from the template named 'Basic System Metrics (Logfire)'**. If you were using other collected metrics, see the documentation for how to collect those. By @alexmojaki in https://github.com/pydantic/logfire/pull/373
8+
* Stop collecting package versions by @alexmojaki in https://github.com/pydantic/logfire/pull/387
9+
* Don't auto-trace generators by @alexmojaki in https://github.com/pydantic/logfire/pull/386
10+
* Disable ASGI send/receive spans by default by @alexmojaki in https://github.com/pydantic/logfire/pull/371
11+
12+
### Other fixes
13+
14+
* Add py.typed file to logfire-api by @jackmpcollins in https://github.com/pydantic/logfire/pull/379
15+
* Check `LambdaRuntimeClient` before logging tracebacks in `_ensure_flush_after_aws_lambda` by @alexmojaki in https://github.com/pydantic/logfire/pull/388
16+
317
## [v0.50.1] (2024-08-06)
418

519
(Previously released as `v0.50.0`, then yanked due to https://github.com/pydantic/logfire/issues/367)
@@ -252,6 +266,7 @@ First release from new repo!
252266
* Ensure `logfire.testing` doesn't depend on pydantic and eval_type_backport by @alexmojaki in https://github.com/pydantic/logfire/pull/40
253267
* Allow using pydantic plugin with models defined before calling logfire.configure by @alexmojaki in https://github.com/pydantic/logfire/pull/36
254268

269+
[v0.51.0]: https://github.com/pydantic/logfire/compare/v0.50.1...v0.51.0
255270
[v0.50.0]: https://github.com/pydantic/logfire/compare/v0.49.1...v0.50.0
256271
[v0.49.1]: https://github.com/pydantic/logfire/compare/v0.49.0...v0.49.1
257272
[v0.49.0]: https://github.com/pydantic/logfire/compare/v0.48.1...v0.49.0

logfire-api/logfire_api/_internal/auto_trace/rewrite_ast.pyi

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import ast
22
from ..ast_utils import BaseTransformer as BaseTransformer, LogfireArgs as LogfireArgs
33
from ..main import Logfire as Logfire
4+
from _typeshed import Incomplete
45
from dataclasses import dataclass
56
from typing import Any, Callable, ContextManager, TypeVar
67

@@ -31,6 +32,7 @@ class AutoTraceTransformer(BaseTransformer):
3132
"""Return true if the node has a `@no_auto_trace` or `@logfire.no_auto_trace` decorator."""
3233
def visit_ClassDef(self, node: ast.ClassDef): ...
3334
def visit_FunctionDef(self, node: ast.FunctionDef | ast.AsyncFunctionDef): ...
35+
def rewrite_function(self, node: ast.FunctionDef | ast.AsyncFunctionDef, qualname: str) -> ast.AST: ...
3436
def logfire_method_call_node(self, node: ast.FunctionDef | ast.AsyncFunctionDef, qualname: str) -> ast.Call: ...
3537
T = TypeVar('T')
3638

@@ -49,3 +51,7 @@ def no_auto_trace(x: T) -> T:
4951
5052
This decorator simply returns the argument unchanged, so there is zero runtime overhead.
5153
"""
54+
55+
GENERATOR_CODE_FLAGS: Incomplete
56+
57+
def is_generator_function(func_def: ast.FunctionDef | ast.AsyncFunctionDef): ...

logfire-api/logfire_api/_internal/config.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ from .exporters.remove_pending import RemovePendingSpansExporter as RemovePendin
1313
from .exporters.tail_sampling import TailSamplingOptions as TailSamplingOptions, TailSamplingProcessor as TailSamplingProcessor
1414
from .exporters.test import TestExporter as TestExporter
1515
from .integrations.executors import instrument_executors as instrument_executors
16+
from .main import FastLogfireSpan as FastLogfireSpan, LogfireSpan as LogfireSpan
1617
from .metrics import ProxyMeterProvider as ProxyMeterProvider
1718
from .scrubbing import BaseScrubber as BaseScrubber, NOOP_SCRUBBER as NOOP_SCRUBBER, ScrubCallback as ScrubCallback, Scrubber as Scrubber, ScrubbingOptions as ScrubbingOptions
1819
from .stack_info import warn_at_user_stacklevel as warn_at_user_stacklevel
@@ -31,7 +32,9 @@ from opentelemetry.sdk.trace.id_generator import IdGenerator
3132
from pathlib import Path
3233
from typing import Any, Callable, Literal, Sequence
3334
from typing_extensions import Self
35+
from weakref import WeakSet
3436

37+
OPEN_SPANS: WeakSet[LogfireSpan | FastLogfireSpan]
3538
CREDENTIALS_FILENAME: str
3639
COMMON_REQUEST_HEADERS: Incomplete
3740
PROJECT_NAME_PATTERN: str
@@ -80,7 +83,7 @@ def configure(*, send_to_logfire: bool | Literal['if-token-present'] | None = No
8083
`LOGFIRE_CONFIG_DIR` environment variable, otherwise defaults to the current working directory.
8184
data_dir: Directory to store credentials, and logs. If `None` uses the `LOGFIRE_CREDENTIALS_DIR` environment variable, otherwise defaults to `'.logfire'`.
8285
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.
83-
collect_system_metrics: Legacy argument, use `logfire.instrument_system_metrics()` instead.
86+
collect_system_metrics: Legacy argument, use [`logfire.instrument_system_metrics()`](https://docs.pydantic.dev/logfire/integrations/system_metrics/) instead.
8487
id_generator: Generator for span IDs. Defaults to `RandomIdGenerator()` from the OpenTelemetry SDK.
8588
ns_timestamp_generator: Generator for nanosecond timestamps. Defaults to [`time.time_ns`][time.time_ns] from the
8689
Python standard library.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ Base: Incomplete
1414
def get_base_config(base: Base) -> Config: ...
1515
def instrument_system_metrics(logfire_instance: Logfire, config: Config | None = None, base: Base = 'basic'): ...
1616
def measure_simple_cpu_utilization(logfire_instance: Logfire): ...
17+
def measure_process_runtime_cpu_utilization(logfire_instance: Logfire): ...

logfire-api/logfire_api/_internal/main.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import opentelemetry.trace as trace_api
44
from . import async_ as async_
55
from ..version import VERSION as VERSION
66
from .auto_trace import AutoTraceModule as AutoTraceModule, install_auto_tracing as install_auto_tracing
7-
from .config import GLOBAL_CONFIG as GLOBAL_CONFIG, LogfireConfig as LogfireConfig
7+
from .config import GLOBAL_CONFIG as GLOBAL_CONFIG, LogfireConfig as LogfireConfig, OPEN_SPANS as OPEN_SPANS
88
from .constants import ATTRIBUTES_JSON_SCHEMA_KEY as ATTRIBUTES_JSON_SCHEMA_KEY, ATTRIBUTES_LOG_LEVEL_NUM_KEY as ATTRIBUTES_LOG_LEVEL_NUM_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, LEVEL_NUMBERS as LEVEL_NUMBERS, 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
99
from .formatter import logfire_format as logfire_format, logfire_format_with_magic as logfire_format_with_magic
1010
from .instrument import LogfireArgs as LogfireArgs, instrument as instrument
@@ -344,12 +344,14 @@ class Logfire:
344344
def install_auto_tracing(self, modules: Sequence[str] | Callable[[AutoTraceModule], bool], *, check_imported_modules: Literal['error', 'warn', 'ignore'] = 'error', min_duration: float = 0) -> None:
345345
"""Install automatic tracing.
346346
347-
This will trace all function calls in the modules specified by the modules argument.
347+
This will trace all non-generator function calls in the modules specified by the modules argument.
348348
It's equivalent to wrapping the body of every function in matching modules in `with logfire.span(...):`.
349349
350350
!!! note
351351
This function MUST be called before any of the modules to be traced are imported.
352352
353+
Generator functions will not be traced for reasons explained [here](https://docs.pydantic.dev/logfire/guides/advanced/generators/).
354+
353355
This works by inserting a new meta path finder into `sys.meta_path`, so inserting another finder before it
354356
may prevent it from working.
355357

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

0 commit comments

Comments
 (0)