logfire-api 4.34.0__tar.gz → 4.35.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. {logfire_api-4.34.0 → logfire_api-4.35.0}/PKG-INFO +1 -1
  2. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/system_metrics.pyi +1 -1
  3. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/db_api.pyi +10 -22
  4. logfire_api-4.35.0/logfire_api/experimental/query_client.pyi +123 -0
  5. logfire_api-4.35.0/logfire_api/query_client.pyi +3 -0
  6. {logfire_api-4.34.0 → logfire_api-4.35.0}/pyproject.toml +1 -1
  7. logfire_api-4.34.0/logfire_api/experimental/query_client.pyi +0 -100
  8. logfire_api-4.34.0/logfire_api/query_client.pyi +0 -1
  9. {logfire_api-4.34.0 → logfire_api-4.35.0}/.gitignore +0 -0
  10. {logfire_api-4.34.0 → logfire_api-4.35.0}/README.md +0 -0
  11. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/__init__.py +0 -0
  12. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/__init__.pyi +0 -0
  13. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/__init__.pyi +0 -0
  14. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/ast_utils.pyi +0 -0
  15. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/async_.pyi +0 -0
  16. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/auth.pyi +0 -0
  17. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/auto_trace/__init__.pyi +0 -0
  18. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/auto_trace/import_hook.pyi +0 -0
  19. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/auto_trace/rewrite_ast.pyi +0 -0
  20. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/auto_trace/types.pyi +0 -0
  21. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/baggage.pyi +0 -0
  22. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/cli/__init__.pyi +0 -0
  23. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/cli/ai_tools.pyi +0 -0
  24. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/cli/auth.pyi +0 -0
  25. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/cli/gateway.pyi +0 -0
  26. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/cli/gateway_auth.pyi +0 -0
  27. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/cli/prompt.pyi +0 -0
  28. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/cli/run.pyi +0 -0
  29. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/cli.pyi +0 -0
  30. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/client.pyi +0 -0
  31. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/collect_system_info.pyi +0 -0
  32. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/config.pyi +0 -0
  33. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/config_params.pyi +0 -0
  34. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/constants.pyi +0 -0
  35. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/db_statement_summary.pyi +0 -0
  36. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/exporters/__init__.pyi +0 -0
  37. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/exporters/console.pyi +0 -0
  38. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/exporters/dynamic_batch.pyi +0 -0
  39. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/exporters/logs.pyi +0 -0
  40. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/exporters/otlp.pyi +0 -0
  41. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/exporters/processor_wrapper.pyi +0 -0
  42. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/exporters/quiet_metrics.pyi +0 -0
  43. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/exporters/remove_pending.pyi +0 -0
  44. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/exporters/tail_sampling.pyi +0 -0
  45. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/exporters/wrapper.pyi +0 -0
  46. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/formatter.pyi +0 -0
  47. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/forwarding.pyi +0 -0
  48. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/instrument.pyi +0 -0
  49. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/__init__.pyi +0 -0
  50. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/aiohttp_client.pyi +0 -0
  51. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/aiohttp_server.pyi +0 -0
  52. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/asgi.pyi +0 -0
  53. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/asyncpg.pyi +0 -0
  54. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/aws_lambda.pyi +0 -0
  55. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/celery.pyi +0 -0
  56. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/claude_agent_sdk.pyi +0 -0
  57. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/django.pyi +0 -0
  58. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/dspy.pyi +0 -0
  59. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/executors.pyi +0 -0
  60. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/fastapi.pyi +0 -0
  61. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/flask.pyi +0 -0
  62. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/google_genai.pyi +0 -0
  63. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/httpx.pyi +0 -0
  64. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/litellm.pyi +0 -0
  65. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/mcp.pyi +0 -0
  66. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/mysql.pyi +0 -0
  67. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/openai_agents.pyi +0 -0
  68. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/print.pyi +0 -0
  69. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/psycopg.pyi +0 -0
  70. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/pydantic_ai.pyi +0 -0
  71. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/pymongo.pyi +0 -0
  72. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/pytest.pyi +0 -0
  73. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/redis.pyi +0 -0
  74. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/requests.pyi +0 -0
  75. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/sqlalchemy.pyi +0 -0
  76. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/sqlite3.pyi +0 -0
  77. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/starlette.pyi +0 -0
  78. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/surrealdb.pyi +0 -0
  79. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/integrations/wsgi.pyi +0 -0
  80. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/json_encoder.pyi +0 -0
  81. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/json_formatter.pyi +0 -0
  82. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/json_schema.pyi +0 -0
  83. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/json_types.pyi +0 -0
  84. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/logs.pyi +0 -0
  85. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/main.pyi +0 -0
  86. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/metrics.pyi +0 -0
  87. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/scrubbing.pyi +0 -0
  88. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/server_response.pyi +0 -0
  89. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/stack_info.pyi +0 -0
  90. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/tracer.pyi +0 -0
  91. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/ulid.pyi +0 -0
  92. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/_internal/utils.pyi +0 -0
  93. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/cli.pyi +0 -0
  94. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/exceptions.pyi +0 -0
  95. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/experimental/__init__.pyi +0 -0
  96. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/experimental/annotations.pyi +0 -0
  97. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/experimental/api_client.pyi +0 -0
  98. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/experimental/datasets/__init__.pyi +0 -0
  99. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/experimental/forwarding.pyi +0 -0
  100. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/integrations/__init__.pyi +0 -0
  101. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/integrations/aiohttp_client.pyi +0 -0
  102. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/integrations/flask.pyi +0 -0
  103. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/integrations/httpx.pyi +0 -0
  104. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/integrations/logging.pyi +0 -0
  105. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/integrations/loguru.pyi +0 -0
  106. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/integrations/psycopg.pyi +0 -0
  107. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/integrations/pydantic.pyi +0 -0
  108. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/integrations/redis.pyi +0 -0
  109. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/integrations/sqlalchemy.pyi +0 -0
  110. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/integrations/structlog.pyi +0 -0
  111. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/integrations/wsgi.pyi +0 -0
  112. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/propagate.pyi +0 -0
  113. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/py.typed +0 -0
  114. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/sampling/__init__.pyi +0 -0
  115. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/sampling/_tail_sampling.pyi +0 -0
  116. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/types.pyi +0 -0
  117. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/variables/__init__.pyi +0 -0
  118. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/variables/abstract.pyi +0 -0
  119. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/variables/config.pyi +0 -0
  120. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/variables/local.pyi +0 -0
  121. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/variables/remote.pyi +0 -0
  122. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/variables/variable.pyi +0 -0
  123. {logfire_api-4.34.0 → logfire_api-4.35.0}/logfire_api/version.pyi +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: logfire-api
