logfire-api 5.0.0__tar.gz → 5.1.1__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-5.0.0 → logfire_api-5.1.1}/PKG-INFO +1 -1
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/__init__.py +4 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/__init__.pyi +2 -1
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/cli/run.pyi +1 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/client.pyi +1 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/config.pyi +1 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/exporters/otlp.pyi +2 -0
- logfire_api-5.1.1/logfire_api/_internal/http_transport.pyi +47 -0
- logfire_api-5.1.1/logfire_api/_internal/integrations/litestar.pyi +7 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/logs.pyi +2 -2
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/main.pyi +24 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/pyproject.toml +1 -1
- {logfire_api-5.0.0 → logfire_api-5.1.1}/.gitignore +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/README.md +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/__init__.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/ast_utils.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/async_.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/auth.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/auto_trace/__init__.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/auto_trace/import_hook.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/auto_trace/rewrite_ast.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/auto_trace/types.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/baggage.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/cli/__init__.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/cli/ai_tools.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/cli/auth.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/cli/gateway.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/cli/gateway_auth.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/cli/prompt.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/cli.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/collect_system_info.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/config_params.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/constants.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/db_statement_summary.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/exporters/__init__.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/exporters/console.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/exporters/dynamic_batch.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/exporters/logs.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/exporters/processor_wrapper.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/exporters/quiet_metrics.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/exporters/remove_pending.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/exporters/tail_sampling.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/exporters/wrapper.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/formatter.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/forwarding.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/instrument.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/__init__.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/aiohttp_client.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/aiohttp_server.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/asgi.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/asyncpg.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/aws_lambda.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/celery.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/claude_agent_sdk.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/django.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/dspy.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/executors.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/fastapi.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/flask.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/google_genai.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/httpx.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/litellm.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/mcp.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/mysql.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/openai_agents.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/print.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/psycopg.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/pydantic_ai.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/pymongo.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/pytest.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/redis.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/requests.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/sqlalchemy.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/sqlite3.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/starlette.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/surrealdb.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/system_metrics.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/wsgi.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/interactive.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/json_encoder.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/json_formatter.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/json_schema.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/json_types.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/metrics.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/scrubbing.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/server_response.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/stack_info.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/tracer.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/ulid.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/utils.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/cli.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/db_api.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/exceptions.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/experimental/__init__.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/experimental/annotations.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/experimental/api_client.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/experimental/datasets/__init__.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/experimental/query_client.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/integrations/__init__.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/integrations/aiohttp_client.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/integrations/flask.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/integrations/httpx.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/integrations/logging.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/integrations/loguru.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/integrations/psycopg.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/integrations/pydantic.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/integrations/redis.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/integrations/sqlalchemy.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/integrations/structlog.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/integrations/wsgi.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/propagate.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/py.typed +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/query_client.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/sampling/__init__.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/sampling/_tail_sampling.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/types.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/variables/__init__.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/variables/_handlebars.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/variables/abstract.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/variables/composition.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/variables/config.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/variables/local.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/variables/remote.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/variables/template_validation.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/variables/variable.pyi +0 -0
- {logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/version.pyi +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: logfire-api
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.1.1
|
|
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
|
|
@@ -167,6 +167,9 @@ except ImportError:
|
|
|
167
167
|
|
|
168
168
|
def instrument_starlette(self, *args, **kwargs) -> None: ...
|
|
169
169
|
|
|
170
|
+
def instrument_litestar(self, app, *args, **kwargs):
|
|
171
|
+
return app
|
|
172
|
+
|
|
170
173
|
def instrument_django(self, *args, **kwargs) -> None: ...
|
|
171
174
|
|
|
172
175
|
def instrument_psycopg(self, *args, **kwargs) -> None: ...
|
|
@@ -256,6 +259,7 @@ except ImportError:
|
|
|
256
259
|
instrument_django = DEFAULT_LOGFIRE_INSTANCE.instrument_django
|
|
257
260
|
instrument_flask = DEFAULT_LOGFIRE_INSTANCE.instrument_flask
|
|
258
261
|
instrument_starlette = DEFAULT_LOGFIRE_INSTANCE.instrument_starlette
|
|
262
|
+
instrument_litestar = DEFAULT_LOGFIRE_INSTANCE.instrument_litestar
|
|
259
263
|
instrument_aiohttp_client = DEFAULT_LOGFIRE_INSTANCE.instrument_aiohttp_client
|
|
260
264
|
instrument_aiohttp_server = DEFAULT_LOGFIRE_INSTANCE.instrument_aiohttp_server
|
|
261
265
|
instrument_sqlalchemy = DEFAULT_LOGFIRE_INSTANCE.instrument_sqlalchemy
|
|
@@ -16,7 +16,7 @@ from logfire.propagate import attach_context as attach_context, get_context as g
|
|
|
16
16
|
from logfire.sampling import SamplingOptions as SamplingOptions
|
|
17
17
|
from typing import Any
|
|
18
18
|
|
|
19
|
-
__all__ = ['Logfire', 'LogfireSpan', 'LevelName', 'AdvancedOptions', 'ConsoleOptions', 'CodeSource', 'PydanticPlugin', 'configure', 'span', 'instrument', 'log', 'trace', 'debug', 'notice', 'info', 'warn', 'warning', 'error', 'exception', 'fatal', 'force_flush', 'log_slow_async_callbacks', 'install_auto_tracing', 'instrument_asgi', 'instrument_wsgi', 'instrument_pydantic', 'instrument_pydantic_ai', 'instrument_fastapi', 'instrument_openai', 'instrument_openai_agents', 'instrument_anthropic', 'instrument_google_genai', 'instrument_litellm', 'instrument_dspy', 'instrument_print', 'instrument_asyncpg', 'instrument_httpx', 'instrument_celery', 'instrument_requests', 'instrument_psycopg', 'instrument_django', 'instrument_flask', 'instrument_starlette', 'instrument_aiohttp_client', 'instrument_aiohttp_server', 'instrument_sqlalchemy', 'instrument_sqlite3', 'instrument_aws_lambda', 'instrument_redis', 'instrument_pymongo', 'instrument_mysql', 'instrument_surrealdb', 'instrument_system_metrics', 'instrument_mcp', 'instrument_claude_agent_sdk', 'AutoTraceModule', 'with_tags', 'with_settings', 'suppress_scopes', 'shutdown', 'no_auto_trace', 'ScrubMatch', 'ScrubbingOptions', 'VERSION', 'add_non_user_code_prefix', 'suppress_instrumentation', 'StructlogProcessor', 'LogfireLoggingHandler', 'loguru_handler', 'SamplingOptions', 'MetricsOptions', 'VariablesOptions', 'LocalVariablesOptions', 'variables', 'var', 'template_var', 'variables_get', 'variables_push', 'variables_push_types', 'variables_validate', 'variables_push_config', 'variables_pull_config', 'variables_build_config', 'logfire_info', 'get_baggage', 'set_baggage', 'get_context', 'attach_context', 'url_from_eval', 'forward_export_request', 'forward_export_request_starlette']
|
|
19
|
+
__all__ = ['Logfire', 'LogfireSpan', 'LevelName', 'AdvancedOptions', 'ConsoleOptions', 'CodeSource', 'PydanticPlugin', 'configure', 'span', 'instrument', 'log', 'trace', 'debug', 'notice', 'info', 'warn', 'warning', 'error', 'exception', 'fatal', 'force_flush', 'log_slow_async_callbacks', 'install_auto_tracing', 'instrument_asgi', 'instrument_wsgi', 'instrument_pydantic', 'instrument_pydantic_ai', 'instrument_fastapi', 'instrument_openai', 'instrument_openai_agents', 'instrument_anthropic', 'instrument_google_genai', 'instrument_litellm', 'instrument_dspy', 'instrument_print', 'instrument_asyncpg', 'instrument_httpx', 'instrument_celery', 'instrument_requests', 'instrument_psycopg', 'instrument_django', 'instrument_flask', 'instrument_starlette', 'instrument_litestar', 'instrument_aiohttp_client', 'instrument_aiohttp_server', 'instrument_sqlalchemy', 'instrument_sqlite3', 'instrument_aws_lambda', 'instrument_redis', 'instrument_pymongo', 'instrument_mysql', 'instrument_surrealdb', 'instrument_system_metrics', 'instrument_mcp', 'instrument_claude_agent_sdk', 'AutoTraceModule', 'with_tags', 'with_settings', 'suppress_scopes', 'shutdown', 'no_auto_trace', 'ScrubMatch', 'ScrubbingOptions', 'VERSION', 'add_non_user_code_prefix', 'suppress_instrumentation', 'StructlogProcessor', 'LogfireLoggingHandler', 'loguru_handler', 'SamplingOptions', 'MetricsOptions', 'VariablesOptions', 'LocalVariablesOptions', 'variables', 'var', 'template_var', 'variables_get', 'variables_push', 'variables_push_types', 'variables_validate', 'variables_push_config', 'variables_pull_config', 'variables_build_config', 'logfire_info', 'get_baggage', 'set_baggage', 'get_context', 'attach_context', 'url_from_eval', 'forward_export_request', 'forward_export_request_starlette']
|
|
20
20
|
|
|
21
21
|
DEFAULT_LOGFIRE_INSTANCE = Logfire()
|
|
22
22
|
span = DEFAULT_LOGFIRE_INSTANCE.span
|
|
@@ -44,6 +44,7 @@ instrument_psycopg = DEFAULT_LOGFIRE_INSTANCE.instrument_psycopg
|
|
|
44
44
|
instrument_django = DEFAULT_LOGFIRE_INSTANCE.instrument_django
|
|
45
45
|
instrument_flask = DEFAULT_LOGFIRE_INSTANCE.instrument_flask
|
|
46
46
|
instrument_starlette = DEFAULT_LOGFIRE_INSTANCE.instrument_starlette
|
|
47
|
+
instrument_litestar = DEFAULT_LOGFIRE_INSTANCE.instrument_litestar
|
|
47
48
|
instrument_aiohttp_client = DEFAULT_LOGFIRE_INSTANCE.instrument_aiohttp_client
|
|
48
49
|
instrument_aiohttp_server = DEFAULT_LOGFIRE_INSTANCE.instrument_aiohttp_server
|
|
49
50
|
instrument_sqlalchemy = DEFAULT_LOGFIRE_INSTANCE.instrument_sqlalchemy
|
|
@@ -14,6 +14,7 @@ TARGET_PACKAGE_ALIASES: Incomplete
|
|
|
14
14
|
INSTRUMENTATION_CALL_ARGUMENTS: Incomplete
|
|
15
15
|
MINIMUM_INSTRUMENTATION_VERSIONS: Incomplete
|
|
16
16
|
OTEL_INSTRUMENTATION_MAP: Incomplete
|
|
17
|
+
INSTRUMENTATION_TO_EXTRA: dict[str, str]
|
|
17
18
|
|
|
18
19
|
@dataclass(frozen=True, order=True)
|
|
19
20
|
class InstrumentationRecommendation:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from .auth import UserToken as UserToken, UserTokenCollection as UserTokenCollection
|
|
2
2
|
from .constants import HTTP_CONNECT_TIMEOUT as HTTP_CONNECT_TIMEOUT
|
|
3
|
+
from .http_transport import install_connection_policy as install_connection_policy
|
|
3
4
|
from .server_response import ServerResponseCallback as ServerResponseCallback, install_logfire_response_hook as install_logfire_response_hook
|
|
4
5
|
from .utils import UnexpectedResponse as UnexpectedResponse
|
|
5
6
|
from _typeshed import Incomplete
|
|
@@ -15,6 +15,7 @@ from .exporters.quiet_metrics import QuietMetricExporter as QuietMetricExporter
|
|
|
15
15
|
from .exporters.remove_pending import RemovePendingSpansExporter as RemovePendingSpansExporter
|
|
16
16
|
from .exporters.test import TestExporter as TestExporter
|
|
17
17
|
from .forwarding import OTLPForwardingManager as OTLPForwardingManager
|
|
18
|
+
from .http_transport import install_connection_policy as install_connection_policy
|
|
18
19
|
from .integrations.executors import instrument_executors as instrument_executors
|
|
19
20
|
from .interactive import ask_or_default as ask_or_default, ask_required as ask_required, require_answer as require_answer
|
|
20
21
|
from .logs import ProxyLoggerProvider as ProxyLoggerProvider
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import atexit
|
|
2
2
|
import requests
|
|
3
3
|
from ..constants import ATTRIBUTES_MESSAGE_KEY as ATTRIBUTES_MESSAGE_KEY, ATTRIBUTES_SPAN_TYPE_KEY as ATTRIBUTES_SPAN_TYPE_KEY, HTTP_CONNECT_TIMEOUT as HTTP_CONNECT_TIMEOUT, OTLP_MAX_INT_SIZE as OTLP_MAX_INT_SIZE, log_level_attributes as log_level_attributes
|
|
4
|
+
from ..http_transport import install_connection_policy as install_connection_policy
|
|
4
5
|
from ..stack_info import STACK_INFO_KEYS as STACK_INFO_KEYS
|
|
5
6
|
from ..utils import logger as logger, platform_is_emscripten as platform_is_emscripten, truncate_string as truncate_string
|
|
6
7
|
from .wrapper import WrapperLogExporter as WrapperLogExporter, WrapperSpanExporter as WrapperSpanExporter
|
|
@@ -28,6 +29,7 @@ class BodySizeCheckingOTLPSpanExporter(OTLPSpanExporter):
|
|
|
28
29
|
|
|
29
30
|
class OTLPExporterHttpSession(Session):
|
|
30
31
|
"""A requests.Session subclass that defers failed requests to a DiskRetryer."""
|
|
32
|
+
def __init__(self) -> None: ...
|
|
31
33
|
def request(self, method: str, url: str, **kwargs: Any): ...
|
|
32
34
|
def post(self, url: str, data: bytes, **kwargs: Any): ...
|
|
33
35
|
@cached_property
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from requests import Session
|
|
2
|
+
from requests.adapters import HTTPAdapter
|
|
3
|
+
from typing import Any
|
|
4
|
+
from urllib3.connectionpool import HTTPConnectionPool
|
|
5
|
+
|
|
6
|
+
IDLE_CONNECTION_RECYCLE_SECONDS: int
|
|
7
|
+
TCP_KEEPALIVE_IDLE_SECONDS: int
|
|
8
|
+
TCP_KEEPALIVE_INTERVAL_SECONDS: int
|
|
9
|
+
TCP_KEEPALIVE_FAILED_PROBES: int
|
|
10
|
+
|
|
11
|
+
def keepalive_socket_options() -> list[tuple[int, int, int | bytes]]:
|
|
12
|
+
"""`urllib3`'s default socket options plus TCP keepalive.
|
|
13
|
+
|
|
14
|
+
Building on `HTTPConnection.default_socket_options` keeps `TCP_NODELAY`, which `urllib3` sets
|
|
15
|
+
and which we have no reason to drop. The class is read off the module at call time because
|
|
16
|
+
`urllib3` swaps it out under Pyodide, for an Emscripten connection that talks over `fetch()`
|
|
17
|
+
and so has neither a socket nor any default options.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
class _IdleRecyclingPoolMixin(HTTPConnectionPool):
|
|
21
|
+
"""Closes a pooled connection that has sat idle longer than the recycle window.
|
|
22
|
+
|
|
23
|
+
The unit that goes stale is one connection, not the session: a session can be busy
|
|
24
|
+
continuously while an individual pooled connection sits unused. That is the normal shape for
|
|
25
|
+
Logfire, where one session carries traces, metrics and logs from different threads, so a
|
|
26
|
+
steady trace stream keeps the session active while the connection that last served a metric
|
|
27
|
+
export waits out the full export interval.
|
|
28
|
+
|
|
29
|
+
`urllib3` pools from a LIFO queue, which makes this sharper than steady-state staleness.
|
|
30
|
+
Sequential traffic reuses the connection on top of the stack, so a connection opened during
|
|
31
|
+
a brief overlap is used once and then left at the bottom, idle for as long as the workload
|
|
32
|
+
stays sequential. It is handed back out at the next overlap, which is exactly when a request
|
|
33
|
+
is least able to tolerate a dead socket. Recycling on the way out of the pool is what catches
|
|
34
|
+
that connection before it is used.
|
|
35
|
+
|
|
36
|
+
`urllib3` already drops a pooled connection it can see was closed. This extends that to the
|
|
37
|
+
case it cannot see, closing on the way out of the pool and letting `urllib3` reconnect
|
|
38
|
+
lazily, exactly as it does for a connection it detected as dropped.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
class LogfireHTTPAdapter(HTTPAdapter):
|
|
42
|
+
"""A `requests` adapter that enables TCP keepalive and recycles idle pooled connections."""
|
|
43
|
+
def init_poolmanager(self, connections: int, maxsize: int, block: bool = ..., **pool_kwargs: Any) -> None: ...
|
|
44
|
+
def proxy_manager_for(self, proxy: str, **proxy_kwargs: Any) -> Any: ...
|
|
45
|
+
|
|
46
|
+
def install_connection_policy(session: Session) -> None:
|
|
47
|
+
"""Apply the keepalive and idle recycle policy to a session Logfire owns."""
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
from .asgi import ASGIApp as ASGIApp, ASGIInstrumentKwargs as ASGIInstrumentKwargs, instrument_asgi as instrument_asgi
|
|
2
|
+
from litestar import Litestar
|
|
3
|
+
from logfire import Logfire as Logfire
|
|
4
|
+
from typing_extensions import Unpack
|
|
5
|
+
|
|
6
|
+
def instrument_litestar(logfire_instance: Logfire, app: Litestar, *, record_send_receive: bool = False, capture_headers: bool = False, **kwargs: Unpack[ASGIInstrumentKwargs]) -> ASGIApp:
|
|
7
|
+
"""Wrap a Litestar app with OpenTelemetry middleware configured for Logfire."""
|
|
@@ -3,7 +3,7 @@ from dataclasses import dataclass
|
|
|
3
3
|
from logfire._internal.constants import LEVEL_NUMBERS as LEVEL_NUMBERS
|
|
4
4
|
from opentelemetry._logs import LogRecord, Logger, LoggerProvider
|
|
5
5
|
from opentelemetry.util.types import _ExtendedAttributes
|
|
6
|
-
from threading import
|
|
6
|
+
from threading import RLock
|
|
7
7
|
from typing import Any, overload
|
|
8
8
|
from weakref import WeakSet
|
|
9
9
|
|
|
@@ -12,7 +12,7 @@ class ProxyLoggerProvider(LoggerProvider):
|
|
|
12
12
|
"""A logger provider that wraps another internal logger provider allowing it to be re-assigned."""
|
|
13
13
|
provider: LoggerProvider
|
|
14
14
|
loggers: WeakSet[ProxyLogger] = dataclasses.field(default_factory=WeakSet['ProxyLogger'])
|
|
15
|
-
lock:
|
|
15
|
+
lock: RLock = dataclasses.field(default_factory=RLock)
|
|
16
16
|
suppressed_scopes: set[str] = dataclasses.field(default_factory=set[str])
|
|
17
17
|
min_level: int = ...
|
|
18
18
|
def get_logger(self, name: str, version: str | None = None, schema_url: str | None = None, attributes: _ExtendedAttributes | None = None) -> Logger: ...
|
|
@@ -42,6 +42,7 @@ from contextlib import AbstractContextManager
|
|
|
42
42
|
from django.http import HttpRequest as HttpRequest, HttpResponse as HttpResponse
|
|
43
43
|
from fastapi import FastAPI
|
|
44
44
|
from flask.app import Flask
|
|
45
|
+
from litestar import Litestar
|
|
45
46
|
from opentelemetry.context import Context as Context
|
|
46
47
|
from opentelemetry.instrumentation.asgi.types import ClientRequestHook, ClientResponseHook, ServerRequestHook
|
|
47
48
|
from opentelemetry.metrics import CallbackT as CallbackT, Counter, Histogram, UpDownCounter, _Gauge as Gauge
|
|
@@ -800,6 +801,29 @@ class Logfire:
|
|
|
800
801
|
response_hook: A function called right before a span is finished for the response.
|
|
801
802
|
**kwargs: Additional keyword arguments to pass to the OpenTelemetry Flask instrumentation.
|
|
802
803
|
"""
|
|
804
|
+
def instrument_litestar(self, app: Litestar, *, capture_headers: bool = False, record_send_receive: bool = False, **kwargs: Unpack[ASGIInstrumentKwargs]) -> ASGIApp:
|
|
805
|
+
"""Instrument a Litestar app to record requests with canonical route templates.
|
|
806
|
+
|
|
807
|
+
Uses `instrument_asgi()` with a Litestar route extractor, so requests to
|
|
808
|
+
`/users/1` and `/users/2` share the route `/users/{user_id}`.
|
|
809
|
+
|
|
810
|
+
Warning:
|
|
811
|
+
This method returns an ASGI wrapper instead of modifying the app in place.
|
|
812
|
+
Pass the returned app to your server. Access Litestar-specific attributes
|
|
813
|
+
through the original app.
|
|
814
|
+
|
|
815
|
+
Args:
|
|
816
|
+
app: The Litestar app to instrument.
|
|
817
|
+
capture_headers: Set to `True` to capture all request and response headers.
|
|
818
|
+
record_send_receive: Set to `True` to record low-level ASGI send and receive spans.
|
|
819
|
+
These are disabled by default to reduce noise.
|
|
820
|
+
**kwargs: Additional options for the OpenTelemetry ASGI middleware, including
|
|
821
|
+
`server_request_hook`, `client_request_hook`, `client_response_hook`,
|
|
822
|
+
`excluded_urls`, and `default_span_details`.
|
|
823
|
+
|
|
824
|
+
Returns:
|
|
825
|
+
The instrumented ASGI application.
|
|
826
|
+
"""
|
|
803
827
|
def instrument_starlette(self, app: Starlette, *, capture_headers: bool = False, record_send_receive: bool = False, server_request_hook: ServerRequestHook | None = None, client_request_hook: ClientRequestHook | None = None, client_response_hook: ClientResponseHook | None = None, **kwargs: Any) -> None:
|
|
804
828
|
"""Instrument `app` so that spans are automatically created for each request.
|
|
805
829
|
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "logfire-api"
|
|
7
|
-
version = "5.
|
|
7
|
+
version = "5.1.1"
|
|
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" },
|
|
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
|
{logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/exporters/processor_wrapper.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
|
{logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/aiohttp_client.pyi
RENAMED
|
File without changes
|
{logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/aiohttp_server.pyi
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/claude_agent_sdk.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
|
{logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/openai_agents.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
|
{logfire_api-5.0.0 → logfire_api-5.1.1}/logfire_api/_internal/integrations/system_metrics.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
|