from functools import wraps import sentry_sdk from sentry_sdk import get_current_span from sentry_sdk._types import TYPE_CHECKING from sentry_sdk.consts import OP from sentry_sdk.utils import logger, qualname_from_function if TYPE_CHECKING: from typing import Any def start_child_span_decorator(func): # type: (Any) -> Any """ Decorator to add child spans for functions. This is the Python 2 compatible version of the decorator. Duplicated code from ``sentry_sdk.tracing_utils_python3.start_child_span_decorator``. See also ``sentry_sdk.tracing.trace()``. """ @wraps(func) def func_with_tracing(*args, **kwargs): # type: (*Any, **Any) -> Any span = get_current_span(sentry_sdk.Hub.current) if span is None: logger.warning( "Can not create a child span for %s. " "Please start a Sentry transaction before calling this function.", qualname_from_function(func), ) return func(*args, **kwargs) with span.start_child( op=OP.FUNCTION, description=qualname_from_function(func), ): return func(*args, **kwargs) return func_with_tracing
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
__pycache__ | Folder | 0755 |
|
|
crons | Folder | 0755 |
|
|
integrations | Folder | 0755 |
|
|
__init__.py | File | 1.03 KB | 0644 |
|
_compat.py | File | 2.73 KB | 0644 |
|
_functools.py | File | 4.84 KB | 0644 |
|
_lru_cache.py | File | 5.26 KB | 0644 |
|
_queue.py | File | 11 KB | 0644 |
|
_types.py | File | 2.19 KB | 0644 |
|
_werkzeug.py | File | 3.7 KB | 0644 |
|
api.py | File | 6.05 KB | 0644 |
|
attachments.py | File | 1.77 KB | 0644 |
|
client.py | File | 22.35 KB | 0644 |
|
consts.py | File | 8.49 KB | 0644 |
|
debug.py | File | 1.11 KB | 0644 |
|
envelope.py | File | 9.37 KB | 0644 |
|
hub.py | File | 26.42 KB | 0644 |
|
monitor.py | File | 2.97 KB | 0644 |
|
profiler.py | File | 33.18 KB | 0644 |
|
py.typed | File | 0 B | 0644 |
|
scope.py | File | 24.26 KB | 0644 |
|
scrubber.py | File | 3.8 KB | 0644 |
|
serializer.py | File | 12.97 KB | 0644 |
|
session.py | File | 5.43 KB | 0644 |
|
sessions.py | File | 5.76 KB | 0644 |
|
tracing.py | File | 29.04 KB | 0644 |
|
tracing_utils.py | File | 12 KB | 0644 |
|
tracing_utils_py2.py | File | 1.21 KB | 0644 |
|
tracing_utils_py3.py | File | 2.1 KB | 0644 |
|
transport.py | File | 18.13 KB | 0644 |
|
utils.py | File | 45.58 KB | 0644 |
|
worker.py | File | 4.15 KB | 0644 |
|