Skip to content

Commit d43d91d

Browse files
authored
Release 0.52.0 (#416)
1 parent 3494b30 commit d43d91d

File tree

6 files changed

+101
-3
lines changed

6 files changed

+101
-3
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.52.0] (2024-09-05)
4+
5+
* Handle FastAPI update with SolvedDependencies by @alexmojaki in https://github.com/pydantic/logfire/pull/415
6+
* Add experimental client for the Logfire Query API by @dmontagu in https://github.com/pydantic/logfire/pull/405
7+
* Remove `default_span_processor` parameter from `configure` by @alexmojaki in https://github.com/pydantic/logfire/pull/400
8+
* Remove `custom_scope_suffix` parameter of `Logfire.log` by @alexmojaki in https://github.com/pydantic/logfire/pull/399
9+
* Add missing `service_version` field to `_LogfireConfigData` so that it gets copied into subprocesses by @alexmojaki in https://github.com/pydantic/logfire/pull/401
10+
311
## [v0.51.0] (2024-08-22)
412

513
### BREAKING CHANGES
@@ -266,6 +274,7 @@ First release from new repo!
266274
* Ensure `logfire.testing` doesn't depend on pydantic and eval_type_backport by @alexmojaki in https://github.com/pydantic/logfire/pull/40
267275
* Allow using pydantic plugin with models defined before calling logfire.configure by @alexmojaki in https://github.com/pydantic/logfire/pull/36
268276

277+
[v0.52.0]: https://github.com/pydantic/logfire/compare/v0.51.0...v0.52.0
269278
[v0.51.0]: https://github.com/pydantic/logfire/compare/v0.50.1...v0.51.0
270279
[v0.50.0]: https://github.com/pydantic/logfire/compare/v0.49.1...v0.50.0
271280
[v0.49.1]: https://github.com/pydantic/logfire/compare/v0.49.0...v0.49.1

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class FastAPIInstrumentation:
2323
request_attributes_mapper: Incomplete
2424
excluded_urls_list: Incomplete
2525
def __init__(self, logfire_instance: Logfire, request_attributes_mapper: Callable[[Request | WebSocket, dict[str, Any]], dict[str, Any] | None], excluded_urls: str | None) -> None: ...
26-
async def solve_dependencies(self, request: Request | WebSocket, original: Awaitable[tuple[dict[str, Any], list[Any], Any, Any, Any]]): ...
26+
async def solve_dependencies(self, request: Request | WebSocket, original: Awaitable[Any]) -> Any: ...
2727
async def run_endpoint_function(self, original_run_endpoint_function: Any, request: Request, dependant: Any, values: dict[str, Any], **kwargs: Any) -> Any: ...
2828

2929
class _InstrumentedValues(dict):

logfire-api/logfire_api/experimental/__init__.pyi

