Skip to content

Commit

Permalink
Add initial user spans for cache, memory-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
fhanau committed Sep 29, 2024
1 parent 16e610d commit ca7a0b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/workerd/api/cache.c++
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,8 @@ jsg::Promise<bool> Cache::delete_(

kj::Own<kj::HttpClient> Cache::getHttpClient(
IoContext& context, kj::Maybe<kj::String> cfBlobJson, kj::ConstString operationName) {
auto span = context.makeTraceSpan(kj::mv(operationName));
auto span = context.makeTraceSpan(kj::ConstString(kj::str(operationName)));
auto limeSpan = context.makeLimeTraceSpan(kj::mv(operationName));

auto cacheClient = context.getCacheClient();
auto httpClient = cacheName
Expand Down
4 changes: 3 additions & 1 deletion src/workerd/api/memory-cache.c++
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ jsg::Promise<jsg::JsRef<jsg::JsValue>> MemoryCache::read(jsg::Lock& js,
}

auto readSpan = IoContext::current().makeTraceSpan("memory_cache_read"_kjc);
auto limeReadSpan = IoContext::current().makeLimeTraceSpan("memory_cache_read"_kjc);

KJ_IF_SOME(fallback, optionalFallback) {
KJ_SWITCH_ONEOF(cacheUse.getWithFallback(key.value)) {
Expand All @@ -382,7 +383,8 @@ jsg::Promise<jsg::JsRef<jsg::JsValue>> MemoryCache::read(jsg::Lock& js,
}
KJ_CASE_ONEOF(promise, kj::Promise<SharedMemoryCache::Use::GetWithFallbackOutcome>) {
return IoContext::current().awaitIo(js, kj::mv(promise),
[fallback = kj::mv(fallback), key = kj::str(key.value), span = kj::mv(readSpan)](
[fallback = kj::mv(fallback), key = kj::str(key.value), span = kj::mv(readSpan),
limeSpan = kj::mv(limeReadSpan)](
jsg::Lock& js, SharedMemoryCache::Use::GetWithFallbackOutcome cacheResult) mutable
-> jsg::Promise<jsg::JsRef<jsg::JsValue>> {
KJ_SWITCH_ONEOF(cacheResult) {
Expand Down

0 comments on commit ca7a0b8

Please sign in to comment.