logfire-api 4.40.0__tar.gz → 4.41.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.
- {logfire_api-4.40.0 → logfire_api-4.41.0}/PKG-INFO +2 -2
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/cli/__init__.pyi +5 -1
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/cli/auth.pyi +1 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/cli/gateway.pyi +1 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/client.pyi +9 -2
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/collect_system_info.pyi +1 -1
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/config.pyi +17 -4
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/constants.pyi +1 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/exporters/otlp.pyi +2 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/claude_agent_sdk.pyi +13 -0
- logfire_api-4.41.0/logfire_api/_internal/integrations/system_metrics.pyi +49 -0
- logfire_api-4.41.0/logfire_api/_internal/interactive.pyi +26 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/main.pyi +3 -3
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/utils.pyi +3 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/pyproject.toml +1 -1
- logfire_api-4.40.0/logfire_api/_internal/integrations/system_metrics.pyi +0 -21
- {logfire_api-4.40.0 → logfire_api-4.41.0}/.gitignore +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/README.md +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/__init__.py +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/__init__.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/__init__.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/ast_utils.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/async_.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/auth.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/auto_trace/__init__.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/auto_trace/import_hook.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/auto_trace/rewrite_ast.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/auto_trace/types.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/baggage.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/cli/ai_tools.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/cli/gateway_auth.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/cli/prompt.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/cli/run.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/cli.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/config_params.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/db_statement_summary.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/exporters/__init__.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/exporters/console.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/exporters/dynamic_batch.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/exporters/logs.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/exporters/processor_wrapper.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/exporters/quiet_metrics.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/exporters/remove_pending.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/exporters/tail_sampling.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/exporters/wrapper.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/formatter.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/forwarding.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/instrument.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/__init__.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/aiohttp_client.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/aiohttp_server.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/asgi.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/asyncpg.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/aws_lambda.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/celery.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/django.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/dspy.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/executors.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/fastapi.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/flask.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/google_genai.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/httpx.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/litellm.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/mcp.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/mysql.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/openai_agents.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/print.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/psycopg.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/pydantic_ai.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/pymongo.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/pytest.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/redis.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/requests.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/sqlalchemy.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/sqlite3.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/starlette.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/surrealdb.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/wsgi.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/json_encoder.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/json_formatter.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/json_schema.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/json_types.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/logs.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/metrics.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/scrubbing.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/server_response.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/stack_info.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/tracer.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/ulid.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/cli.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/db_api.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/exceptions.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/experimental/__init__.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/experimental/annotations.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/experimental/api_client.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/experimental/datasets/__init__.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/experimental/forwarding.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/experimental/query_client.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/integrations/__init__.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/integrations/aiohttp_client.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/integrations/flask.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/integrations/httpx.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/integrations/logging.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/integrations/loguru.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/integrations/psycopg.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/integrations/pydantic.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/integrations/redis.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/integrations/sqlalchemy.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/integrations/structlog.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/integrations/wsgi.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/propagate.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/py.typed +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/query_client.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/sampling/__init__.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/sampling/_tail_sampling.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/types.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/variables/__init__.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/variables/_handlebars.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/variables/abstract.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/variables/composition.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/variables/config.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/variables/local.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/variables/remote.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/variables/template_validation.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/variables/variable.pyi +0 -0
- {logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/version.pyi +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: logfire-api
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.41.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
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import argparse
|
|
2
2
|
from collections.abc import Sequence
|
|
3
|
-
from typing import Any
|
|
3
|
+
from typing import Any, NamedTuple
|
|
4
4
|
|
|
5
5
|
__all__ = ['main', 'logfire_info']
|
|
6
6
|
|
|
7
|
+
class SavedReadToken(NamedTuple):
|
|
8
|
+
token: str
|
|
9
|
+
base_url: str
|
|
10
|
+
|
|
7
11
|
def logfire_info() -> str:
|
|
8
12
|
"""Show versions of logfire, OS and related packages."""
|
|
9
13
|
|
|
@@ -2,6 +2,7 @@ import argparse
|
|
|
2
2
|
from ...exceptions import LogfireConfigError as LogfireConfigError
|
|
3
3
|
from ..auth import DEFAULT_FILE as DEFAULT_FILE, UserTokenCollection as UserTokenCollection, poll_for_token as poll_for_token, request_device_code as request_device_code
|
|
4
4
|
from ..config import REGIONS as REGIONS
|
|
5
|
+
from ..interactive import is_non_interactive as is_non_interactive, require_answer as require_answer
|
|
5
6
|
|
|
6
7
|
def parse_auth(args: argparse.Namespace) -> None:
|
|
7
8
|
"""Authenticate with Logfire.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import argparse
|
|
2
2
|
import httpx
|
|
3
|
+
from ..interactive import require_answer as require_answer
|
|
3
4
|
from .ai_tools import AiToolIntegration as AiToolIntegration, LOCAL_TOKEN_PLACEHOLDER as LOCAL_TOKEN_PLACEHOLDER, ai_tool_names as ai_tool_names, gateway_template_values as gateway_template_values, resolve_ai_tool as resolve_ai_tool
|
|
4
5
|
from .gateway_auth import CimdOAuthClient as CimdOAuthClient, GATEWAY_CIMD_PATH as GATEWAY_CIMD_PATH, GatewayAuth as GatewayAuth, GatewayError as GatewayError, OAuthSession as OAuthSession, discover_oauth_metadata as discover_oauth_metadata
|
|
5
6
|
from _typeshed import Incomplete
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
from .auth import UserToken as UserToken, UserTokenCollection as UserTokenCollection
|
|
2
|
+
from .constants import HTTP_CONNECT_TIMEOUT as HTTP_CONNECT_TIMEOUT
|
|
2
3
|
from .server_response import ServerResponseCallback as ServerResponseCallback, install_logfire_response_hook as install_logfire_response_hook
|
|
3
4
|
from .utils import UnexpectedResponse as UnexpectedResponse
|
|
4
5
|
from _typeshed import Incomplete
|
|
6
|
+
from datetime import datetime
|
|
5
7
|
from logfire.exceptions import LogfireConfigError as LogfireConfigError
|
|
6
8
|
from logfire.version import VERSION as VERSION
|
|
7
9
|
from typing import Any
|
|
@@ -55,7 +57,12 @@ class LogfireClient:
|
|
|
55
57
|
"""
|
|
56
58
|
def create_write_token(self, organization: str, project_name: str) -> dict[str, Any]:
|
|
57
59
|
"""Create a write token for the given project in the given organization."""
|
|
58
|
-
def create_read_token(self, organization: str, project_name: str) -> dict[str, Any]:
|
|
59
|
-
"""Create a read token for the given project in the given organization.
|
|
60
|
+
def create_read_token(self, organization: str, project_name: str, expires_at: datetime | None = None) -> dict[str, Any]:
|
|
61
|
+
"""Create a read token for the given project in the given organization.
|
|
62
|
+
|
|
63
|
+
`expires_at` bounds how long the token stays valid. The CLI has no way to revoke
|
|
64
|
+
one, so a token it stores on disk gets an expiry; a token it prints for the caller
|
|
65
|
+
to place somewhere else does not, because we do not know what it was used for.
|
|
66
|
+
"""
|
|
60
67
|
def get_prompt(self, organization: str, project_name: str, issue: str) -> dict[str, Any]:
|
|
61
68
|
"""Get a prompt to be used with your favorite LLM."""
|
|
@@ -16,6 +16,7 @@ from .exporters.remove_pending import RemovePendingSpansExporter as RemovePendin
|
|
|
16
16
|
from .exporters.test import TestExporter as TestExporter
|
|
17
17
|
from .forwarding import OTLPForwardingManager as OTLPForwardingManager
|
|
18
18
|
from .integrations.executors import instrument_executors as instrument_executors
|
|
19
|
+
from .interactive import require_answer as require_answer
|
|
19
20
|
from .logs import ProxyLoggerProvider as ProxyLoggerProvider
|
|
20
21
|
from .main import Logfire as Logfire
|
|
21
22
|
from .metrics import ProxyMeterProvider as ProxyMeterProvider
|
|
@@ -76,7 +77,12 @@ class AdvancedOptions:
|
|
|
76
77
|
emit_configuration_span: bool | None = ...
|
|
77
78
|
server_response_hook: ServerResponseCallback | None = ...
|
|
78
79
|
resource_detectors: Sequence[ResourceDetector | str] | None = ...
|
|
79
|
-
def generate_base_url(self, token: str) -> str:
|
|
80
|
+
def generate_base_url(self, token: str, warn_unknown_region: bool = True) -> str:
|
|
81
|
+
"""Resolve the base API URL for `token`, honouring an explicitly configured `base_url`.
|
|
82
|
+
|
|
83
|
+
Unknown regions warn by default. The background credential check opts out because the
|
|
84
|
+
synchronous exporter setup has already emitted the same warning.
|
|
85
|
+
"""
|
|
80
86
|
|
|
81
87
|
@dataclass
|
|
82
88
|
class PydanticPlugin:
|
|
@@ -192,7 +198,7 @@ def configure(*, local: bool = False, send_to_logfire: bool | Literal['if-token-
|
|
|
192
198
|
or provide a `MetricsOptions` object to configure metrics, e.g. additional metric readers.
|
|
193
199
|
scrubbing: Options for scrubbing sensitive data. Set to `False` to disable.
|
|
194
200
|
inspect_arguments: Whether to enable
|
|
195
|
-
[f-string magic](https://
|
|
201
|
+
[f-string magic](https://pydantic.dev/docs/logfire/instrument/python/add-manual-tracing/#f-strings).
|
|
196
202
|
If `None` uses the `LOGFIRE_INSPECT_ARGUMENTS` environment variable.
|
|
197
203
|
|
|
198
204
|
Defaults to `True` if and only if the Python version is at least 3.11.
|
|
@@ -416,8 +422,15 @@ class LogfireCredentials:
|
|
|
416
422
|
def print_token_summary(self) -> None:
|
|
417
423
|
"""Print a summary of the existing project."""
|
|
418
424
|
|
|
419
|
-
def get_base_url_from_token(token: str) -> str:
|
|
420
|
-
"""Get the base API URL from the token's region.
|
|
425
|
+
def get_base_url_from_token(token: str, warn_unknown_region: bool = True) -> str:
|
|
426
|
+
"""Get the base API URL from the token's region.
|
|
427
|
+
|
|
428
|
+
Args:
|
|
429
|
+
token: The Logfire token to read the region from.
|
|
430
|
+
warn_unknown_region: Whether to emit a `LogfireConfigWarning` when the token's region is
|
|
431
|
+
unrecognised and the US region is used as a fallback. This is on by default for every
|
|
432
|
+
caller; disable it only when the same token has already produced the warning.
|
|
433
|
+
"""
|
|
421
434
|
def get_git_revision_hash() -> str:
|
|
422
435
|
"""Get the current git commit hash."""
|
|
423
436
|
def sanitize_project_name(name: str) -> str:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import atexit
|
|
2
2
|
import requests
|
|
3
|
+
from ..constants import HTTP_CONNECT_TIMEOUT as HTTP_CONNECT_TIMEOUT
|
|
3
4
|
from ..utils import logger as logger, platform_is_emscripten as platform_is_emscripten
|
|
4
5
|
from .wrapper import WrapperLogExporter as WrapperLogExporter, WrapperSpanExporter as WrapperSpanExporter
|
|
5
6
|
from _typeshed import Incomplete
|
|
@@ -25,6 +26,7 @@ class BodySizeCheckingOTLPSpanExporter(OTLPSpanExporter):
|
|
|
25
26
|
|
|
26
27
|
class OTLPExporterHttpSession(Session):
|
|
27
28
|
"""A requests.Session subclass that defers failed requests to a DiskRetryer."""
|
|
29
|
+
def request(self, method: str, url: str, **kwargs: Any): ...
|
|
28
30
|
def post(self, url: str, data: bytes, **kwargs: Any): ...
|
|
29
31
|
@cached_property
|
|
30
32
|
def retryer(self) -> DiskRetryer: ...
|
{logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/claude_agent_sdk.pyi
RENAMED
|
@@ -4,6 +4,7 @@ from claude_agent_sdk.types import HookContext, SyncHookJSONOutput
|
|
|
4
4
|
from contextlib import AbstractContextManager
|
|
5
5
|
from logfire._internal.integrations.llm_providers.semconv import CONVERSATION_ID as CONVERSATION_ID, ChatMessage as ChatMessage, ERROR_TYPE as ERROR_TYPE, INPUT_MESSAGES as INPUT_MESSAGES, MessagePart as MessagePart, OPERATION_NAME as OPERATION_NAME, OUTPUT_MESSAGES as OUTPUT_MESSAGES, OutputMessage as OutputMessage, PROVIDER_NAME as PROVIDER_NAME, REQUEST_MODEL as REQUEST_MODEL, RESPONSE_MODEL as RESPONSE_MODEL, ReasoningPart as ReasoningPart, SYSTEM as SYSTEM, SYSTEM_INSTRUCTIONS as SYSTEM_INSTRUCTIONS, TOOL_CALL_ARGUMENTS as TOOL_CALL_ARGUMENTS, TOOL_CALL_ID as TOOL_CALL_ID, TOOL_CALL_RESULT as TOOL_CALL_RESULT, TOOL_NAME as TOOL_NAME, TextPart as TextPart, ToolCallPart as ToolCallPart, ToolCallResponsePart as ToolCallResponsePart
|
|
6
6
|
from logfire._internal.main import Logfire as Logfire, LogfireSpan as LogfireSpan
|
|
7
|
+
from logfire._internal.stack_info import get_user_stack_info as get_user_stack_info
|
|
7
8
|
from logfire._internal.utils import handle_internal_errors as handle_internal_errors
|
|
8
9
|
from typing import Any
|
|
9
10
|
|
|
@@ -35,7 +36,19 @@ class _ConversationState:
|
|
|
35
36
|
root_span: Incomplete
|
|
36
37
|
active_tool_spans: dict[str, LogfireSpan]
|
|
37
38
|
model: str | None
|
|
39
|
+
announced_tool_ids: set[str]
|
|
40
|
+
tool_announcement_timeout: float
|
|
41
|
+
code_attrs: Incomplete
|
|
38
42
|
def __init__(self, *, logfire: Logfire, root_span: LogfireSpan, input_messages: list[ChatMessage], system_instructions: list[TextPart] | None = None) -> None: ...
|
|
43
|
+
async def wait_for_tool_announcement(self, tool_use_id: str) -> None:
|
|
44
|
+
"""Wait until the assistant message announcing `tool_use_id` has been handled.
|
|
45
|
+
|
|
46
|
+
The CLI sends the assistant message (containing the `tool_use` block) before it
|
|
47
|
+
invokes the PreToolUse hook, but hooks run in separate anyio tasks, so the hook
|
|
48
|
+
can be scheduled before the main task has applied that message to this state.
|
|
49
|
+
Closing the chat span at that point would lose its output and model attributes.
|
|
50
|
+
The timeout is a safety valve for tool calls that are never announced.
|
|
51
|
+
"""
|
|
39
52
|
def add_tool_result(self, tool_use_id: str, tool_name: str, result: Any) -> None:
|
|
40
53
|
"""Record a tool result to include in the next chat span's input messages."""
|
|
41
54
|
def open_chat_span(self) -> None:
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from _typeshed import Incomplete
|
|
2
|
+
from collections.abc import Iterable
|
|
3
|
+
from logfire import Logfire as Logfire
|
|
4
|
+
from typing import Literal
|
|
5
|
+
from typing_extensions import LiteralString
|
|
6
|
+
|
|
7
|
+
MetricName: type[Literal['system.cpu.simple_utilization', 'system.cpu.time', 'system.cpu.utilization', 'system.cpu.load_average.1m', '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.process.count', '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
|
+
Config = dict[MetricName, Iterable[str] | None]
|
|
9
|
+
CPU_FIELDS: list[LiteralString]
|
|
10
|
+
MEMORY_FIELDS: list[LiteralString]
|
|
11
|
+
FULL_CONFIG: Config
|
|
12
|
+
BASIC_CONFIG: Config
|
|
13
|
+
Base: Incomplete
|
|
14
|
+
|
|
15
|
+
def get_base_config(base: Base) -> Config: ...
|
|
16
|
+
def instrument_system_metrics(logfire_instance: Logfire, config: Config | None = None, base: Base = 'basic'): ...
|
|
17
|
+
def measure_simple_cpu_utilization(logfire_instance: Logfire): ...
|
|
18
|
+
def measure_process_runtime_cpu_utilization(logfire_instance: Logfire): ...
|
|
19
|
+
def measure_process_cpu_utilization(logfire_instance: Logfire): ...
|
|
20
|
+
def measure_process_cpu_core_utilization(logfire_instance: Logfire):
|
|
21
|
+
"""Same as process.cpu.utilization, but not divided by the number of available cores."""
|
|
22
|
+
def measure_system_cpu_load_average_1m(logfire_instance: Logfire):
|
|
23
|
+
"""1-minute system load average.
|
|
24
|
+
|
|
25
|
+
OTel semconv defines no load average metric. The system metrics spec only
|
|
26
|
+
floats `system.linux.cpu.load_1m` as a hypothetical illustration of OS-prefixed
|
|
27
|
+
naming, so there's nothing to conform to. The name, gauge instrument, and
|
|
28
|
+
`{thread}` unit here match the OTel Collector's `hostmetrics` load scraper,
|
|
29
|
+
which is where most host load averages reaching Logfire come from. Matching it
|
|
30
|
+
means SDK-reported and Collector-reported hosts land on one series instead of two.
|
|
31
|
+
|
|
32
|
+
Upstream `SystemMetricsInstrumentor` doesn't emit this. On Windows,
|
|
33
|
+
`psutil.getloadavg()` is an emulated polling shim — the first call returns 0
|
|
34
|
+
and subsequent values update every ~5s.
|
|
35
|
+
"""
|
|
36
|
+
def measure_system_process_count(logfire_instance: Logfire):
|
|
37
|
+
"""Total number of processes on the system.
|
|
38
|
+
|
|
39
|
+
Name, instrument, and unit follow OTel semconv's `system.process.count`
|
|
40
|
+
(an UpDownCounter in `{process}`). Its `process.state` attribute is omitted:
|
|
41
|
+
`psutil.pids()` is a single cheap syscall, while splitting by state needs a
|
|
42
|
+
`process_iter` over every process and multiplies the series count. This metric
|
|
43
|
+
is in the basic base, so that cost would land on every default install.
|
|
44
|
+
|
|
45
|
+
Note that the OTel Collector's `hostmetrics` receiver still emits the older
|
|
46
|
+
`system.processes.count` for the same measurement.
|
|
47
|
+
|
|
48
|
+
Upstream `SystemMetricsInstrumentor` doesn't emit this.
|
|
49
|
+
"""
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from logfire.exceptions import LogfireConfigError as LogfireConfigError
|
|
2
|
+
|
|
3
|
+
class NonInteractiveError(LogfireConfigError):
|
|
4
|
+
"""A prompt was needed, but `--non-interactive` says nobody can answer it.
|
|
5
|
+
|
|
6
|
+
Carries the guidance the user needs rather than a traceback: the CLI catches this and
|
|
7
|
+
prints `message` before exiting non-zero.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
def set_non_interactive(value: bool) -> None:
|
|
11
|
+
"""Record whether prompts are allowed. Called once, from CLI argument parsing."""
|
|
12
|
+
def is_non_interactive() -> bool:
|
|
13
|
+
"""Whether the caller declared that it cannot answer prompts."""
|
|
14
|
+
def require_answer(question: str, remedy: str, *more_remedies: str) -> None:
|
|
15
|
+
"""Fail instead of prompting, when the caller said it cannot answer.
|
|
16
|
+
|
|
17
|
+
At least one remedy is required by the signature: refusing to prompt while offering no
|
|
18
|
+
way forward just moves the dead end, and telling the caller what to pass is the entire
|
|
19
|
+
value of failing here rather than blocking.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
question: what would have been asked, in plain terms.
|
|
23
|
+
remedy: a runnable suggestion.
|
|
24
|
+
more_remedies: further suggestions. Each is printed on its own line, so each must
|
|
25
|
+
be individually pasteable -- `--org a|b` is a shell pipeline, not a suggestion.
|
|
26
|
+
"""
|
|
@@ -402,7 +402,7 @@ class Logfire:
|
|
|
402
402
|
def install_auto_tracing(self, modules: Sequence[str] | Callable[[AutoTraceModule], bool], *, min_duration: float, check_imported_modules: Literal['error', 'warn', 'ignore'] = 'error') -> None:
|
|
403
403
|
"""Install automatic tracing.
|
|
404
404
|
|
|
405
|
-
See the [Auto-Tracing guide](https://pydantic.dev/docs/logfire/instrument/add-auto-tracing/)
|
|
405
|
+
See the [Auto-Tracing guide](https://pydantic.dev/docs/logfire/instrument/python/add-auto-tracing/)
|
|
406
406
|
for more info.
|
|
407
407
|
|
|
408
408
|
This will trace all non-generator function calls in the modules specified by the modules argument.
|
|
@@ -1443,7 +1443,7 @@ class Logfire:
|
|
|
1443
1443
|
|
|
1444
1444
|
This is for proxying telemetry from a browser to Logfire so that the write token doesn\'t need to be
|
|
1445
1445
|
exposed in the frontend code.
|
|
1446
|
-
See https://pydantic.dev/docs/logfire/typescript
|
|
1446
|
+
See https://pydantic.dev/docs/logfire/instrument/typescript/packages/browser/#python-backend-proxy
|
|
1447
1447
|
for more details.
|
|
1448
1448
|
|
|
1449
1449
|
We recommend protecting the endpoint that uses this method with authentication, rate limiting, and CORS.
|
|
@@ -1466,7 +1466,7 @@ class Logfire:
|
|
|
1466
1466
|
|
|
1467
1467
|
This is for proxying telemetry from a browser to Logfire so that the write token doesn't need to be
|
|
1468
1468
|
exposed in the frontend code.
|
|
1469
|
-
See https://pydantic.dev/docs/logfire/typescript
|
|
1469
|
+
See https://pydantic.dev/docs/logfire/instrument/typescript/packages/browser/#python-backend-proxy
|
|
1470
1470
|
for more details.
|
|
1471
1471
|
|
|
1472
1472
|
We recommend protecting the endpoint that uses this method with authentication, rate limiting, and CORS.
|
|
@@ -78,6 +78,9 @@ class UnexpectedResponse(RequestException):
|
|
|
78
78
|
def raise_for_status(cls, response: Response) -> None:
|
|
79
79
|
"""Like the requests method, but raises a more informative exception."""
|
|
80
80
|
|
|
81
|
+
READ_TOKEN_FILENAME: str
|
|
82
|
+
DATA_DIR_FILENAMES: Incomplete
|
|
83
|
+
|
|
81
84
|
def ensure_data_dir_exists(data_dir: Path) -> None: ...
|
|
82
85
|
def get_version(version: str) -> Version:
|
|
83
86
|
"""Return a packaging.version.Version object from a version string.
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "logfire-api"
|
|
7
|
-
version = "4.
|
|
7
|
+
version = "4.41.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,21 +0,0 @@
|
|
|
1
|
-
from _typeshed import Incomplete
|
|
2
|
-
from collections.abc import Iterable
|
|
3
|
-
from logfire import Logfire as Logfire
|
|
4
|
-
from typing import Literal
|
|
5
|
-
from typing_extensions import LiteralString
|
|
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.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
|
-
Config = dict[MetricName, Iterable[str] | None]
|
|
9
|
-
CPU_FIELDS: list[LiteralString]
|
|
10
|
-
MEMORY_FIELDS: list[LiteralString]
|
|
11
|
-
FULL_CONFIG: Config
|
|
12
|
-
BASIC_CONFIG: Config
|
|
13
|
-
Base: Incomplete
|
|
14
|
-
|
|
15
|
-
def get_base_config(base: Base) -> Config: ...
|
|
16
|
-
def instrument_system_metrics(logfire_instance: Logfire, config: Config | None = None, base: Base = 'basic'): ...
|
|
17
|
-
def measure_simple_cpu_utilization(logfire_instance: Logfire): ...
|
|
18
|
-
def measure_process_runtime_cpu_utilization(logfire_instance: Logfire): ...
|
|
19
|
-
def measure_process_cpu_utilization(logfire_instance: Logfire): ...
|
|
20
|
-
def measure_process_cpu_core_utilization(logfire_instance: Logfire):
|
|
21
|
-
"""Same as process.cpu.utilization, but not divided by the number of available cores."""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/exporters/processor_wrapper.pyi
RENAMED
|
File without changes
|
|
File without changes
|
{logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/exporters/remove_pending.pyi
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/aiohttp_client.pyi
RENAMED
|
File without changes
|
{logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/aiohttp_server.pyi
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/google_genai.pyi
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/openai_agents.pyi
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{logfire_api-4.40.0 → logfire_api-4.41.0}/logfire_api/_internal/integrations/pydantic_ai.pyi
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|