logfire-api 4.38.0__tar.gz → 4.40.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 (124) hide show
  1. {logfire_api-4.38.0 → logfire_api-4.40.0}/PKG-INFO +1 -1
  2. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/__init__.pyi +1 -2
  3. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/auth.pyi +1 -0
  4. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/cli/run.pyi +25 -10
  5. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/config.pyi +2 -2
  6. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/exporters/console.pyi +1 -0
  7. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/exporters/wrapper.pyi +1 -0
  8. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/httpx.pyi +9 -5
  9. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/main.pyi +16 -10
  10. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/experimental/query_client.pyi +2 -0
  11. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/integrations/httpx.pyi +5 -6
  12. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/query_client.pyi +2 -2
  13. {logfire_api-4.38.0 → logfire_api-4.40.0}/pyproject.toml +1 -1
  14. {logfire_api-4.38.0 → logfire_api-4.40.0}/.gitignore +0 -0
  15. {logfire_api-4.38.0 → logfire_api-4.40.0}/README.md +0 -0
  16. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/__init__.py +0 -0
  17. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/__init__.pyi +0 -0
  18. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/ast_utils.pyi +0 -0
  19. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/async_.pyi +0 -0
  20. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/auto_trace/__init__.pyi +0 -0
  21. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/auto_trace/import_hook.pyi +0 -0
  22. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/auto_trace/rewrite_ast.pyi +0 -0
  23. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/auto_trace/types.pyi +0 -0
  24. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/baggage.pyi +0 -0
  25. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/cli/__init__.pyi +0 -0
  26. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/cli/ai_tools.pyi +0 -0
  27. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/cli/auth.pyi +0 -0
  28. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/cli/gateway.pyi +0 -0
  29. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/cli/gateway_auth.pyi +0 -0
  30. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/cli/prompt.pyi +0 -0
  31. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/cli.pyi +0 -0
  32. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/client.pyi +0 -0
  33. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/collect_system_info.pyi +0 -0
  34. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/config_params.pyi +0 -0
  35. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/constants.pyi +0 -0
  36. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/db_statement_summary.pyi +0 -0
  37. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/exporters/__init__.pyi +0 -0
  38. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/exporters/dynamic_batch.pyi +0 -0
  39. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/exporters/logs.pyi +0 -0
  40. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/exporters/otlp.pyi +0 -0
  41. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/exporters/processor_wrapper.pyi +0 -0
  42. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/exporters/quiet_metrics.pyi +0 -0
  43. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/exporters/remove_pending.pyi +0 -0
  44. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/exporters/tail_sampling.pyi +0 -0
  45. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/formatter.pyi +0 -0
  46. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/forwarding.pyi +0 -0
  47. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/instrument.pyi +0 -0
  48. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/__init__.pyi +0 -0
  49. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/aiohttp_client.pyi +0 -0
  50. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/aiohttp_server.pyi +0 -0
  51. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/asgi.pyi +0 -0
  52. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/asyncpg.pyi +0 -0
  53. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/aws_lambda.pyi +0 -0
  54. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/celery.pyi +0 -0
  55. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/claude_agent_sdk.pyi +0 -0
  56. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/django.pyi +0 -0
  57. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/dspy.pyi +0 -0
  58. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/executors.pyi +0 -0
  59. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/fastapi.pyi +0 -0
  60. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/flask.pyi +0 -0
  61. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/google_genai.pyi +0 -0
  62. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/litellm.pyi +0 -0
  63. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/mcp.pyi +0 -0
  64. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/mysql.pyi +0 -0
  65. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/openai_agents.pyi +0 -0
  66. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/print.pyi +0 -0
  67. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/psycopg.pyi +0 -0
  68. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/pydantic_ai.pyi +0 -0
  69. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/pymongo.pyi +0 -0
  70. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/pytest.pyi +0 -0
  71. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/redis.pyi +0 -0
  72. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/requests.pyi +0 -0
  73. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/sqlalchemy.pyi +0 -0
  74. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/sqlite3.pyi +0 -0
  75. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/starlette.pyi +0 -0
  76. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/surrealdb.pyi +0 -0
  77. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/system_metrics.pyi +0 -0
  78. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/integrations/wsgi.pyi +0 -0
  79. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/json_encoder.pyi +0 -0
  80. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/json_formatter.pyi +0 -0
  81. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/json_schema.pyi +0 -0
  82. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/json_types.pyi +0 -0
  83. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/logs.pyi +0 -0
  84. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/metrics.pyi +0 -0
  85. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/scrubbing.pyi +0 -0
  86. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/server_response.pyi +0 -0
  87. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/stack_info.pyi +0 -0
  88. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/tracer.pyi +0 -0
  89. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/ulid.pyi +0 -0
  90. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/_internal/utils.pyi +0 -0
  91. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/cli.pyi +0 -0
  92. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/db_api.pyi +0 -0
  93. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/exceptions.pyi +0 -0
  94. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/experimental/__init__.pyi +0 -0
  95. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/experimental/annotations.pyi +0 -0
  96. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/experimental/api_client.pyi +0 -0
  97. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/experimental/datasets/__init__.pyi +0 -0
  98. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/experimental/forwarding.pyi +0 -0
  99. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/integrations/__init__.pyi +0 -0
  100. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/integrations/aiohttp_client.pyi +0 -0
  101. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/integrations/flask.pyi +0 -0
  102. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/integrations/logging.pyi +0 -0
  103. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/integrations/loguru.pyi +0 -0
  104. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/integrations/psycopg.pyi +0 -0
  105. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/integrations/pydantic.pyi +0 -0
  106. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/integrations/redis.pyi +0 -0
  107. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/integrations/sqlalchemy.pyi +0 -0
  108. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/integrations/structlog.pyi +0 -0
  109. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/integrations/wsgi.pyi +0 -0
  110. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/propagate.pyi +0 -0
  111. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/py.typed +0 -0
  112. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/sampling/__init__.pyi +0 -0
  113. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/sampling/_tail_sampling.pyi +0 -0
  114. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/types.pyi +0 -0
  115. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/variables/__init__.pyi +0 -0
  116. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/variables/_handlebars.pyi +0 -0
  117. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/variables/abstract.pyi +0 -0
  118. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/variables/composition.pyi +0 -0
  119. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/variables/config.pyi +0 -0
  120. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/variables/local.pyi +0 -0
  121. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/variables/remote.pyi +0 -0
  122. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/variables/template_validation.pyi +0 -0
  123. {logfire_api-4.38.0 → logfire_api-4.40.0}/logfire_api/variables/variable.pyi +0 -0
  124. {logfire_api-4.38.0 → logfire_api-4.40.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.38.0
3
+ Version: 4.40.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
@@ -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_clear', '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_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
@@ -75,7 +75,6 @@ fatal = DEFAULT_LOGFIRE_INSTANCE.fatal
75
75
  exception = DEFAULT_LOGFIRE_INSTANCE.exception
76
76
  var = DEFAULT_LOGFIRE_INSTANCE.var
77
77
  template_var = DEFAULT_LOGFIRE_INSTANCE.template_var
78
- variables_clear = DEFAULT_LOGFIRE_INSTANCE.variables_clear
79
78
  variables_get = DEFAULT_LOGFIRE_INSTANCE.variables_get
80
79
  variables_push = DEFAULT_LOGFIRE_INSTANCE.variables_push
81
80
  variables_push_types = DEFAULT_LOGFIRE_INSTANCE.variables_push_types
@@ -9,6 +9,7 @@ from typing_extensions import Self
9
9
 
10
10
  HOME_LOGFIRE: Incomplete
11
11
  DEFAULT_FILE: Incomplete
12
+ LOGFIRE_TOKEN_REGION_PATTERN: Incomplete
12
13
  PYDANTIC_LOGFIRE_TOKEN_PATTERN: Incomplete
13
14
 
14
15
  class _RegionData(TypedDict):
@@ -1,21 +1,36 @@
1
1
  import argparse
2
2
  from _typeshed import Incomplete
3
- from collections.abc import Generator
3
+ from collections.abc import Collection, Generator, Mapping
4
4
  from contextlib import contextmanager
5
5
  from dataclasses import dataclass
6
+ from logfire._internal.utils import get_version as get_version
6
7
  from rich.console import Console
7
8
  from rich.text import Text
8
9
 
9
10
  STANDARD_LIBRARY_PACKAGES: Incomplete
10
11
  AMBIGUOUS_RECOMMENDATION_PACKAGES: Incomplete
12
+ INSTRUMENTATION_TARGETS: Incomplete
13
+ TARGET_PACKAGE_ALIASES: Incomplete
14
+ INSTRUMENTATION_CALL_ARGUMENTS: Incomplete
15
+ MINIMUM_INSTRUMENTATION_VERSIONS: Incomplete
11
16
  OTEL_INSTRUMENTATION_MAP: Incomplete
12
17
 
18
+ @dataclass(frozen=True, order=True)
19
+ class InstrumentationRecommendation:
20
+ package_name: str
21
+ target_packages: tuple[str, ...]
22
+ minimum_version: str | None = ...
23
+ already_installed: bool = ...
24
+ @property
25
+ def package_spec(self) -> str: ...
26
+
13
27
  @dataclass
14
28
  class InstrumentationContext:
15
29
  instrument_pkg_map: dict[str, str]
16
30
  installed_pkgs: set[str]
17
31
  installed_otel_pkgs: set[str]
18
- recommendations: set[tuple[str, str]]
32
+ installed_versions: dict[str, str]
33
+ recommendations: set[InstrumentationRecommendation]
19
34
 
20
35
  def parse_run(args: argparse.Namespace) -> None: ...
21
36
  @contextmanager
@@ -27,24 +42,24 @@ def instrument_packages(installed_otel_packages: set[str], instrument_pkg_map: d
27
42
 
28
43
  Returns a list of packages that were successfully instrumented.
29
44
  """
30
- def instrument_package(import_name: str): ...
31
- def find_recommended_instrumentations_to_install(instrument_pkg_map: dict[str, str], installed_otel_pkgs: set[str], installed_pkgs: set[str]) -> set[tuple[str, str]]:
45
+ def instrument_package(import_name: str, *args: str) -> None: ...
46
+ def find_recommended_instrumentations_to_install(instrument_pkg_map: dict[str, str], installed_otel_pkgs: set[str], installed_pkgs: set[str], installed_versions: Mapping[str, str] | None = None) -> set[InstrumentationRecommendation]:
32
47
  """Determine which OpenTelemetry instrumentation packages are recommended for installation.
33
48
 
34
49
  Args:
35
50
  instrument_pkg_map: Mapping of instrumentation package names to the packages they instrument.
36
51
  installed_otel_pkgs: Set of already installed instrumentation package names.
37
52
  installed_pkgs: Set of all installed package names.
53
+ installed_versions: Installed versions keyed by instrumentation package name.
38
54
 
39
55
  Returns:
40
- Set of tuples where each tuple is (instrumentation_package, target_package) that
41
- is recommended for installation.
56
+ Instrumentation packages that should be installed or upgraded.
42
57
  """
43
- def instrumented_packages_text(installed_otel_pkgs: set[str], instrumented_packages: list[str], installed_pkgs: set[str]) -> Text: ...
44
- def get_recommendation_texts(recommendations: set[tuple[str, str]]) -> tuple[Text, Text]:
58
+ def instrumented_packages_text(installed_otel_pkgs: set[str], instrumented_packages: list[str], installed_pkgs: set[str], installed_versions: Mapping[str, str] | None = None) -> Text: ...
59
+ def get_recommendation_texts(recommendations: set[InstrumentationRecommendation]) -> tuple[Text, Text]:
45
60
  """Return (recommended_packages_text, install_all_text) as Text objects."""
46
- def print_otel_summary(*, console: Console, instrumented_packages_text: Text | None = None, recommendations: set[tuple[str, str]]) -> None: ...
61
+ def print_otel_summary(*, console: Console, instrumented_packages_text: Text | None = None, recommendations: set[InstrumentationRecommendation]) -> None: ...
47
62
  def installed_packages() -> set[str]:
48
63
  """Get a set of all installed packages."""
49
- def collect_instrumentation_context(exclude: set[str]) -> InstrumentationContext:
64
+ def collect_instrumentation_context(exclude: Collection[str]) -> InstrumentationContext:
50
65
  """Collects all relevant context for instrumentation and recommendations."""
@@ -28,7 +28,7 @@ from _typeshed import Incomplete
28
28
  from collections.abc import Callable, Mapping, Sequence
29
29
  from dataclasses import dataclass, field
30
30
  from datetime import timedelta
31
- from logfire._internal.auth import REGIONS as REGIONS
31
+ from logfire._internal.auth import LOGFIRE_TOKEN_REGION_PATTERN as LOGFIRE_TOKEN_REGION_PATTERN, REGIONS as REGIONS
32
32
  from logfire._internal.baggage import DirectBaggageAttributesSpanProcessor as DirectBaggageAttributesSpanProcessor
33
33
  from logfire._internal.collect_system_info import collect_package_info as collect_package_info
34
34
  from logfire.exceptions import LogfireConfigError as LogfireConfigError
@@ -36,6 +36,7 @@ from logfire.sampling import SamplingOptions as SamplingOptions
36
36
  from logfire.sampling._tail_sampling import TailSamplingProcessor as TailSamplingProcessor
37
37
  from logfire.variables import VariablesConfig as VariablesConfig
38
38
  from logfire.variables.abstract import NoOpVariableProvider as NoOpVariableProvider, VariableProvider as VariableProvider
39
+ from logfire.variables.variable import TemplateVariable as TemplateVariable, Variable as Variable
39
40
  from logfire.version import VERSION as VERSION
40
41
  from opentelemetry.sdk._logs import LogRecordProcessor as LogRecordProcessor
41
42
  from opentelemetry.sdk.metrics.export import MetricReader as MetricReader
@@ -50,7 +51,6 @@ from typing_extensions import Self, Unpack
50
51
  CREDENTIALS_FILENAME: str
51
52
  COMMON_REQUEST_HEADERS: Incomplete
52
53
  PROJECT_NAME_PATTERN: str
53
- LOGFIRE_TOKEN_REGION_PATTERN: Incomplete
54
54
  METRICS_PREFERRED_TEMPORALITY: Incomplete
55
55
 
56
56
  @dataclass
@@ -71,4 +71,5 @@ class ShowParentsConsoleSpanExporter(SimpleConsoleSpanExporter):
71
71
  class ConsoleLogExporter(LogRecordExporter):
72
72
  span_exporter: SimpleConsoleSpanExporter
73
73
  def export(self, batch: Sequence[ReadableLogRecord]) -> LogRecordExportResult: ...
74
+ def force_flush(self, timeout_millis: int = 10000) -> bool: ...
74
75
  def shutdown(self) -> None: ...
@@ -40,6 +40,7 @@ class WrapperLogExporter(LogRecordExporter):
40
40
  """A base class for LogExporters that wrap another exporter."""
41
41
  exporter: LogRecordExporter
42
42
  def export(self, batch: Sequence[ReadableLogRecord]) -> LogRecordExportResult: ...
43
+ def force_flush(self, timeout_millis: int = 10000) -> bool: ...
43
44
  def shutdown(self): ...
44
45
 
45
46
  @dataclass
@@ -1,5 +1,6 @@
1
1
  import contextlib
2
2
  import httpx
3
+ import httpx2
3
4
  from _typeshed import Incomplete
4
5
  from collections.abc import Awaitable as Awaitable, Callable, Generator, Mapping
5
6
  from email.headerregistry import ContentTypeHeader
@@ -10,19 +11,22 @@ from logfire._internal.main import set_user_attributes_on_raw_span as set_user_a
10
11
  from logfire._internal.stack_info import warn_at_user_stacklevel as warn_at_user_stacklevel
11
12
  from logfire._internal.utils import handle_internal_errors as handle_internal_errors
12
13
  from logfire.integrations.httpx import AsyncRequestHook as AsyncRequestHook, AsyncResponseHook as AsyncResponseHook, RequestHook as RequestHook, RequestInfo as RequestInfo, ResponseHook as ResponseHook, ResponseInfo as ResponseInfo
14
+ from opentelemetry.instrumentation import httpx as otel_httpx
13
15
  from opentelemetry.trace import Span
14
16
  from typing import Any, Literal, ParamSpec
15
17
 
18
+ HTTPXClientInstrumentor: Incomplete
19
+ HTTPX2ClientInstrumentor: type[otel_httpx.HTTPX2ClientInstrumentor] | None
16
20
  P = ParamSpec('P')
17
21
 
18
- def instrument_httpx(logfire_instance: Logfire, client: httpx.Client | httpx.AsyncClient | None, capture_all: bool | None, capture_headers: bool, capture_request_body: bool, capture_response_body: bool, request_hook: RequestHook | AsyncRequestHook | None, response_hook: ResponseHook | AsyncResponseHook | None, async_request_hook: AsyncRequestHook | None, async_response_hook: AsyncResponseHook | None, **kwargs: Any) -> None:
19
- """Instrument the `httpx` module so that spans are automatically created for each request.
22
+ def instrument_httpx(logfire_instance: Logfire, client: httpx.Client | httpx.AsyncClient | httpx2.Client | httpx2.AsyncClient | None, capture_all: bool | None, capture_headers: bool, capture_request_body: bool, capture_response_body: bool, request_hook: RequestHook | AsyncRequestHook | None, response_hook: ResponseHook | AsyncResponseHook | None, async_request_hook: AsyncRequestHook | None, async_response_hook: AsyncResponseHook | None, **kwargs: Any) -> None:
23
+ """Instrument the `httpx` and `httpx2` modules so that spans are automatically created for each request.
20
24
 
21
25
  See the `Logfire.instrument_httpx` method for details.
22
26
  """
23
27
 
24
28
  class LogfireHttpxInfoMixin:
25
- headers: httpx.Headers
29
+ headers: httpx.Headers | httpx2.Headers
26
30
  @property
27
31
  def content_type_header_object(self) -> ContentTypeHeader: ...
28
32
  @property
@@ -52,7 +56,7 @@ class LogfireHttpxResponseInfo(ResponseInfo, LogfireHttpxInfoMixin):
52
56
  def capture_headers(self) -> None: ...
53
57
  def capture_body_if_text(self, attr_name: str = 'http.response.body.text'): ...
54
58
  @cached_property
55
- def response(self) -> httpx.Response: ...
59
+ def response(self) -> httpx.Response | httpx2.Response: ...
56
60
  def on_response_read(self, hook: Callable[[LogfireSpan], None]): ...
57
61
  def wrap_response_read(self, hook: Callable[[Callable[[], bytes]], bytes]): ...
58
62
  def wrap_response_aread(self, hook: Callable[[Callable[[], Awaitable[bytes]]], Awaitable[bytes]]): ...
@@ -68,7 +72,7 @@ def capture_request(span: Span, request: RequestInfo, should_capture_headers: bo
68
72
  def capture_response(span: Span, request: RequestInfo, response: ResponseInfo, logfire_instance: Logfire, capture_headers: bool, capture_body: bool, *, is_async: bool) -> tuple[LogfireHttpxRequestInfo, LogfireHttpxResponseInfo]: ...
69
73
  async def run_async_hook(hook: Callable[P, Any] | None, *args: P.args, **kwargs: P.kwargs) -> None: ...
70
74
  def run_hook(hook: Callable[P, Any] | None, *args: P.args, **kwargs: P.kwargs) -> None: ...
71
- def capture_request_or_response_headers(span: Span, headers: httpx.Headers, request_or_response: Literal['request', 'response']) -> None: ...
75
+ def capture_request_or_response_headers(span: Span, headers: httpx.Headers | httpx2.Headers, request_or_response: Literal['request', 'response']) -> None: ...
72
76
 
73
77
  CODES_FOR_METHODS_WITH_DATA_PARAM: Incomplete
74
78
 
@@ -1,5 +1,6 @@
1
1
  import anthropic
2
2
  import httpx
3
+ import httpx2
3
4
  import openai
4
5
  import opentelemetry.trace as trace_api
5
6
  import pydantic_ai
@@ -712,9 +713,9 @@ class Logfire:
712
713
  kwargs: Additional keyword arguments to pass to the OpenTelemetry `instrument` method.
713
714
  """
714
715
  @overload
715
- def instrument_httpx(self, client: httpx.Client, *, capture_all: bool = False, capture_headers: bool = False, capture_request_body: bool = False, capture_response_body: bool = False, request_hook: HttpxRequestHook | None = None, response_hook: HttpxResponseHook | None = None, **kwargs: Any) -> None: ...
716
+ def instrument_httpx(self, client: httpx.Client | httpx2.Client, *, capture_all: bool = False, capture_headers: bool = False, capture_request_body: bool = False, capture_response_body: bool = False, request_hook: HttpxRequestHook | None = None, response_hook: HttpxResponseHook | None = None, **kwargs: Any) -> None: ...
716
717
  @overload
717
- def instrument_httpx(self, client: httpx.AsyncClient, *, capture_all: bool = False, capture_headers: bool = False, capture_request_body: bool = False, capture_response_body: bool = False, request_hook: HttpxRequestHook | HttpxAsyncRequestHook | None = None, response_hook: HttpxResponseHook | HttpxAsyncResponseHook | None = None, **kwargs: Any) -> None: ...
718
+ def instrument_httpx(self, client: httpx.AsyncClient | httpx2.AsyncClient, *, capture_all: bool = False, capture_headers: bool = False, capture_request_body: bool = False, capture_response_body: bool = False, request_hook: HttpxRequestHook | HttpxAsyncRequestHook | None = None, response_hook: HttpxResponseHook | HttpxAsyncResponseHook | None = None, **kwargs: Any) -> None: ...
718
719
  @overload
719
720
  def instrument_httpx(self, client: None = None, *, capture_all: bool = False, capture_headers: bool = False, capture_request_body: bool = False, capture_response_body: bool = False, request_hook: HttpxRequestHook | None = None, response_hook: HttpxResponseHook | None = None, async_request_hook: HttpxAsyncRequestHook | None = None, async_response_hook: HttpxAsyncResponseHook | None = None, **kwargs: Any) -> None: ...
720
721
  def instrument_celery(self, **kwargs: Any) -> None:
@@ -1220,15 +1221,16 @@ class Logfire:
1220
1221
  @overload
1221
1222
  def template_var(self, name: str, *, type: type[T], default: T | ResolveFunction[T], inputs_type: type[InputsT], description: str | None = None, template_mismatch_policy: TemplateMismatchPolicy | None = None) -> TemplateVariable[T, InputsT]: ...
1222
1223
  def variables_clear(self) -> None:
1223
- """Clear all registered variables from this Logfire instance.
1224
+ """Clear all variables registered with this Logfire instance's config.
1224
1225
 
1225
1226
  This removes all variables previously registered via [`var()`][logfire.Logfire.var]
1226
- or [`template_var()`][logfire.Logfire.template_var],
1227
- allowing them to be re-registered. This is primarily intended for use in tests
1228
- to ensure a clean state between test cases.
1227
+ or [`template_var()`][logfire.Logfire.template_var] on this instance or any
1228
+ [`with_settings()`][logfire.Logfire.with_settings] sibling that shares its config,
1229
+ allowing them to be re-registered. This is primarily intended for use in tests to
1230
+ ensure a clean state between test cases.
1229
1231
  """
1230
1232
  def variables_get(self) -> list[Variable[Any] | TemplateVariable[Any, Any]]:
1231
- """Get all variables registered with this Logfire instance."""
1233
+ """Get all variables registered with this Logfire instance's config."""
1232
1234
  def variables_push(self, variables: list[Variable[Any] | TemplateVariable[Any, Any]] | None = None, *, dry_run: bool = False, yes: bool = False, strict: bool = False) -> bool:
1233
1235
  """Push variable definitions (metadata only) to the configured variable provider.
1234
1236
 
@@ -1242,7 +1244,8 @@ class Logfire:
1242
1244
 
1243
1245
  Args:
1244
1246
  variables: Variable instances to push. If None, all variables
1245
- registered with this Logfire instance will be pushed.
1247
+ registered with this Logfire instance's config will be pushed, including
1248
+ variables registered on `with_settings()` siblings.
1246
1249
  dry_run: If True, only show what would change without applying.
1247
1250
  yes: If True, skip confirmation prompt.
1248
1251
  strict: If True, fail if any existing label values are incompatible with new schemas
@@ -1332,7 +1335,8 @@ class Logfire:
1332
1335
 
1333
1336
  Args:
1334
1337
  variables: Variable instances to validate. If None, all variables
1335
- registered with this Logfire instance will be validated.
1338
+ registered with this Logfire instance's config will be validated, including
1339
+ variables registered on `with_settings()` siblings.
1336
1340
 
1337
1341
  Returns:
1338
1342
  A ValidationReport containing any errors found. Use `report.is_valid` to check
@@ -1412,7 +1416,9 @@ class Logfire:
1412
1416
  No labels or versions are created - use this to build a template config that can be edited.
1413
1417
 
1414
1418
  Args:
1415
- variables: Variable instances to include. If None, uses all registered variables.
1419
+ variables: Variable instances to include. If None, uses all variables registered
1420
+ with this Logfire instance\'s config, including variables registered on
1421
+ `with_settings()` siblings.
1416
1422
 
1417
1423
  Returns:
1418
1424
  A VariablesConfig with minimal configs for each variable.
@@ -18,6 +18,8 @@ class QueryRequestError(RuntimeError):
18
18
  """Raised when the query request is invalid."""
19
19
  class InfoRequestError(RuntimeError):
20
20
  """Raised when the request for read token info fails because of unavailable information."""
21
+ class UnexpectedResponseError(RuntimeError):
22
+ """Raised when the API responds with an unexpected status code, such as a `5xx` server error."""
21
23
 
22
24
  class ReadTokenInfo(TypedDict, total=False):
23
25
  """Information about the read token."""
@@ -1,4 +1,3 @@
1
- import httpx
2
1
  from collections.abc import Awaitable, Callable
3
2
  from opentelemetry.trace import Span
4
3
  from typing import Any, NamedTuple
@@ -9,9 +8,9 @@ class RequestInfo(NamedTuple):
9
8
  This is the second parameter passed to the `RequestHook` function.
10
9
  """
11
10
  method: bytes
12
- url: httpx.URL
13
- headers: httpx.Headers
14
- stream: httpx.SyncByteStream | httpx.AsyncByteStream | None
11
+ url: _HTTPXURL
12
+ headers: _HTTPXHeaders
13
+ stream: _HTTPXStream | None
15
14
  extensions: dict[str, Any] | None
16
15
 
17
16
  class ResponseInfo(NamedTuple):
@@ -20,8 +19,8 @@ class ResponseInfo(NamedTuple):
20
19
  This is the second parameter passed to the `ResponseHook` function.
21
20
  """
22
21
  status_code: int
23
- headers: httpx.Headers
24
- stream: httpx.SyncByteStream | httpx.AsyncByteStream | None
22
+ headers: _HTTPXHeaders
23
+ stream: _HTTPXStream | None
25
24
  extensions: dict[str, Any] | None
26
25
  RequestHook = Callable[[Span, RequestInfo], None]
27
26
  ResponseHook = Callable[[Span, RequestInfo, ResponseInfo], None]
@@ -1,3 +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
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, UnexpectedResponseError as UnexpectedResponseError
2
2
 
3
- __all__ = ['QueryExecutionError', 'QueryRequestError', 'InfoRequestError', 'ReadTokenInfo', 'ColumnDetails', 'ColumnData', 'QueryResults', 'RowQueryResults', 'LogfireQueryClient', 'AsyncLogfireQueryClient']
3
+ __all__ = ['QueryExecutionError', 'QueryRequestError', 'InfoRequestError', 'UnexpectedResponseError', '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.38.0"
7
+ version = "4.40.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" },
File without changes
File without changes