Skip to content

Commit e05bef9

Browse files
authored
fix: de-duplicate blob operation spans (#3279)
1 parent 14669ae commit e05bef9

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/run/storage/storage.cts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@ export const getMemoizedKeyValueStoreBackedByRegionalBlobStore = (
3838
? memoizedValue
3939
: {}
4040

41-
span?.setAttributes({ key, blobKey, previousEtag })
41+
span?.setAttributes({ key })
4242

4343
const result = await store.getWithMetadata(blobKey, {
4444
type: 'json',
4545
etag: previousEtag,
46+
span,
4647
})
4748

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

64-
span?.setAttributes({
65-
etag: result?.etag,
66-
reusingPreviouslyFetchedBlob: shouldReuseMemoizedBlob,
67-
status: blob ? (shouldReuseMemoizedBlob ? 'Hit, no change' : 'Hit') : 'Miss',
68-
})
69-
7065
return blob
7166
})
7267
inMemoryCache.set(key, getPromise)
@@ -79,8 +74,8 @@ export const getMemoizedKeyValueStoreBackedByRegionalBlobStore = (
7974

8075
const blobKey = await encodeBlobKey(key)
8176
return withActiveSpan(tracer, otelSpanTitle, async (span) => {
82-
span?.setAttributes({ key, blobKey })
83-
const writeResult = await store.setJSON(blobKey, value)
77+
span?.setAttributes({ key })
78+
const writeResult = await store.setJSON(blobKey, value, { span })
8479
if (writeResult?.etag) {
8580
inMemoryCache.set(key, {
8681
data: value,

0 commit comments

Comments
 (0)