Django cache.add operations do not emit cache spans

Aperta
#6,402 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

@immanuwell ci sta già lavorando.

Dal 26/5/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

Bug Python Spans
Problem

DjangoIntegration(cache_spans=True) traces cache.set() and cache.get(), but cache.add() emits no cache span.

cache.add() is a normal Django cache write API, so this shows up in practice for apps that use add-on-miss / write-if-absent flows.

Repro
from django.core.cache import cache
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration

sentry_sdk.init(
    integrations=[DjangoIntegration(cache_spans=True)],
    traces_sample_rate=1.0,
)

with sentry_sdk.start_transaction(name="t", op="test"):
    cache.add("k", "value")

Actual: no cache.put span for cache.add().

Expected: cache.add() should be traced like the other cache write methods.

Notes

I verified locally that cache.set() emits a span while cache.add() does not, and a targeted fix is just to instrument add as a cache write.

Lingua principale
Python
Stelle
2.2k
Fork
672
Merge medio
1g 13m
PR unite (30g)
212

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di getsentry/sentry-python

Tutte le issue di getsentry/sentry-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.