/opt/cloudlinux/venv/lib/python3.11/site-packages/sentry_sdk/integrations
NameSizeModeActions
django/-0755rm
grpc/-0755rm
opentelemetry/-0755rm
redis/-0755rm
spark/-0755rm
__pycache__/-0755rm
aiohttp.py115530644editdlrm
argv.py9630644editdlrm
arq.py67370644editdlrm
asgi.py118210644editdlrm
asyncio.py30490644editdlrm
atexit.py18460644editdlrm
aws_lambda.py158150644editdlrm
beam.py56890644editdlrm
boto3.py45420644editdlrm
bottle.py64710644editdlrm
celery.py191000644editdlrm
chalice.py47690644editdlrm
cloud_resource_context.py67550644editdlrm
dedupe.py11840644editdlrm
excepthook.py22600644editdlrm
executing.py20410644editdlrm
falcon.py79840644editdlrm
fastapi.py44960644editdlrm
flask.py79070644editdlrm
gcp.py82130644editdlrm
gnu_backtrace.py29300644editdlrm
httpx.py50050644editdlrm
huey.py47000644editdlrm
logging.py91810644editdlrm
loguru.py30510644editdlrm
modules.py21100644editdlrm
pure_eval.py45540644editdlrm
pymongo.py60070644editdlrm
pyramid.py74420644editdlrm
quart.py73770644editdlrm
rq.py54110644editdlrm
sanic.py113260644editdlrm
serverless.py19750644editdlrm
socket.py29450644editdlrm
sqlalchemy.py42440644editdlrm
starlette.py232110644editdlrm
starlite.py100890644editdlrm
stdlib.py82510644editdlrm
threading.py29370644editdlrm
tornado.py73420644editdlrm
trytond.py17450644editdlrm
wsgi.py95810644editdlrm
_wsgi_common.py45370644editdlrm
__init__.py68270644editdlrm
Edit: /opt/cloudlinux/venv/lib/python3.11/site-packages/sentry_sdk/integrations/gnu_backtrace.py (2930B)
import re from sentry_sdk.hub import Hub from sentry_sdk.integrations import Integration from sentry_sdk.scope import add_global_event_processor from sentry_sdk.utils import capture_internal_exceptions from sentry_sdk._types import TYPE_CHECKING if TYPE_CHECKING: from typing import Any from typing import Dict MODULE_RE = r"[a-zA-Z0-9/._:\\-]+" TYPE_RE = r"[a-zA-Z0-9._:<>,-]+" HEXVAL_RE = r"[A-Fa-f0-9]+" FRAME_RE = r""" ^(?P\d+)\.\s (?P{MODULE_RE})\( (?P{TYPE_RE}\ )? ((?P{TYPE_RE}) (?P\(.*\))? )? ((?P\ const)?\+0x(?P{HEXVAL_RE}))? \)\s \[0x(?P{HEXVAL_RE})\]$ """.format( MODULE_RE=MODULE_RE, HEXVAL_RE=HEXVAL_RE, TYPE_RE=TYPE_RE ) FRAME_RE = re.compile(FRAME_RE, re.MULTILINE | re.VERBOSE) class GnuBacktraceIntegration(Integration): identifier = "gnu_backtrace" @staticmethod def setup_once(): # type: () -> None @add_global_event_processor def process_gnu_backtrace(event, hint): # type: (Dict[str, Any], Dict[str, Any]) -> Dict[str, Any] with capture_internal_exceptions(): return _process_gnu_backtrace(event, hint) def _process_gnu_backtrace(event, hint): # type: (Dict[str, Any], Dict[str, Any]) -> Dict[str, Any] if Hub.current.get_integration(GnuBacktraceIntegration) is None: return event exc_info = hint.get("exc_info", None) if exc_info is None: return event exception = event.get("exception", None) if exception is None: return event values = exception.get("values", None) if values is None: return event for exception in values: frames = exception.get("stacktrace", {}).get("frames", []) if not frames: continue msg = exception.get("value", None) if not msg: continue additional_frames = [] new_msg = [] for line in msg.splitlines(): match = FRAME_RE.match(line) if match: additional_frames.append( ( int(match.group("index")), { "package": match.group("package") or None, "function": match.group("function") or None, "platform": "native", }, ) ) else: # Put garbage lines back into message, not sure what to do with them. new_msg.append(line) if additional_frames: additional_frames.sort(key=lambda x: -x[0]) for _, frame in additional_frames: frames.append(frame) new_msg.append("") exception["value"] = "\n".join(new_msg) return event