evanderkoogh / otel-cf-workers

An OpenTelemetry compatible library for instrumenting and exporting traces for Cloudflare Workers
BSD 3-Clause "New" or "Revised" License
210 stars 40 forks source link

KV instrumentation improvements #37

Closed DaniFoldi closed 3 months ago

DaniFoldi commented 11 months ago

Hi :wave:,

I've noticed some small inconsistencies with the KV instrumentation; all but get and getWithMetadata contain a kv. prefix for all attributes, and they are missing here: https://github.com/evanderkoogh/otel-cf-workers/blob/18fd741142bab45178ac6f9032d8a6b646a03597/src/instrumentation/kv.ts#L12-L29

Additionally, list and getWithMetadata now return a cache status (WIP docs: https://maddy-make-kv-product-tile.cloudflare-docs-7ou.pages.dev/kv/platform/observability/, types: https://workers-types.pages.dev/#KVNamespaceListResult.cacheStatus ). It could be nice to replace all calls to get with getWithMetadata, return only the value of get was requested, but keep the cache attribute for telemetry.