getsentry / getsentry/sentry-python

Django cache.add operations do not emit cache spans

Đang mở
#6,402 1 bình luận 0 reaction 1 người được giao Được @immanuwell nhận Xem trên GitHub
Bug Python Spans
Ngôn ngữ chính
Python
Star
2.2k
Fork
669
Merge trung bình
1 ngày 1 giờ
Pull request đã merge (30 ngày)
213

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.