Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions src/run/storage/storage.cts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ export const getMemoizedKeyValueStoreBackedByRegionalBlobStore = (
? memoizedValue
: {}

span?.setAttributes({ key, blobKey, previousEtag })
span?.setAttributes({ key })

const result = await store.getWithMetadata(blobKey, {
type: 'json',
etag: previousEtag,
span,
})

const shouldReuseMemoizedBlob = result?.etag && previousEtag === result?.etag
Expand All @@ -61,12 +62,6 @@ export const getMemoizedKeyValueStoreBackedByRegionalBlobStore = (
inMemoryCache.set(key, blob)
}

span?.setAttributes({
etag: result?.etag,
reusingPreviouslyFetchedBlob: shouldReuseMemoizedBlob,
status: blob ? (shouldReuseMemoizedBlob ? 'Hit, no change' : 'Hit') : 'Miss',
})

return blob
})
inMemoryCache.set(key, getPromise)
Expand All @@ -79,8 +74,8 @@ export const getMemoizedKeyValueStoreBackedByRegionalBlobStore = (

const blobKey = await encodeBlobKey(key)
return withActiveSpan(tracer, otelSpanTitle, async (span) => {
span?.setAttributes({ key, blobKey })
const writeResult = await store.setJSON(blobKey, value)
span?.setAttributes({ key })
const writeResult = await store.setJSON(blobKey, value, { span })
if (writeResult?.etag) {
inMemoryCache.set(key, {
data: value,
Expand Down
Loading