3
- Version: 4.34.0
3
+ Version: 4.35.0
4
4
  Summary: Shim for the Logfire SDK which does nothing unless Logfire is installed
5
5
  Author-email: Pydantic Team <engineering@pydantic.dev>, Samuel Colvin <samuel@pydantic.dev>, Hasan Ramezani <hasan@pydantic.dev>, Adrian Garcia Badaracco <adrian@pydantic.dev>, David Montague <david@pydantic.dev>, Marcelo Trylesinski <marcelo@pydantic.dev>, David Hewitt <david.hewitt@pydantic.dev>, Alex Hall <alex@pydantic.dev>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ from logfire import Logfire as Logfire
4
4
  from typing import Literal
5
5
  from typing_extensions import LiteralString
6
6
 
7
- MetricName: type[Literal['system.cpu.simple_utilization', 'system.cpu.time', 'system.cpu.utilization', 'system.memory.usage', 'system.memory.utilization', 'system.swap.usage', 'system.swap.utilization', 'system.disk.io', 'system.disk.operations', 'system.disk.time', 'system.network.dropped.packets', 'system.network.packets', 'system.network.errors', 'system.network.io', 'system.network.connections', 'system.thread_count', 'process.open_file_descriptor.count', 'process.context_switches', 'process.cpu.time', 'process.cpu.utilization', 'process.cpu.core_utilization', 'process.memory.usage', 'process.memory.virtual', 'process.thread.count', 'process.runtime.gc_count', 'cpython.gc.collected_objects', 'cpython.gc.collections', 'cpython.gc.uncollectable_objects']]
7
+ MetricName: type[Literal['system.cpu.simple_utilization', 'system.cpu.time', 'system.cpu.utilization', 'system.memory.usage', 'system.memory.utilization', 'system.swap.usage', 'system.swap.utilization', 'system.disk.io', 'system.disk.operations', 'system.disk.time', 'system.network.dropped.packets', 'system.network.packets', 'system.network.errors', 'system.network.io', 'system.network.connections', 'system.thread_count', 'process.open_file_descriptor.count', 'process.context_switches', 'process.cpu.time', 'process.cpu.utilization', 'process.cpu.core_utilization', 'process.disk.io', 'process.memory.usage', 'process.memory.virtual', 'process.thread.count', 'process.runtime.gc_count', 'cpython.gc.collected_objects', 'cpython.gc.collections', 'cpython.gc.uncollectable_objects']]
8
8
  Config = dict[MetricName, Iterable[str] | None]