Whitespace-only changes.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
from _typeshed import Incomplete
2+
from datetime import datetime
3+
from httpx import AsyncClient, Client, Response, Timeout
4+
from httpx._client import BaseClient
5+
from pyarrow import Table
6+
from types import TracebackType
7+
from typing import Any, Generic, TypeVar, TypedDict
8+
9+
DEFAULT_TIMEOUT: Incomplete
10+
11+
class QueryExecutionError(RuntimeError):
12+
"""Raised when the query execution fails on the server."""
13+
class QueryRequestError(RuntimeError):
14+
"""Raised when the query request is invalid."""
15+
16+
class ColumnDetails(TypedDict):
17+
"""The details of a column in the row-oriented JSON-format query results."""
18+
name: str
19+
datatype: Any
20+
bit_settings: str
21+
22+
class ColumnData(ColumnDetails):
23+
"""The data of a column in the column-oriented JSON-format query results."""
24+
values: list[Any]
25+
26+
class QueryResults(TypedDict):
27+
"""The (column-oriented) results of a JSON-format query."""
28+
columns: list[ColumnData]
29+
30+
class RowQueryResults(TypedDict):
31+
"""The row-oriented results of a JSON-format query."""
32+
columns: list[ColumnDetails]
33+
rows: list[dict[str, Any]]
34+
T = TypeVar('T', bound=BaseClient)
35+
S = TypeVar('S', bound='LogfireQueryClient')
36+
R = TypeVar('R', bound='AsyncLogfireQueryClient')
37+
38+
class _BaseLogfireQueryClient(Generic[T]):
39+
base_url: Incomplete
40+
read_token: Incomplete
41+
timeout: Incomplete
42+
client: Incomplete
43+
def __init__(self, base_url: str, read_token: str, timeout: Timeout, client: type[T], **client_kwargs: Any) -> None: ...
44+
def build_query_params(self, sql: str, min_timestamp: datetime | None = None, max_timestamp: datetime | None = None, limit: int | None = None, row_oriented: bool = False) -> dict[str, str]: ...
45+
def handle_response_errors(self, response: Response) -> None: ...
46+
47+
class LogfireQueryClient(_BaseLogfireQueryClient[Client]):
48+
"""A synchronous client for querying Logfire data."""
49+
def __init__(self, read_token: str, base_url: str = 'https://logfire-api.pydantic.dev/', timeout: Timeout = ..., **client_kwargs: Any) -> None: ...
50+
def __enter__(self) -> S: ...
51+
def __exit__(self, exc_type: type[BaseException] | None = None, exc_value: BaseException | None = None, traceback: TracebackType | None = None) -> None: ...
52+
def query_json(self, sql: str, min_timestamp: datetime | None = None, max_timestamp: datetime | None = None, limit: int | None = None) -> QueryResults:
53+
"""Query Logfire data and return the results as a column-oriented dictionary."""
54+
def query_json_rows(self, sql: str, min_timestamp: datetime | None = None, max_timestamp: datetime | None = None, limit: int | None = None) -> RowQueryResults:
55+
"""Query Logfire data and return the results as a row-oriented dictionary."""
56+
def query_arrow(self, sql: str, min_timestamp: datetime | None = None, max_timestamp: datetime | None = None, limit: int | None = None) -> Table:
57+
"""Query Logfire data and return the results as a pyarrow Table.
58+
59+
Note that pyarrow must be installed for this method to succeed.
60+
61+
You can use `polars.from_arrow(result)` to convert the returned table to a polars DataFrame.
62+
"""
63+
def query_csv(self, sql: str, min_timestamp: datetime | None = None, max_timestamp: datetime | None = None, limit: int | None = None) -> str:
64+
"""Query Logfire data and return the results as a CSV-format string.
65+
66+
Use `polars.read_csv(StringIO(result))` to convert the returned CSV to a polars DataFrame.
67+
"""
68+
69+
class AsyncLogfireQueryClient(_BaseLogfireQueryClient[AsyncClient]):
70+
"""An asynchronous client for querying Logfire data."""
71+
def __init__(self, read_token: str, base_url: str = 'https://logfire-api.pydantic.dev/', timeout: Timeout = ..., **async_client_kwargs: Any) -> None: ...
72+
async def __aenter__(self) -> R: ...
73+
async def __aexit__(self, exc_type: type[BaseException] | None = None, exc_value: BaseException | None = None, traceback: TracebackType | None = None) -> None: ...
74+
async def query_json(self, sql: str, min_timestamp: datetime | None = None, max_timestamp: datetime | None = None, limit: int | None = None) -> QueryResults:
75+
"""Query Logfire data and return the results as a column-oriented dictionary."""
76+
async def query_json_rows(self, sql: str, min_timestamp: datetime | None = None, max_timestamp: datetime | None = None, limit: int | None = None) -> RowQueryResults:
77+
"""Query Logfire data and return the results as a row-oriented dictionary."""
78+
async def query_arrow(self, sql: str, min_timestamp: datetime | None = None, max_timestamp: datetime | None = None, limit: int | None = None) -> Table:
79+
"""Query Logfire data and return the results as a pyarrow Table.
80+
81+
Note that pyarrow must be installed for this method to succeed.
82+
83+
You can use `polars.from_arrow(result)` to convert the returned table to a polars DataFrame.
84+
"""
85+
async def query_csv(self, sql: str, min_timestamp: datetime | None = None, max_timestamp: datetime | None = None, limit: int | None = None) -> str:
86+
"""Query Logfire data and return the results as a CSV-format string.
87+
88+
Use `polars.read_csv(StringIO(result))` to convert the returned CSV to a polars DataFrame.
89+
"""

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

0 commit comments

Comments
 (0)