Skip to content

Commit 50b8818

Browse files
authored
Release v3.6.0 (#872)
1 parent e2d6099 commit 50b8818

File tree

15 files changed

+109
-21
lines changed

15 files changed

+109
-21
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Release Notes
22

3+
## [v3.6.0] (2025-02-18)
4+
5+
* Set log level to warning instead of error for 4xx HTTPExceptions from FastAPI/Starlette by @alexmojaki in [#858](https://github.com/pydantic/logfire/pull/858)
6+
* Add option to disable printing tags to console by @dmontagu in [#860](https://github.com/pydantic/logfire/pull/860)
7+
* Experimental support for OTel logs by @alexmojaki in [#863](https://github.com/pydantic/logfire/pull/863), [#870](https://github.com/pydantic/logfire/pull/870), and [#871](https://github.com/pydantic/logfire/pull/871)
8+
* Fix `excluded_urls` typo in instrument_flask by @alexmojaki in [#852](https://github.com/pydantic/logfire/pull/852)
9+
* Catch more errors when checking for sqlalchemy objects by @alexmojaki in [#854](https://github.com/pydantic/logfire/pull/854)
10+
* Don't scrub exception message by @alexmojaki in [#865](https://github.com/pydantic/logfire/pull/865)
11+
* Only skip logging to console after updating span stack and indentation by @alexmojaki in [#844](https://github.com/pydantic/logfire/pull/844)
12+
313
## [v3.5.3] (2025-02-05)
414

515
* Fixes for capturing httpx bodies by @alexmojaki in [#842](https://github.com/pydantic/logfire/pull/842)
@@ -570,3 +580,4 @@ First release from new repo!
570580
[v3.5.1]: https://github.com/pydantic/logfire/compare/v3.5.0...v3.5.1
571581
[v3.5.2]: https://github.com/pydantic/logfire/compare/v3.5.1...v3.5.2
572582
[v3.5.3]: https://github.com/pydantic/logfire/compare/v3.5.2...v3.5.3
583+
[v3.6.0]: https://github.com/pydantic/logfire/compare/v3.5.3...v3.6.0

logfire-api/logfire_api/_internal/config.pyi

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ from .auth import DEFAULT_FILE as DEFAULT_FILE, DefaultFile as DefaultFile, is_l
55
from .config_params import ParamManager as ParamManager, PydanticPluginRecordValues as PydanticPluginRecordValues
66
from .constants import LevelName as LevelName, OTLP_MAX_BODY_SIZE as OTLP_MAX_BODY_SIZE, RESOURCE_ATTRIBUTES_CODE_ROOT_PATH as RESOURCE_ATTRIBUTES_CODE_ROOT_PATH, RESOURCE_ATTRIBUTES_CODE_WORK_DIR as RESOURCE_ATTRIBUTES_CODE_WORK_DIR, RESOURCE_ATTRIBUTES_DEPLOYMENT_ENVIRONMENT_NAME as RESOURCE_ATTRIBUTES_DEPLOYMENT_ENVIRONMENT_NAME, RESOURCE_ATTRIBUTES_VCS_REPOSITORY_REF_REVISION as RESOURCE_ATTRIBUTES_VCS_REPOSITORY_REF_REVISION, RESOURCE_ATTRIBUTES_VCS_REPOSITORY_URL as RESOURCE_ATTRIBUTES_VCS_REPOSITORY_URL
77
from .exporters.console import ConsoleColorsValues as ConsoleColorsValues, IndentedConsoleSpanExporter as IndentedConsoleSpanExporter, ShowParentsConsoleSpanExporter as ShowParentsConsoleSpanExporter, SimpleConsoleSpanExporter as SimpleConsoleSpanExporter
8-
from .exporters.otlp import OTLPExporterHttpSession as OTLPExporterHttpSession, QuietSpanExporter as QuietSpanExporter, RetryFewerSpansSpanExporter as RetryFewerSpansSpanExporter
8+
from .exporters.logs import CheckSuppressInstrumentationLogProcessorWrapper as CheckSuppressInstrumentationLogProcessorWrapper
9+
from .exporters.otlp import OTLPExporterHttpSession as OTLPExporterHttpSession, QuietLogExporter as QuietLogExporter, QuietSpanExporter as QuietSpanExporter, RetryFewerSpansSpanExporter as RetryFewerSpansSpanExporter
910
from .exporters.processor_wrapper import CheckSuppressInstrumentationProcessorWrapper as CheckSuppressInstrumentationProcessorWrapper, MainSpanProcessorWrapper as MainSpanProcessorWrapper
1011
from .exporters.quiet_metrics import QuietMetricExporter as QuietMetricExporter
1112
from .exporters.remove_pending import RemovePendingSpansExporter as RemovePendingSpansExporter
1213
from .exporters.test import TestExporter as TestExporter
1314
from .integrations.executors import instrument_executors as instrument_executors
15+
from .logs import ProxyLoggerProvider as ProxyLoggerProvider
1416
from .main import Logfire as Logfire
1517
from .metrics import ProxyMeterProvider as ProxyMeterProvider
1618
from .scrubbing import BaseScrubber as BaseScrubber, NOOP_SCRUBBER as NOOP_SCRUBBER, Scrubber as Scrubber, ScrubbingOptions as ScrubbingOptions
@@ -23,6 +25,8 @@ from logfire.exceptions import LogfireConfigError as LogfireConfigError
2325
from logfire.sampling import SamplingOptions as SamplingOptions
2426
from logfire.sampling._tail_sampling import TailSamplingProcessor as TailSamplingProcessor
2527
from logfire.version import VERSION as VERSION
28+
from opentelemetry._events import EventLoggerProvider
29+
from opentelemetry.sdk._logs import LogRecordProcessor as LogRecordProcessor
2630
from opentelemetry.sdk.metrics.export import MetricReader as MetricReader
2731
from opentelemetry.sdk.trace import SpanProcessor
2832
from opentelemetry.sdk.trace.id_generator import IdGenerator
@@ -52,6 +56,7 @@ class AdvancedOptions:
5256
base_url: str = ...
5357
id_generator: IdGenerator = ...
5458
ns_timestamp_generator: Callable[[], int] = ...
59+
log_record_processors: Sequence[LogRecordProcessor] = ...
5560

5661
@dataclass
5762
class PydanticPlugin:
@@ -200,6 +205,22 @@ class LogfireConfig(_LogfireConfigData):
200205
Returns:
201206
The meter provider.
202207
"""
208+
def get_logger_provider(self) -> ProxyLoggerProvider:
209+
"""Get a logger provider from this `LogfireConfig`.
210+
211+
This is used internally and should not be called by users of the SDK.
212+
213+
Returns:
214+
The logger provider.
215+
"""
216+
def get_event_logger_provider(self) -> EventLoggerProvider:
217+
"""Get an event logger provider from this `LogfireConfig`.
218+
219+
This is used internally and should not be called by users of the SDK.
220+
221+
Returns:
222+
The event logger provider.
223+
"""
203224
def warn_if_not_initialized(self, message: str): ...
204225
def suppress_scopes(self, *scopes: str) -> None: ...
205226

logfire-api/logfire_api/_internal/constants.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ ATTRIBUTES_LOGGING_ARGS_KEY: Incomplete
2323
ATTRIBUTES_LOGGING_NAME: Incomplete
2424
ATTRIBUTES_VALIDATION_ERROR_KEY: str
2525
ATTRIBUTES_SCRUBBED_KEY: Incomplete
26-
NULL_ARGS_KEY: str
27-
PENDING_SPAN_NAME_SUFFIX: str
2826
LOGFIRE_BASE_URL: str
2927
RESOURCE_ATTRIBUTES_PACKAGE_VERSIONS: str
3028
RESOURCE_ATTRIBUTES_DEPLOYMENT_ENVIRONMENT_NAME: str
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from logfire._internal.exporters.wrapper import WrapperLogProcessor as WrapperLogProcessor
2+
from logfire._internal.utils import is_instrumentation_suppressed as is_instrumentation_suppressed
3+
from opentelemetry.sdk._logs import LogData
4+
5+
class CheckSuppressInstrumentationLogProcessorWrapper(WrapperLogProcessor):
6+
"""Checks if instrumentation is suppressed, then suppresses instrumentation itself.
7+
8+
Placed at the root of the tree of processors.
9+
"""
10+
def emit(self, log_data: LogData): ...

logfire-api/logfire_api/_internal/exporters/otlp.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import requests
22
from ..stack_info import STACK_INFO_KEYS as STACK_INFO_KEYS
33
from ..utils import logger as logger, platform_is_emscripten as platform_is_emscripten, truncate_string as truncate_string
4-
from .wrapper import WrapperSpanExporter as WrapperSpanExporter
4+
from .wrapper import WrapperLogExporter as WrapperLogExporter, WrapperSpanExporter as WrapperSpanExporter
55
from _typeshed import Incomplete
66
from functools import cached_property
7+
from opentelemetry.sdk._logs import LogData as LogData
78
from opentelemetry.sdk.trace import ReadableSpan
89
from opentelemetry.sdk.trace.export import SpanExportResult
910
from requests import Session
@@ -51,3 +52,7 @@ class BodyTooLargeError(Exception):
5152
class QuietSpanExporter(WrapperSpanExporter):
5253
"""A SpanExporter that catches request exceptions to prevent OTEL from logging a huge traceback."""
5354
def export(self, spans: Sequence[ReadableSpan]) -> SpanExportResult: ...
55+
56+
class QuietLogExporter(WrapperLogExporter):
57+
"""A LogExporter that catches request exceptions to prevent OTEL from logging a huge traceback."""
58+
def export(self, batch: Sequence[LogData]): ...

logfire-api/logfire_api/_internal/exporters/processor_wrapper.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from ..constants import ATTRIBUTES_LOG_LEVEL_NUM_KEY as ATTRIBUTES_LOG_LEVEL_NUM_KEY, ATTRIBUTES_MESSAGE_KEY as ATTRIBUTES_MESSAGE_KEY, ATTRIBUTES_MESSAGE_TEMPLATE_KEY as ATTRIBUTES_MESSAGE_TEMPLATE_KEY, ATTRIBUTES_SPAN_TYPE_KEY as ATTRIBUTES_SPAN_TYPE_KEY, LEVEL_NUMBERS as LEVEL_NUMBERS, PENDING_SPAN_NAME_SUFFIX as PENDING_SPAN_NAME_SUFFIX, log_level_attributes as log_level_attributes
1+
from ..constants import ATTRIBUTES_LOG_LEVEL_NUM_KEY as ATTRIBUTES_LOG_LEVEL_NUM_KEY, ATTRIBUTES_MESSAGE_KEY as ATTRIBUTES_MESSAGE_KEY, ATTRIBUTES_MESSAGE_TEMPLATE_KEY as ATTRIBUTES_MESSAGE_TEMPLATE_KEY, LEVEL_NUMBERS as LEVEL_NUMBERS, log_level_attributes as log_level_attributes
22
from ..db_statement_summary import message_from_db_statement as message_from_db_statement
33
from ..scrubbing import BaseScrubber as BaseScrubber
44
from ..utils import ReadableSpanDict as ReadableSpanDict, is_asgi_send_receive_span_name as is_asgi_send_receive_span_name, is_instrumentation_suppressed as is_instrumentation_suppressed, span_to_dict as span_to_dict, truncate_string as truncate_string

logfire-api/logfire_api/_internal/exporters/wrapper.pyi

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from _typeshed import Incomplete
22
from dataclasses import dataclass
33
from opentelemetry import context
4+
from opentelemetry.sdk._logs import LogData, LogRecordProcessor
5+
from opentelemetry.sdk._logs.export import LogExportResult, LogExporter
46
from opentelemetry.sdk.metrics.export import AggregationTemporality as AggregationTemporality, MetricExportResult, MetricExporter, MetricsData
57
from opentelemetry.sdk.metrics.view import Aggregation as Aggregation
68
from opentelemetry.sdk.trace import ReadableSpan, Span, SpanProcessor
@@ -31,3 +33,18 @@ class WrapperSpanProcessor(SpanProcessor):
3133
def on_end(self, span: ReadableSpan) -> None: ...
3234
def shutdown(self) -> None: ...
3335
def force_flush(self, timeout_millis: int = 30000) -> bool: ...
36+
37+
@dataclass
38+
class WrapperLogExporter(LogExporter):
39+
"""A base class for LogExporters that wrap another exporter."""
40+
exporter: LogExporter
41+
def export(self, batch: Sequence[LogData]) -> LogExportResult: ...
42+
def shutdown(self): ...
43+
44+
@dataclass
45+
class WrapperLogProcessor(LogRecordProcessor):
46+
"""A base class for SpanProcessors that wrap another processor."""
47+
processor: LogRecordProcessor
48+
def emit(self, log_data: LogData): ...
49+
def shutdown(self): ...
50+
def force_flush(self, timeout_millis: int = 30000): ...

logfire-api/logfire_api/_internal/integrations/flask.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
from flask.app import Flask
2+
from logfire._internal.stack_info import warn_at_user_stacklevel as warn_at_user_stacklevel
23
from logfire._internal.utils import maybe_capture_server_headers as maybe_capture_server_headers
34
from logfire.integrations.flask import CommenterOptions as CommenterOptions, RequestHook as RequestHook, ResponseHook as ResponseHook
45
from typing import Any
56

6-
def instrument_flask(app: Flask, *, capture_headers: bool, enable_commenter: bool, commenter_options: CommenterOptions | None, exclude_urls: str | None = None, request_hook: RequestHook | None = None, response_hook: ResponseHook | None = None, **kwargs: Any):
7+
def instrument_flask(app: Flask, *, capture_headers: bool, enable_commenter: bool, commenter_options: CommenterOptions | None, excluded_urls: str | None = None, request_hook: RequestHook | None = None, response_hook: ResponseHook | None = None, **kwargs: Any):
78
"""Instrument `app` so that spans are automatically created for each request.
89
910
See the `Logfire.instrument_flask` method for details.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from dataclasses import dataclass
2+
from opentelemetry._logs import LogRecord, Logger, LoggerProvider
3+
from opentelemetry.util.types import Attributes
4+
from threading import Lock
5+
from weakref import WeakSet
6+
7+
@dataclass
8+
class ProxyLoggerProvider(LoggerProvider):
9+
"""A logger provider that wraps another internal logger provider allowing it to be re-assigned."""
10+
provider: LoggerProvider
11+
loggers: WeakSet[ProxyLogger] = ...
12+
lock: Lock = ...
13+
suppressed_scopes: set[str] = ...
14+
def get_logger(self, name: str, version: str | None = None, schema_url: str | None = None, attributes: Attributes | None = None) -> Logger: ...
15+
def suppress_scopes(self, *scopes: str) -> None: ...
16+
def set_provider(self, logger_provider: LoggerProvider) -> None: ...
17+
def __getattr__(self, item: str): ...
18+
19+
@dataclass(eq=False)
20+
class ProxyLogger(Logger):
21+
logger: Logger
22+
name: str
23+
version: str | None = ...
24+
schema_url: str | None = ...
25+
attributes: Attributes | None = ...
26+
def emit(self, record: LogRecord) -> None: ...
27+
def set_logger(self, provider: LoggerProvider) -> None: ...
28+
def __getattr__(self, item: str): ...

logfire-api/logfire_api/_internal/main.pyi

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ from ..version import VERSION as VERSION
1414
from .auto_trace import AutoTraceModule as AutoTraceModule, install_auto_tracing as install_auto_tracing
1515
from .config import GLOBAL_CONFIG as GLOBAL_CONFIG, LogfireConfig as LogfireConfig
1616
from .config_params import PydanticPluginRecordValues as PydanticPluginRecordValues
17-
from .constants import ATTRIBUTES_JSON_SCHEMA_KEY as ATTRIBUTES_JSON_SCHEMA_KEY, ATTRIBUTES_LOG_LEVEL_NUM_KEY as ATTRIBUTES_LOG_LEVEL_NUM_KEY, ATTRIBUTES_MESSAGE_KEY as ATTRIBUTES_MESSAGE_KEY, ATTRIBUTES_MESSAGE_TEMPLATE_KEY as ATTRIBUTES_MESSAGE_TEMPLATE_KEY, ATTRIBUTES_SAMPLE_RATE_KEY as ATTRIBUTES_SAMPLE_RATE_KEY, ATTRIBUTES_SPAN_TYPE_KEY as ATTRIBUTES_SPAN_TYPE_KEY, ATTRIBUTES_TAGS_KEY as ATTRIBUTES_TAGS_KEY, DISABLE_CONSOLE_KEY as DISABLE_CONSOLE_KEY, LEVEL_NUMBERS as LEVEL_NUMBERS, LevelName as LevelName, NULL_ARGS_KEY as NULL_ARGS_KEY, OTLP_MAX_INT_SIZE as OTLP_MAX_INT_SIZE, log_level_attributes as log_level_attributes
17+
from .constants import ATTRIBUTES_JSON_SCHEMA_KEY as ATTRIBUTES_JSON_SCHEMA_KEY, ATTRIBUTES_LOG_LEVEL_NUM_KEY as ATTRIBUTES_LOG_LEVEL_NUM_KEY, ATTRIBUTES_MESSAGE_KEY as ATTRIBUTES_MESSAGE_KEY, ATTRIBUTES_MESSAGE_TEMPLATE_KEY as ATTRIBUTES_MESSAGE_TEMPLATE_KEY, ATTRIBUTES_SAMPLE_RATE_KEY as ATTRIBUTES_SAMPLE_RATE_KEY, ATTRIBUTES_SPAN_TYPE_KEY as ATTRIBUTES_SPAN_TYPE_KEY, ATTRIBUTES_TAGS_KEY as ATTRIBUTES_TAGS_KEY, DISABLE_CONSOLE_KEY as DISABLE_CONSOLE_KEY, LEVEL_NUMBERS as LEVEL_NUMBERS, LevelName as LevelName, OTLP_MAX_INT_SIZE as OTLP_MAX_INT_SIZE, log_level_attributes as log_level_attributes
1818
from .formatter import logfire_format as logfire_format, logfire_format_with_magic as logfire_format_with_magic
1919
from .instrument import instrument as instrument
2020
from .integrations.asgi import ASGIApp as ASGIApp, ASGIInstrumentKwargs as ASGIInstrumentKwargs
@@ -615,7 +615,7 @@ class Logfire:
615615
def instrument_psycopg(self, conn_or_module: PsycopgConnection | Psycopg2Connection, **kwargs: Any) -> None: ...
616616
@overload
617617
def instrument_psycopg(self, conn_or_module: None | Literal['psycopg', 'psycopg2'] | ModuleType = None, enable_commenter: bool = False, commenter_options: PsycopgCommenterOptions | None = None, **kwargs: Any) -> None: ...
618-
def instrument_flask(self, app: Flask, *, capture_headers: bool = False, enable_commenter: bool = True, commenter_options: FlaskCommenterOptions | None = None, exclude_urls: str | None = None, request_hook: FlaskRequestHook | None = None, response_hook: FlaskResponseHook | None = None, **kwargs: Any) -> None:
618+
def instrument_flask(self, app: Flask, *, capture_headers: bool = False, enable_commenter: bool = True, commenter_options: FlaskCommenterOptions | None = None, excluded_urls: str | None = None, request_hook: FlaskRequestHook | None = None, response_hook: FlaskResponseHook | None = None, **kwargs: Any) -> None:
619619
"""Instrument `app` so that spans are automatically created for each request.
620620
621621
Uses the
@@ -628,7 +628,7 @@ class Logfire:
628628
enable_commenter: Adds comments to SQL queries performed by Flask, so that database logs have additional context.
629629
commenter_options: Configure the tags to be added to the SQL comments.
630630
See more about it on the [SQLCommenter Configurations](https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/flask/flask.html#sqlcommenter-configurations).
631-
exclude_urls: A string containing a comma-delimited list of regexes used to exclude URLs from tracking.
631+
excluded_urls: A string containing a comma-delimited list of regexes used to exclude URLs from tracking.
632632
request_hook: A function called right after a span is created for a request.
633633
response_hook: A function called right before a span is finished for the response.
634634
**kwargs: Additional keyword arguments to pass to the OpenTelemetry Flask instrumentation.
@@ -1110,12 +1110,8 @@ def prepare_otlp_attributes(attributes: dict[str, Any]) -> dict[str, otel_types.
11101110
11111111
This will convert any non-OpenTelemetry compatible types to JSON.
11121112
"""
1113-
def set_user_attribute(otlp_attributes: dict[str, otel_types.AttributeValue], key: str, value: Any) -> tuple[str, otel_types.AttributeValue]:
1114-
"""Convert a user attribute to an OpenTelemetry compatible type and add it to the given dictionary.
1115-
1116-
Returns the final key and value that was added to the dictionary.
1117-
The key will be the original key unless the value was `None`, in which case it will be `NULL_ARGS_KEY`.
1118-
"""
1113+
def prepare_otlp_attribute(value: Any) -> otel_types.AttributeValue:
1114+
"""Convert a user attribute to an OpenTelemetry compatible type."""
11191115
def set_user_attributes_on_raw_span(span: Span, attributes: dict[str, Any]) -> None: ...
11201116
P = ParamSpec('P')
11211117
R = TypeVar('R')

logfire-api/logfire_api/_internal/scrubbing.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import re
22
import typing_extensions
3-
from .constants import ATTRIBUTES_JSON_SCHEMA_KEY as ATTRIBUTES_JSON_SCHEMA_KEY, ATTRIBUTES_LOGGING_NAME as ATTRIBUTES_LOGGING_NAME, ATTRIBUTES_LOG_LEVEL_NAME_KEY as ATTRIBUTES_LOG_LEVEL_NAME_KEY, ATTRIBUTES_LOG_LEVEL_NUM_KEY as ATTRIBUTES_LOG_LEVEL_NUM_KEY, ATTRIBUTES_MESSAGE_KEY as ATTRIBUTES_MESSAGE_KEY, ATTRIBUTES_MESSAGE_TEMPLATE_KEY as ATTRIBUTES_MESSAGE_TEMPLATE_KEY, ATTRIBUTES_PENDING_SPAN_REAL_PARENT_KEY as ATTRIBUTES_PENDING_SPAN_REAL_PARENT_KEY, ATTRIBUTES_SAMPLE_RATE_KEY as ATTRIBUTES_SAMPLE_RATE_KEY, ATTRIBUTES_SCRUBBED_KEY as ATTRIBUTES_SCRUBBED_KEY, ATTRIBUTES_SPAN_TYPE_KEY as ATTRIBUTES_SPAN_TYPE_KEY, ATTRIBUTES_TAGS_KEY as ATTRIBUTES_TAGS_KEY, NULL_ARGS_KEY as NULL_ARGS_KEY, RESOURCE_ATTRIBUTES_PACKAGE_VERSIONS as RESOURCE_ATTRIBUTES_PACKAGE_VERSIONS
3+
from .constants import ATTRIBUTES_JSON_SCHEMA_KEY as ATTRIBUTES_JSON_SCHEMA_KEY, ATTRIBUTES_LOGGING_NAME as ATTRIBUTES_LOGGING_NAME, ATTRIBUTES_LOG_LEVEL_NAME_KEY as ATTRIBUTES_LOG_LEVEL_NAME_KEY, ATTRIBUTES_LOG_LEVEL_NUM_KEY as ATTRIBUTES_LOG_LEVEL_NUM_KEY, ATTRIBUTES_MESSAGE_KEY as ATTRIBUTES_MESSAGE_KEY, ATTRIBUTES_MESSAGE_TEMPLATE_KEY as ATTRIBUTES_MESSAGE_TEMPLATE_KEY, ATTRIBUTES_PENDING_SPAN_REAL_PARENT_KEY as ATTRIBUTES_PENDING_SPAN_REAL_PARENT_KEY, ATTRIBUTES_SAMPLE_RATE_KEY as ATTRIBUTES_SAMPLE_RATE_KEY, ATTRIBUTES_SCRUBBED_KEY as ATTRIBUTES_SCRUBBED_KEY, ATTRIBUTES_SPAN_TYPE_KEY as ATTRIBUTES_SPAN_TYPE_KEY, ATTRIBUTES_TAGS_KEY as ATTRIBUTES_TAGS_KEY, RESOURCE_ATTRIBUTES_PACKAGE_VERSIONS as RESOURCE_ATTRIBUTES_PACKAGE_VERSIONS
44
from .stack_info import STACK_INFO_KEYS as STACK_INFO_KEYS
55
from .utils import ReadableSpanDict as ReadableSpanDict
66
from _typeshed import Incomplete

logfire-api/logfire_api/_internal/tracer.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import opentelemetry.trace as trace_api
22
from .config import LogfireConfig as LogfireConfig
3-
from .constants import ATTRIBUTES_MESSAGE_KEY as ATTRIBUTES_MESSAGE_KEY, ATTRIBUTES_PENDING_SPAN_REAL_PARENT_KEY as ATTRIBUTES_PENDING_SPAN_REAL_PARENT_KEY, ATTRIBUTES_SAMPLE_RATE_KEY as ATTRIBUTES_SAMPLE_RATE_KEY, ATTRIBUTES_SPAN_TYPE_KEY as ATTRIBUTES_SPAN_TYPE_KEY, ATTRIBUTES_VALIDATION_ERROR_KEY as ATTRIBUTES_VALIDATION_ERROR_KEY, PENDING_SPAN_NAME_SUFFIX as PENDING_SPAN_NAME_SUFFIX, log_level_attributes as log_level_attributes
3+
from .constants import ATTRIBUTES_MESSAGE_KEY as ATTRIBUTES_MESSAGE_KEY, ATTRIBUTES_PENDING_SPAN_REAL_PARENT_KEY as ATTRIBUTES_PENDING_SPAN_REAL_PARENT_KEY, ATTRIBUTES_SAMPLE_RATE_KEY as ATTRIBUTES_SAMPLE_RATE_KEY, ATTRIBUTES_SPAN_TYPE_KEY as ATTRIBUTES_SPAN_TYPE_KEY, ATTRIBUTES_VALIDATION_ERROR_KEY as ATTRIBUTES_VALIDATION_ERROR_KEY, log_level_attributes as log_level_attributes
44
from .utils import handle_internal_errors as handle_internal_errors
55
from _typeshed import Incomplete
66
from dataclasses import dataclass
@@ -99,3 +99,4 @@ def get_sample_rate_from_attributes(attributes: otel_types.Attributes) -> float
9999
def record_exception(span: trace_api.Span, exception: BaseException, *, attributes: otel_types.Attributes = None, timestamp: int | None = None, escaped: bool = False) -> None:
100100
"""Similar to the OTEL SDK Span.record_exception method, with our own additions."""
101101
def set_exception_status(span: trace_api.Span, exception: BaseException): ...
102+
def is_starlette_http_exception_400(exception: BaseException) -> bool: ...

0 commit comments

Comments
 (0)