9
9
  CPU_FIELDS: list[LiteralString]
10
10
  MEMORY_FIELDS: list[LiteralString]
@@ -2,7 +2,7 @@ from _typeshed import Incomplete
2
2
  from collections.abc import Sequence
3
3
  from datetime import datetime, timedelta
4
4
  from logfire.experimental.query_client import ColumnDetails as ColumnDetails, LogfireQueryClient as LogfireQueryClient
5
- from typing import Any
5
+ from typing import Any, overload
6
6
 
7
7
  apilevel: str
8
8
  threadsafety: int
@@ -49,11 +49,15 @@ class Cursor:
49
49
  """PEP 249 Cursor that executes queries via `LogfireQueryClient.query_json_rows()`."""
50
50
  rowcount: int
51
51
  arraysize: int
52
- min_timestamp: datetime | None
53
52
  max_timestamp: datetime | None
54
53
  limit: int
55
54
  def __init__(self, connection: Connection) -> None: ...
56
55
  @property
56
+ def min_timestamp(self) -> datetime | None:
57
+ """Per-cursor override for the lower `start_timestamp` bound."""
58
+ @min_timestamp.setter
59
+ def min_timestamp(self, value: datetime | None) -> None: ...
60
+ @property
57
61
  def description(self) -> list[tuple[Any, ...]] | None:
