Get KV read stats per Key

hello,

I would like to keep track of KV usage per key. is there a way to get the read/write/request stats per key?

I don’t want to add a counter to my worker, because it will result in a write on every read, which will defeat the purpose.

I found: https://api.cloudflare.com/#workers-kv-request-analytics-query-request-analytics but it seems to only give results per account.

Is there a way to get these stats when using the LIST command, for example?

thanks!

There’s no good way to do that today, I’m afraid.

Hey Steve, are there any plans to add more detailed KV stats?

Not in the immediate future, but if there’s demand, it might be something we’d be interested in investigating.

UPDATE: we went ahead and pushed a pageview to Google Analytics on every READ with the kv as ID. We now have a beautiful Dashboard :slight_smile:

GA even has a REST API to query these stats per id back into your application…

2 Likes

Keep in mind that you’ll likely get rate-limited if the writes keep coming from the same single IP.