getsentry / getsentry/sentry-python

Django cache.add operations do not emit cache spans

Ouverte
#6,402 1 commentaire 0 réactions 1 personne assignée Réclamée par @immanuwell Voir sur GitHub
Bug Python Spans
Langage dominant
Python
Étoiles
2.2k
Forks
669
Merge moyen
1 j 1 h
PR mergées (30 j)
213

Description

### 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

```py
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.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.