sentry_sdk.api
import inspect import warnings from contextlib import contextmanager from sentry_sdk import tracing_utils, Client from sentry_sdk._init_implementation import init from sentry_sdk.consts import INSTRUMENTER from sentry_sdk.scope import Scope, _ScopeManager, new_scope, isolation_scope from sentry_sdk.traces import StreamedSpan from sentry_sdk.tracing import NoOpSpan, Transaction, trace from sentry_sdk.crons import monitor from typing import TYPE_CHECKING if TYPE_CHECKING: from collections.abc import Mapping from typing import Any from typing import Dict from typing import Generator from typing import Optional from typing import overload from typing import Callable from typing import TypeVar from typing import ContextManager from typing import Union from typing_extensions import Unpack from sentry_sdk.client import BaseClient from sentry_sdk._types import ( Event, Hint, Breadcrumb, BreadcrumbHint, ExcInfo, MeasurementUnit, LogLevelStr, SamplingContext, ) from sentry_sdk.traces import StreamedSpan from sentry_sdk.tracing import Span, TransactionKwargs T = TypeVar("T") F = TypeVar("F", bound=Callable[..., Any]) else: def overload(x: "T") -> "T": return x # When changing this, update __all__ in __init__.py too __all__ = [ "init", "add_attachment", "add_breadcrumb", "capture_event", "capture_exception", "capture_message", "configure_scope", "continue_trace", "flush", "flush_async", "get_baggage", "get_client", "get_global_scope", "get_isolation_scope", "get_current_scope", "get_current_span", "get_traceparent", "is_initialized", "isolation_scope", "last_event_id", "new_scope", "push_scope", "remove_attribute", "set_attribute", "set_context", "set_extra", "set_level", "set_measurement", "set_tag", "set_tags", "set_user", "start_span", "start_transaction", "trace", "monitor", "start_session", "end_session", "set_transaction_name", "update_current_span", ] def scopemethod(f: "F") -> "F": f.__doc__ = "%s\n\n%s" % ( "Alias for :py:meth:`sentry_sdk.Scope.%s`" % f.__name__, inspect.getdoc(getattr(Scope, f.__name__)), ) return f def clientmethod(f: "F") -> "F": f.__doc__ = "%s\n\n%s" % ( "Alias for :py:meth:`sentry_sdk.Client.%s`" % f.__name__, inspect.getdoc(getattr(Client, f.__name__)), ) return f @scopemethod def get_client() -> "BaseClient": return Scope.get_client()