Skip to content
Commit Detail

Commit f4616cc

Author
Jeremy Morrell (Cloudflare) <jmorrell@cloudflare.com> 2025-07-17 08:17:51 -0700
Parents
d170f4d
Tree
74d03bc
Refactor KV instrumentation (#4482)

The current code instruments spans in the KvNamespace::getHttpClient method, however while this cuts down on the amount of repetitive code needed, it ties our hands a bit because the span is no longer in scope after the result comes back, so we cannot annotate any thing about the result or any errors.

To fix this and prepare for more extensive instrumentation this lifts the existing span declarations into each of the exposed KV methods (get, getBulk, getWithMetadata, list, put, delete) while keeping the emitted spans (names & attributes) the same to minimize disruption. This is more verbose, but more explicit and much easier to extend.

Follow up PRs would focus on extending each of these spans with more attributes, detailed here: https://wiki.cfdata.org/display/WOBS/June+2025%3A+Next+steps+for+Runtime+Instrumentation

* Add back empty switch case for exhaustiveness checks

Files changed

5 files changed~5 modified