|
@@ -12,7 +12,7 @@ from sentry.eventstore.processing.base import Event
|
|
from sentry.features.rollout import in_random_rollout
|
|
from sentry.features.rollout import in_random_rollout
|
|
from sentry.killswitches import killswitch_matches_context
|
|
from sentry.killswitches import killswitch_matches_context
|
|
from sentry.lang.javascript.processing import process_js_stacktraces
|
|
from sentry.lang.javascript.processing import process_js_stacktraces
|
|
-from sentry.lang.native.symbolicator import Symbolicator, SymbolicatorTaskKind
|
|
|
|
|
|
+from sentry.lang.native.symbolicator import Symbolicator, SymbolicatorPlatform, SymbolicatorTaskKind
|
|
from sentry.models.organization import Organization
|
|
from sentry.models.organization import Organization
|
|
from sentry.models.project import Project
|
|
from sentry.models.project import Project
|
|
from sentry.processing import realtime_metrics
|
|
from sentry.processing import realtime_metrics
|
|
@@ -101,11 +101,16 @@ def get_native_symbolication_function(data: Any) -> Callable[[Symbolicator, Any]
|
|
|
|
|
|
def get_symbolication_function(
|
|
def get_symbolication_function(
|
|
data: Any,
|
|
data: Any,
|
|
-) -> tuple[bool, Callable[[Symbolicator, Any], Any] | None]:
|
|
|
|
|
|
+) -> tuple[SymbolicatorPlatform, Callable[[Symbolicator, Any], Any] | None]:
|
|
|
|
+ from sentry.lang.java.processing import process_jvm_stacktraces
|
|
|
|
+ from sentry.lang.java.utils import should_use_symbolicator_for_proguard
|
|
|
|
+
|
|
if data["platform"] in ("javascript", "node"):
|
|
if data["platform"] in ("javascript", "node"):
|
|
- return True, process_js_stacktraces
|
|
|
|
|
|
+ return SymbolicatorPlatform.js, process_js_stacktraces
|
|
|
|
+ elif data["platform"] == "java" and should_use_symbolicator_for_proguard(data.get("project")):
|
|
|
|
+ return SymbolicatorPlatform.jvm, process_jvm_stacktraces
|
|
else:
|
|
else:
|
|
- return False, get_native_symbolication_function(data)
|
|
|
|
|
|
+ return SymbolicatorPlatform.native, get_native_symbolication_function(data)
|
|
|
|
|
|
|
|
|
|
class SymbolicationTimeout(Exception):
|
|
class SymbolicationTimeout(Exception):
|
|
@@ -163,11 +168,11 @@ def _do_symbolicate_event(
|
|
# After JS processing, we check `get_native_symbolication_function`,
|
|
# After JS processing, we check `get_native_symbolication_function`,
|
|
# because maybe we need to feed it to another round of
|
|
# because maybe we need to feed it to another round of
|
|
# `symbolicate_event`, but for *native* that time.
|
|
# `symbolicate_event`, but for *native* that time.
|
|
- if not was_killswitched and task_kind.is_js:
|
|
|
|
|
|
+ if not was_killswitched and task_kind.platform == SymbolicatorPlatform.js:
|
|
symbolication_function = get_native_symbolication_function(data)
|
|
symbolication_function = get_native_symbolication_function(data)
|
|
if symbolication_function:
|
|
if symbolication_function:
|
|
submit_symbolicate(
|
|
submit_symbolicate(
|
|
- task_kind=task_kind.with_js(False),
|
|
|
|
|
|
+ task_kind=task_kind.with_platform(SymbolicatorPlatform.native),
|
|
cache_key=cache_key,
|
|
cache_key=cache_key,
|
|
event_id=event_id,
|
|
event_id=event_id,
|
|
start_time=start_time,
|
|
start_time=start_time,
|
|
@@ -185,10 +190,15 @@ def _do_symbolicate_event(
|
|
has_attachments=has_attachments,
|
|
has_attachments=has_attachments,
|
|
)
|
|
)
|
|
|
|
|
|
- if not task_kind.is_js:
|
|
|
|
- symbolication_function = get_native_symbolication_function(data)
|
|
|
|
- else:
|
|
|
|
|
|
+ symbolication_function: Callable[[Symbolicator, Any], Any] | None = None
|
|
|
|
+ if task_kind.platform == SymbolicatorPlatform.js:
|
|
symbolication_function = process_js_stacktraces
|
|
symbolication_function = process_js_stacktraces
|
|
|
|
+ elif task_kind.platform == SymbolicatorPlatform.jvm:
|
|
|
|
+ from sentry.lang.java.processing import process_jvm_stacktraces
|
|
|
|
+
|
|
|
|
+ symbolication_function = process_jvm_stacktraces
|
|
|
|
+ else:
|
|
|
|
+ symbolication_function = get_native_symbolication_function(data)
|
|
|
|
|
|
symbolication_function_name = getattr(symbolication_function, "__name__", "none")
|
|
symbolication_function_name = getattr(symbolication_function, "__name__", "none")
|
|
|
|
|
|
@@ -323,12 +333,18 @@ def get_kind_from_task(task: Any) -> SymbolicatorTaskKind:
|
|
symbolicate_js_event_low_priority,
|
|
symbolicate_js_event_low_priority,
|
|
symbolicate_event_from_reprocessing_low_priority,
|
|
symbolicate_event_from_reprocessing_low_priority,
|
|
]
|
|
]
|
|
- is_js = task in [symbolicate_js_event, symbolicate_js_event_low_priority]
|
|
|
|
|
|
+ if task in [symbolicate_js_event, symbolicate_js_event_low_priority]:
|
|
|
|
+ platform = SymbolicatorPlatform.js
|
|
|
|
+ elif task in [symbolicate_jvm_event, symbolicate_jvm_event_low_priority]:
|
|
|
|
+ platform = SymbolicatorPlatform.jvm
|
|
|
|
+ else:
|
|
|
|
+ platform = SymbolicatorPlatform.native
|
|
|
|
+
|
|
is_reprocessing = task in [
|
|
is_reprocessing = task in [
|
|
symbolicate_event_from_reprocessing,
|
|
symbolicate_event_from_reprocessing,
|
|
symbolicate_event_from_reprocessing_low_priority,
|
|
symbolicate_event_from_reprocessing_low_priority,
|
|
]
|
|
]
|
|
- return SymbolicatorTaskKind(is_js, is_low_priority, is_reprocessing)
|
|
|
|
|
|
+ return SymbolicatorTaskKind(platform, is_low_priority, is_reprocessing)
|
|
|
|
|
|
|
|
|
|
def submit_symbolicate(
|
|
def submit_symbolicate(
|
|
@@ -341,11 +357,16 @@ def submit_symbolicate(
|
|
) -> None:
|
|
) -> None:
|
|
# oh how I miss a real `match` statement...
|
|
# oh how I miss a real `match` statement...
|
|
task = symbolicate_event
|
|
task = symbolicate_event
|
|
- if task_kind.is_js:
|
|
|
|
|
|
+ if task_kind.platform == SymbolicatorPlatform.js:
|
|
if task_kind.is_low_priority:
|
|
if task_kind.is_low_priority:
|
|
task = symbolicate_js_event_low_priority
|
|
task = symbolicate_js_event_low_priority
|
|
else:
|
|
else:
|
|
task = symbolicate_js_event
|
|
task = symbolicate_js_event
|
|
|
|
+ elif task_kind.platform == SymbolicatorPlatform.jvm:
|
|
|
|
+ if task_kind.is_low_priority:
|
|
|
|
+ task = symbolicate_jvm_event_low_priority
|
|
|
|
+ else:
|
|
|
|
+ task = symbolicate_jvm_event
|
|
elif task_kind.is_reprocessing:
|
|
elif task_kind.is_reprocessing:
|
|
if task_kind.is_low_priority:
|
|
if task_kind.is_low_priority:
|
|
task = symbolicate_event_from_reprocessing_low_priority
|
|
task = symbolicate_event_from_reprocessing_low_priority
|
|
@@ -433,6 +454,42 @@ def symbolicate_js_event(
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
+# NOTE: Intentionally uses the same queue as `symbolicate_event`.
|
|
|
|
+@instrumented_task(
|
|
|
|
+ name="sentry.tasks.symbolicate_jvm_event",
|
|
|
|
+ queue="events.symbolicate_event",
|
|
|
|
+ time_limit=settings.SYMBOLICATOR_PROCESS_EVENT_HARD_TIMEOUT + 30,
|
|
|
|
+ soft_time_limit=settings.SYMBOLICATOR_PROCESS_EVENT_HARD_TIMEOUT + 20,
|
|
|
|
+ acks_late=True,
|
|
|
|
+ silo_mode=SiloMode.REGION,
|
|
|
|
+)
|
|
|
|
+def symbolicate_jvm_event(
|
|
|
|
+ cache_key: str,
|
|
|
|
+ start_time: int | None = None,
|
|
|
|
+ event_id: str | None = None,
|
|
|
|
+ data: Event | None = None,
|
|
|
|
+ queue_switches: int = 0,
|
|
|
|
+ has_attachments: bool = False,
|
|
|
|
+ **kwargs: Any,
|
|
|
|
+) -> None:
|
|
|
|
+ """
|
|
|
|
+ Handles event symbolication using the external service: symbolicator.
|
|
|
|
+
|
|
|
|
+ :param string cache_key: the cache key for the event data
|
|
|
|
+ :param int start_time: the timestamp when the event was ingested
|
|
|
|
+ :param string event_id: the event identifier
|
|
|
|
+ """
|
|
|
|
+ return _do_symbolicate_event(
|
|
|
|
+ cache_key=cache_key,
|
|
|
|
+ start_time=start_time,
|
|
|
|
+ event_id=event_id,
|
|
|
|
+ symbolicate_task=symbolicate_jvm_event,
|
|
|
|
+ data=data,
|
|
|
|
+ queue_switches=queue_switches,
|
|
|
|
+ has_attachments=has_attachments,
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+
|
|
@instrumented_task(
|
|
@instrumented_task(
|
|
name="sentry.tasks.store.symbolicate_event_low_priority",
|
|
name="sentry.tasks.store.symbolicate_event_low_priority",
|
|
queue="events.symbolicate_event_low_priority",
|
|
queue="events.symbolicate_event_low_priority",
|
|
@@ -509,6 +566,45 @@ def symbolicate_js_event_low_priority(
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
+# NOTE: Intentionally uses the same queue as `symbolicate_event_low_priority`.
|
|
|
|
+@instrumented_task(
|
|
|
|
+ name="sentry.tasks.symbolicate_jvm_event_low_priority",
|
|
|
|
+ queue="events.symbolicate_event_low_priority",
|
|
|
|
+ time_limit=settings.SYMBOLICATOR_PROCESS_EVENT_HARD_TIMEOUT + 30,
|
|
|
|
+ soft_time_limit=settings.SYMBOLICATOR_PROCESS_EVENT_HARD_TIMEOUT + 20,
|
|
|
|
+ acks_late=True,
|
|
|
|
+ silo_mode=SiloMode.REGION,
|
|
|
|
+)
|
|
|
|
+def symbolicate_jvm_event_low_priority(
|
|
|
|
+ cache_key: str,
|
|
|
|
+ start_time: int | None = None,
|
|
|
|
+ event_id: str | None = None,
|
|
|
|
+ data: Event | None = None,
|
|
|
|
+ queue_switches: int = 0,
|
|
|
|
+ has_attachments: bool = False,
|
|
|
|
+ **kwargs: Any,
|
|
|
|
+) -> None:
|
|
|
|
+ """
|
|
|
|
+ Handles event symbolication using the external service: symbolicator.
|
|
|
|
+
|
|
|
|
+ This puts the task on the low priority queue. Projects whose symbolication
|
|
|
|
+ events misbehave get sent there to protect the main queue.
|
|
|
|
+
|
|
|
|
+ :param string cache_key: the cache key for the event data
|
|
|
|
+ :param int start_time: the timestamp when the event was ingested
|
|
|
|
+ :param string event_id: the event identifier
|
|
|
|
+ """
|
|
|
|
+ return _do_symbolicate_event(
|
|
|
|
+ cache_key=cache_key,
|
|
|
|
+ start_time=start_time,
|
|
|
|
+ event_id=event_id,
|
|
|
|
+ symbolicate_task=symbolicate_jvm_event_low_priority,
|
|
|
|
+ data=data,
|
|
|
|
+ queue_switches=queue_switches,
|
|
|
|
+ has_attachments=has_attachments,
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+
|
|
@instrumented_task(
|
|
@instrumented_task(
|
|
name="sentry.tasks.store.symbolicate_event_from_reprocessing",
|
|
name="sentry.tasks.store.symbolicate_event_from_reprocessing",
|
|
queue="events.reprocessing.symbolicate_event",
|
|
queue="events.reprocessing.symbolicate_event",
|