getsentry / getsentry/sentry-python

Django cache.add operations do not emit cache spans

未關閉
#6,402 1 則留言 0 個 reaction 已指派 1 人 已被 @immanuwell 認領 在 GitHub 檢視
Bug Python Spans
主要語言
Python
星號
2.2k
分支
669
平均合併
1 天 40 分鐘
30 天內合併 PR
212

描述

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

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。