Browse Source

feat(spans): enable cache spans s4s (#68900)

closes https://github.com/getsentry/sentry/issues/68068

Enables `cache.*` spans to be created and emitted by s4s
Dominik Buszowiecki 10 months ago
parent
commit
b29cf3cdd6

+ 4 - 1
src/sentry/utils/sdk.py

@@ -2,6 +2,7 @@ from __future__ import annotations
 
 import copy
 import logging
+import os
 import sys
 from collections.abc import Generator, Mapping, Sequence
 from types import FrameType
@@ -452,6 +453,8 @@ def configure_sdk():
         should_summarize_metric=minimetrics.should_summarize_metric,
     )
 
+    enable_cache_spans = os.getenv("SENTRY_URL_PREFIX") == "sentry.my.sentry.io"
+
     sentry_sdk.init(
         # set back the sentry4sentry_dsn popped above since we need a default dsn on the client
         # for dynamic sampling context public_key population
@@ -459,7 +462,7 @@ def configure_sdk():
         transport=MultiplexingTransport(),
         integrations=[
             DjangoAtomicIntegration(),
-            DjangoIntegration(signals_spans=False),
+            DjangoIntegration(signals_spans=False, cache_spans=enable_cache_spans),
             CeleryIntegration(monitor_beat_tasks=True, exclude_beat_tasks=exclude_beat_tasks),
             # This makes it so all levels of logging are recorded as breadcrumbs,
             # but none are captured as events (that's handled by the `internal`

BIN
tests/sentry/api/endpoints/__pycache__/test_project_metrics_visibility.cpython-311-pytest-8.0.0.pyc.21487