58
62
  """Column description as a list of 7-tuples per PEP 249.
59
63
 
@@ -88,23 +92,7 @@ class Cursor:
88
92
  def __enter__(self) -> Cursor: ...
89
93
  def __exit__(self, *args: Any) -> None: ...
90
94
 
91
- def connect(read_token: str, base_url: str | None = None, timeout: float = 30.0, *, min_timestamp: datetime | timedelta | None = ..., max_timestamp: datetime | None = None, limit: int = ..., **kwargs: Any) -> Connection:
92
- """Create a PEP 249 connection to the Logfire query API.
93
-
94
- Args:
95
- read_token: A Logfire read token for authentication.
96
- base_url: Override the default API base URL (inferred from token region).
97
- timeout: HTTP request timeout in seconds.
98
- min_timestamp: Default lower bound for `start_timestamp` filtering.
99
- Accepts a `datetime` for an exact bound, a `timedelta` for a
100
- relative window (computed as `now - timedelta`), or `None` to
101
- disable the filter. Defaults to 1 day ago.
102
- max_timestamp: Default upper bound for `start_timestamp` filtering.
103
- limit: Default row limit per query (max 10,000). When the number of
104
- returned rows equals the limit a warning is emitted.
105
- **kwargs: Additional keyword arguments forwarded to the underlying
106
- `httpx.Client`.
107
-
108
- Returns:
109
- A PEP 249 `Connection` object.
110
- """
95
+ @overload
96
+ def connect(read_token: str, base_url: str | None = None, timeout: float = 30.0, *, min_timestamp: None, max_timestamp: datetime | None = None, limit: int = ..., **kwargs: Any) -> Connection: ...
97
+ @overload
98
+ def connect(read_token: str, base_url: str | None = None, timeout: float = 30.0, *, min_timestamp: datetime | timedelta = ..., max_timestamp: datetime | None = None, limit: int = ..., **kwargs: Any) -> Connection: ...
@@ -0,0 +1,123 @@
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 logfire import VERSION as VERSION
6
+ from logfire._internal.config import get_base_url_from_token as get_base_url_from_token
7
+ from logfire._internal.stack_info import warn_at_user_stacklevel as warn_at_user_stacklevel
8
+ from pyarrow import Table
9
+ from types import TracebackType
10
+ from typing import Any, Generic, TypeVar, TypedDict, overload
11
+ from typing_extensions import Self
12
+
13
+ DEFAULT_TIMEOUT: Incomplete
14
+
15
+ class QueryExecutionError(RuntimeError):
16
+ """Raised when the query execution fails on the server."""
17
+ class QueryRequestError(RuntimeError):
18
+ """Raised when the query request is invalid."""
19
+ class InfoRequestError(RuntimeError):
20
+ """Raised when the request for read token info fails because of unavailable information."""
21
+
22
+ class ReadTokenInfo(TypedDict, total=False):
23
+ """Information about the read token."""
24
+ organization_name: str
25
+ project_name: str
26
+
27
+ class ColumnDetails(TypedDict):
28
+ """The details of a column in the row-oriented JSON-format query results."""
29
+ name: str
30
+ datatype: Any
31
+ nullable: bool
32
+
33
+ class ColumnData(ColumnDetails):
34
+ """The data of a column in the column-oriented JSON-format query results."""
35
+ values: list[Any]
36
+
37
+ class QueryResults(TypedDict):
38
+ """The (column-oriented) results of a JSON-format query."""
39
+ columns: list[ColumnData]
40
+
41
+ class RowQueryResults(TypedDict):
42
+ """The row-oriented results of a JSON-format query."""
43
+ columns: list[ColumnDetails]
44
+ rows: list[dict[str, Any]]
45
+ T = TypeVar('T', bound=BaseClient)
46
+
47
+ class _BaseLogfireQueryClient(Generic[T]):
48
+ base_url: Incomplete
49
+ read_token: Incomplete
50
+ timeout: Incomplete
51
+ client: T
52
+ def __init__(self, base_url: str, read_token: str, timeout: Timeout, client: type[T], **client_kwargs: Any) -> None: ...
53
+ def handle_response_errors(self, response: Response) -> None: ...
54
+
55
+ class LogfireQueryClient(_BaseLogfireQueryClient[Client]):
56
+ """A synchronous client for querying Logfire data."""
57
+ def __init__(self, read_token: str, base_url: str | None = None, timeout: Timeout = ..., **client_kwargs: Any) -> None: ...
58
+ def __enter__(self) -> Self: ...
59
+ def __exit__(self, exc_type: type[BaseException] | None = None, exc_value: BaseException | None = None, traceback: TracebackType | None = None) -> None: ...
60
+ def info(self) -> ReadTokenInfo:
61
+ """Get information about the read token."""
62
+ def query_json(self, sql: str, min_timestamp: datetime | None = None, max_timestamp: datetime | None = None, limit: int | None = None) -> QueryResults:
63
+ """Query Logfire data and return the results as a column-oriented dictionary."""
64
+ @overload
65
+ def query_json_rows(self, sql: str, min_timestamp: None = None, max_timestamp: datetime | None = None, limit: int | None = None, *, timezone: str | None = None, environment: str | list[str] | None = None) -> RowQueryResults: ...
66
+ @overload
67
+ def query_json_rows(self, sql: str, min_timestamp: datetime, max_timestamp: datetime | None = None, limit: int | None = None, *, timezone: str | None = None, environment: str | list[str] | None = None) -> RowQueryResults: ...
68
+ @overload
69
+ def query_arrow(self, sql: str, min_timestamp: None = None, max_timestamp: datetime | None = None, limit: int | None = None, *, timezone: str | None = None, environment: str | list[str] | None = None) -> Table: ...
70
+ @overload
71
+ def query_arrow(self, sql: str, min_timestamp: datetime, max_timestamp: datetime | None = None, limit: int | None = None, *, timezone: str | None = None, environment: str | list[str] | None = None) -> Table: ...
72
+ @overload
73
+ def query_csv(self, sql: str, min_timestamp: None = None, max_timestamp: datetime | None = None, limit: int | None = None, *, timezone: str | None = None, environment: str | list[str] | None = None) -> str: ...
74
+ @overload
75
+ def query_csv(self, sql: str, min_timestamp: datetime, max_timestamp: datetime | None = None, limit: int | None = None, *, timezone: str | None = None, environment: str | list[str] | None = None) -> str: ...
76
+
77
+ class AsyncLogfireQueryClient(_BaseLogfireQueryClient[AsyncClient]):
78
+ """An asynchronous client for querying Logfire data."""
79
+ def __init__(self, read_token: str, base_url: str | None = None, timeout: Timeout = ..., **async_client_kwargs: Any) -> None: ...
80
+ async def __aenter__(self) -> Self: ...
81
+ async def __aexit__(self, exc_type: type[BaseException] | None = None, exc_value: BaseException | None = None, traceback: TracebackType | None = None) -> None: ...
82
+ async def info(self) -> ReadTokenInfo:
83
+ """Get information about the read token."""
84
+ @overload
85
+ async def query_json_rows(self, sql: str, min_timestamp: None = None, max_timestamp: datetime | None = None, limit: int | None = None, *, timezone: str | None = None, environment: str | list[str] | None = None) -> RowQueryResults: ...
86
+ @overload
87
+ async def query_json_rows(self, sql: str, min_timestamp: datetime, max_timestamp: datetime | None = None, limit: int | None = None, *, timezone: str | None = None, environment: str | list[str] | None = None) -> RowQueryResults: ...
88
+ async def query_json(self, sql: str, min_timestamp: datetime | None = None, max_timestamp: datetime | None = None, limit: int | None = None) -> QueryResults:
89
+ """Query Logfire data and return the results as a column-oriented dictionary."""
90
+ async def query_json_rows(self, sql: str, min_timestamp: datetime | None = None, max_timestamp: datetime | None = None, limit: int | None = None, *, timezone: str | None = None, environment: str | list[str] | None = None) -> RowQueryResults:
91
+ """Query Logfire data and return the results as a row-oriented dictionary.
92
+
93
+ Args:
94
+ sql: The SQL `SELECT` query to execute.
95
+ min_timestamp: The minimum timestamp to use when querying data. If the provided
96
+ [`datetime`][datetime.datetime] doesn't have a timezone set, it is assumed to
97
+ be UTC.
98
+
99
+ /// version-deprecated | v4.35.0
100
+ Not providing a `min_timestamp` is deprecated.
101
+ ///
102
+ max_timestamp: The maximum timestamp to use when querying data. If the provided
103
+ [`datetime`][datetime.datetime] doesn't have a timezone set, it is assumed to
104
+ be UTC.
105
+ limit: The maximum number of rows to query. This value takes priority over the
106
+ `LIMIT` clause in the `sql` query.
107
+ timezone: The timezone to use for the query execution context.
108
+ environment: Restrict rows to the provided environment(s). To only query rows where no environment is set,
109
+ use the empty string (`''`).
110
+
111
+ Returns:
112
+ A dictionary with two entries:
113
+ * `columns`: A list of column details including the name, datatype and whether the column is nullable.
114
+ * `rows`: The list of rows matching the query.
115
+ """
116
+ @overload
117
+ async def query_arrow(self, sql: str, min_timestamp: None = None, max_timestamp: datetime | None = None, limit: int | None = None, *, timezone: str | None = None, environment: str | list[str] | None = None) -> Table: ...
118
+ @overload
119
+ async def query_arrow(self, sql: str, min_timestamp: datetime, max_timestamp: datetime | None = None, limit: int | None = None, *, timezone: str | None = None, environment: str | list[str] | None = None) -> Table: ...
120
+ @overload
121
+ async def query_csv(self, sql: str, min_timestamp: None = None, max_timestamp: datetime | None = None, limit: int | None = None, *, timezone: str | None = None, environment: str | list[str] | None = None) -> str: ...
122
+ @overload
123
+ async def query_csv(self, sql: str, min_timestamp: datetime, max_timestamp: datetime | None = None, limit: int | None = None, *, timezone: str | None = None, environment: str | list[str] | None = None) -> str: ...
@@ -0,0 +1,3 @@
1
+ from .experimental.query_client import AsyncLogfireQueryClient as AsyncLogfireQueryClient, ColumnData as ColumnData, ColumnDetails as ColumnDetails, InfoRequestError as InfoRequestError, LogfireQueryClient as LogfireQueryClient, QueryExecutionError as QueryExecutionError, QueryRequestError as QueryRequestError, QueryResults as QueryResults, ReadTokenInfo as ReadTokenInfo, RowQueryResults as RowQueryResults
2
+
3
+ __all__ = ['QueryExecutionError', 'QueryRequestError', 'InfoRequestError', 'ReadTokenInfo', 'ColumnDetails', 'ColumnData', 'QueryResults', 'RowQueryResults', 'LogfireQueryClient', 'AsyncLogfireQueryClient']
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "logfire-api"
7
- version = "4.34.0"
7
+ version = "4.35.0"
8
8
  description = "Shim for the Logfire SDK which does nothing unless Logfire is installed"
9
9
  authors = [
10
10
  { name = "Pydantic Team", email = "engineering@pydantic.dev" },
@@ -1,100 +0,0 @@
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 logfire import VERSION as VERSION
6
- from logfire._internal.config import get_base_url_from_token as get_base_url_from_token
7
- from pyarrow import Table
8
- from types import TracebackType
9
- from typing import Any, Generic, TypeVar, TypedDict
10
- from typing_extensions import Self
11
-
12
- DEFAULT_TIMEOUT: Incomplete
13
-
14
- class QueryExecutionError(RuntimeError):
15
- """Raised when the query execution fails on the server."""
16
- class QueryRequestError(RuntimeError):
17
- """Raised when the query request is invalid."""
18
- class InfoRequestError(RuntimeError):
19
- """Raised when the request for read token info fails because of unavailable information."""
20
-
21
- class ReadTokenInfo(TypedDict, total=False):
22
- """Information about the read token."""
23
- organization_name: str
24
- project_name: str
25
-
26
- class ColumnDetails(TypedDict):
27
- """The details of a column in the row-oriented JSON-format query results."""
28
- name: str
29
- datatype: Any
30
- nullable: bool
31
-
32
- class ColumnData(ColumnDetails):
33
- """The data of a column in the column-oriented JSON-format query results."""
34
- values: list[Any]
35
-
36
- class QueryResults(TypedDict):
37
- """The (column-oriented) results of a JSON-format query."""
38
- columns: list[ColumnData]
39
-
40
- class RowQueryResults(TypedDict):
41
- """The row-oriented results of a JSON-format query."""
42
- columns: list[ColumnDetails]
43
- rows: list[dict[str, Any]]
44
- T = TypeVar('T', bound=BaseClient)
45
-
46
- class _BaseLogfireQueryClient(Generic[T]):
47
- base_url: Incomplete
48
- read_token: Incomplete
49
- timeout: Incomplete
50
- client: T
51
- def __init__(self, base_url: str, read_token: str, timeout: Timeout, client: type[T], **client_kwargs: Any) -> None: ...
52
- def handle_response_errors(self, response: Response) -> None: ...
53
-
54
- class LogfireQueryClient(_BaseLogfireQueryClient[Client]):
55
- """A synchronous client for querying Logfire data."""
56
- def __init__(self, read_token: str, base_url: str | None = None, timeout: Timeout = ..., **client_kwargs: Any) -> None: ...
57
- def __enter__(self) -> Self: ...
58
- def __exit__(self, exc_type: type[BaseException] | None = None, exc_value: BaseException | None = None, traceback: TracebackType | None = None) -> None: ...
59
- def info(self) -> ReadTokenInfo:
60
- """Get information about the read token."""
61
- def query_json(self, sql: str, min_timestamp: datetime | None = None, max_timestamp: datetime | None = None, limit: int | None = None) -> QueryResults:
62
- """Query Logfire data and return the results as a column-oriented dictionary."""
63
- def query_json_rows(self, sql: str, min_timestamp: datetime | None = None, max_timestamp: datetime | None = None, limit: int | None = None) -> RowQueryResults:
64
- """Query Logfire data and return the results as a row-oriented dictionary."""
65
- def query_arrow(self, sql: str, min_timestamp: datetime | None = None, max_timestamp: datetime | None = None, limit: int | None = None) -> Table:
66
- """Query Logfire data and return the results as a pyarrow Table.
67
-
68
- Note that pyarrow must be installed for this method to succeed.
69
-
70
- You can use `polars.from_arrow(result)` to convert the returned table to a polars DataFrame.
71
- """
72
- def query_csv(self, sql: str, min_timestamp: datetime | None = None, max_timestamp: datetime | None = None, limit: int | None = None) -> str:
73
- """Query Logfire data and return the results as a CSV-format string.
74
-
75
- Use `polars.read_csv(StringIO(result))` to convert the returned CSV to a polars DataFrame.
76
- """
77
-
78
- class AsyncLogfireQueryClient(_BaseLogfireQueryClient[AsyncClient]):
79
- """An asynchronous client for querying Logfire data."""
80
- def __init__(self, read_token: str, base_url: str | None = None, timeout: Timeout = ..., **async_client_kwargs: Any) -> None: ...
81
- async def __aenter__(self) -> Self: ...
82
- async def __aexit__(self, exc_type: type[BaseException] | None = None, exc_value: BaseException | None = None, traceback: TracebackType | None = None) -> None: ...
83
- async def info(self) -> ReadTokenInfo:
84
- """Get information about the read token."""
85
- async def query_json(self, sql: str, min_timestamp: datetime | None = None, max_timestamp: datetime | None = None, limit: int | None = None) -> QueryResults:
86
- """Query Logfire data and return the results as a column-oriented dictionary."""
87
- async def query_json_rows(self, sql: str, min_timestamp: datetime | None = None, max_timestamp: datetime | None = None, limit: int | None = None) -> RowQueryResults:
88
- """Query Logfire data and return the results as a row-oriented dictionary."""
89
- async def query_arrow(self, sql: str, min_timestamp: datetime | None = None, max_timestamp: datetime | None = None, limit: int | None = None) -> Table:
90
- """Query Logfire data and return the results as a pyarrow Table.
91
-
92
- Note that pyarrow must be installed for this method to succeed.
93
-
94
- You can use `polars.from_arrow(result)` to convert the returned table to a polars DataFrame.
95
- """
96
- async def query_csv(self, sql: str, min_timestamp: datetime | None = None, max_timestamp: datetime | None = None, limit: int | None = None) -> str:
97
- """Query Logfire data and return the results as a CSV-format string.
98
-
99
- Use `polars.read_csv(StringIO(result))` to convert the returned CSV to a polars DataFrame.
100
- """
@@ -1 +0,0 @@
1
- from .experimental.query_client import *
File without changes
File without changes