Skip to content

Commit bbb11ec

Browse files
authored
Add missing return on instrument methods (#360)
1 parent c753af5 commit bbb11ec

File tree

4 files changed

+6
-63
lines changed

4 files changed

+6
-63
lines changed

logfire-api/logfire_api/__init__.pyi

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
from ._internal.auto_trace import AutoTraceModule as AutoTraceModule
22
from ._internal.auto_trace.rewrite_ast import no_auto_trace as no_auto_trace
3-
from ._internal.config import (
4-
ConsoleOptions as ConsoleOptions,
5-
METRICS_PREFERRED_TEMPORALITY as METRICS_PREFERRED_TEMPORALITY,
6-
PydanticPlugin as PydanticPlugin,
7-
configure as configure,
8-
)
3+
from ._internal.config import ConsoleOptions as ConsoleOptions, METRICS_PREFERRED_TEMPORALITY as METRICS_PREFERRED_TEMPORALITY, PydanticPlugin as PydanticPlugin, configure as configure
94
from ._internal.constants import LevelName as LevelName
105
from ._internal.exporters.file import load_file as load_spans_from_file
116
from ._internal.exporters.tail_sampling import TailSamplingOptions as TailSamplingOptions
@@ -16,57 +11,7 @@ from .integrations.logging import LogfireLoggingHandler as LogfireLoggingHandler
1611
from .integrations.structlog import LogfireProcessor as StructlogProcessor
1712
from .version import VERSION as VERSION
1813

19-
__all__ = [
20-
'Logfire',
21-
'LogfireSpan',
22-
'LevelName',
23-
'ConsoleOptions',
24-
'PydanticPlugin',
25-
'configure',
26-
'span',
27-
'instrument',
28-
'log',
29-
'trace',
30-
'debug',
31-
'notice',
32-
'info',
33-
'warn',
34-
'error',
35-
'fatal',
36-
'force_flush',
37-
'log_slow_async_callbacks',
38-
'install_auto_tracing',
39-
'instrument_fastapi',
40-
'instrument_openai',
41-
'instrument_anthropic',
42-
'instrument_asyncpg',
43-
'instrument_httpx',
44-
'instrument_celery',
45-
'instrument_requests',
46-
'instrument_psycopg',
47-
'instrument_django',
48-
'instrument_flask',
49-
'instrument_starlette',
50-
'instrument_aiohttp_client',
51-
'instrument_sqlalchemy',
52-
'instrument_redis',
53-
'instrument_pymongo',
54-
'instrument_mysql',
55-
'AutoTraceModule',
56-
'with_tags',
57-
'with_settings',
58-
'shutdown',
59-
'load_spans_from_file',
60-
'no_auto_trace',
61-
'METRICS_PREFERRED_TEMPORALITY',
62-
'ScrubMatch',
63-
'ScrubbingOptions',
64-
'VERSION',
65-
'suppress_instrumentation',
66-
'StructlogProcessor',
67-
'LogfireLoggingHandler',
68-
'TailSamplingOptions',
69-
]
14+
__all__ = ['Logfire', 'LogfireSpan', 'LevelName', 'ConsoleOptions', 'PydanticPlugin', 'configure', 'span', 'instrument', 'log', 'trace', 'debug', 'notice', 'info', 'warn', 'error', 'fatal', 'force_flush', 'log_slow_async_callbacks', 'install_auto_tracing', 'instrument_fastapi', 'instrument_openai', 'instrument_anthropic', 'instrument_asyncpg', 'instrument_httpx', 'instrument_celery', 'instrument_requests', 'instrument_psycopg', 'instrument_django', 'instrument_flask', 'instrument_starlette', 'instrument_aiohttp_client', 'instrument_sqlalchemy', 'instrument_redis', 'instrument_pymongo', 'instrument_mysql', 'AutoTraceModule', 'with_tags', 'with_settings', 'shutdown', 'load_spans_from_file', 'no_auto_trace', 'METRICS_PREFERRED_TEMPORALITY', 'ScrubMatch', 'ScrubbingOptions', 'VERSION', 'suppress_instrumentation', 'StructlogProcessor', 'LogfireLoggingHandler', 'TailSamplingOptions']
7015

7116
DEFAULT_LOGFIRE_INSTANCE = Logfire()
7217
span = DEFAULT_LOGFIRE_INSTANCE.span

logfire-api/logfire_api/_internal/constants.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ LOGGING_TO_OTEL_LEVEL_NUMBERS: Incomplete
99
ATTRIBUTES_LOG_LEVEL_NAME_KEY: Incomplete
1010
ATTRIBUTES_LOG_LEVEL_NUM_KEY: Incomplete
1111

12-
1312
def log_level_attributes(level: LevelName | int) -> dict[str, otel_types.AttributeValue]: ...
1413

15-
1614
SpanTypeType: Incomplete
1715
ATTRIBUTES_SPAN_TYPE_KEY: Incomplete
1816
ATTRIBUTES_PENDING_SPAN_REAL_PARENT_KEY: Incomplete

logfire-api/logfire_api/_internal/main.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ class Logfire:
552552
for future compatibility.
553553
554554
"""
555-
def instrument_requests(self, excluded_urls: str | None = None, **kwargs: Any):
555+
def instrument_requests(self, excluded_urls: str | None = None, **kwargs: Any) -> None:
556556
"""Instrument the `requests` module so that spans are automatically created for each request.
557557
558558
Args:
@@ -597,7 +597,7 @@ class Logfire:
597597
[OpenTelemetry Starlette Instrumentation](https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/starlette/starlette.html)
598598
library, specifically `StarletteInstrumentor.instrument_app()`, to which it passes `**kwargs`.
599599
"""
600-
def instrument_aiohttp_client(self, **kwargs: Any):
600+
def instrument_aiohttp_client(self, **kwargs: Any) -> None:
601601
"""Instrument the `aiohttp` module so that spans are automatically created for each client request.
602602
603603
Uses the

logfire/_internal/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,7 @@ def instrument_django(
11071107
**kwargs,
11081108
)
11091109

1110-
def instrument_requests(self, excluded_urls: str | None = None, **kwargs: Any):
1110+
def instrument_requests(self, excluded_urls: str | None = None, **kwargs: Any) -> None:
11111111
"""Instrument the `requests` module so that spans are automatically created for each request.
11121112
11131113
Args:
@@ -1176,7 +1176,7 @@ def instrument_starlette(
11761176
self._warn_if_not_initialized_for_instrumentation()
11771177
return instrument_starlette(app, capture_headers=capture_headers, **kwargs)
11781178

1179-
def instrument_aiohttp_client(self, **kwargs: Any):
1179+
def instrument_aiohttp_client(self, **kwargs: Any) -> None:
11801180
"""Instrument the `aiohttp` module so that spans are automatically created for each client request.
11811181
11821182
Uses the

0 commit comments

Comments
 (0)