Просмотр исходного кода

feat(save_event): Track if stacktrace processing uses cache (#55039)

This will be useful to see stacktrace processing averages when using caching vs not.
Armen Zambrano G 1 год назад
Родитель
Сommit
ab9be6bc87
2 измененных файлов с 7 добавлено и 7 удалено
  1. 6 2
      src/sentry/event_manager.py
  2. 1 5
      src/sentry/grouping/enhancer/__init__.py

+ 6 - 2
src/sentry/event_manager.py

@@ -458,7 +458,7 @@ class EventManager:
         project: Project,
         job: Job,
         projects: ProjectsMapping,
-        metric_tags: Dict[str, str],
+        metric_tags: MutableTags,
         raw: bool = False,
         cache_key: Optional[str] = None,
     ) -> Event:
@@ -2356,10 +2356,14 @@ def _calculate_event_grouping(
     Main entrypoint for modifying/enhancing and grouping an event, writes
     hashes back into event payload.
     """
-    metric_tags = {
+    load_stacktrace_from_cache = bool(event.org_can_load_stacktrace_from_cache)
+    metric_tags: MutableTags = {
         "grouping_config": grouping_config["id"],
         "platform": event.platform or "unknown",
+        "loading_from_cache": load_stacktrace_from_cache,
     }
+    # This will help us differentiate when a transaction uses caching vs not
+    sentry_sdk.set_tag("stacktrace.loaded_from_cache", load_stacktrace_from_cache)
 
     with metrics.timer("event_manager.normalize_stacktraces_for_grouping", tags=metric_tags):
         with sentry_sdk.start_span(op="event_manager.normalize_stacktraces_for_grouping"):

+ 1 - 5
src/sentry/grouping/enhancer/__init__.py

@@ -511,11 +511,7 @@ def _update_frames_from_cached_values(
     Returns if the merged has correctly happened.
     """
     frames_changed = False
-    # XXX: Test the fallback value
-    with metrics.timer(
-        f"{DATADOG_KEY}.cache.get.timer",
-    ):
-        changed_frames_values = cache.get(cache_key, {})
+    changed_frames_values = cache.get(cache_key, {})
 
     # This helps tracking changes in the hit/miss ratio of the cache
     metrics.incr(