Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Django cache.add operations do not emit cache spans #6402

Copy link
Copy link

Description

@immanuwell
Issue body actions

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.

Reactions are currently unavailable

Metadata

Metadata

Assignees

Projects

Status
No status
Show more project fields

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

Morty Proxy This is a proxified and sanitized view of the page, visit original site.