feat(WO-1143): determine SpanOpen's SpanKind, serialize to JS#6477
feat(WO-1143): determine SpanOpen's SpanKind, serialize to JS#6477repository wants to merge 4 commits intolngo/spankind-1from
Conversation
There was a problem hiding this comment.
I'm Bonk, and I've done a quick review of your PR.
This PR adds SpanKind to user tracing spans across KV, Cache, R2, DO storage, Queues, Memory Cache, and Fetch instrumentation sites, then serializes it to the spanOpen JS event. The changes look well-structured and consistent.
One issue found:
-
[MEDIUM] User-created spans via
TracingModule::startSpandefault toCLIENTinstead ofINTERNAL—src/workerd/api/tracing-module.c++:32callsmakeUserTraceSpanwithout specifyingSpanKind, so it inherits the new defaultCLIENT. Per the OpenTelemetry spec, manually-created spans should default toINTERNAL. A user callingtracing.startSpan("my-operation")would getspanKind: "client"which incorrectly implies an outbound network call.Suggested fix in
src/workerd/api/tracing-module.c++line 32:TraceContext traceContext = ioContext.makeUserTraceSpan(kj::ConstString(kj::mv(name)), SpanKind::INTERNAL);
This review was written by an AI assistant and may contain inaccuracies.
|
Review posted successfully. Here's a summary: I'm Bonk, and I've done a quick review of PR #6477. Summary: This PR adds One issue found:
|
This adds the ability to set
SpanKindon user tracing spans toTraceContext::makeUserTraceSpan. Then at various trace instrumentation site, we set it to the appropriate value depending on the operation.If not otherwise specified, user spans created via
TraceContext::makeUserTraceSpanwill default toSpanKind::CLIENT, as most bindings are implemented as calls to external services.Please also see:
#6471
kv_getkv_getWithMetadatakv_listkv_putkv_deletecache_matchcache_putcache_deleter2_headr2_getr2_putr2_deleter2_listr2_createMultipartUploadr2_uploadPartr2_completeMultipartUploadr2_abortMultipartUploadr2_create_bucketr2_list_bucketsr2_delete_bucketdurable_object_storage_getdurable_object_storage_getAlarmdurable_object_storage_listdurable_object_storage_putdurable_object_storage_deletedurable_object_storage_deleteAlarmdurable_object_storage_deleteAlldurable_object_storage_setAlarmdurable_object_storage_transactiondurable_object_storage_syncdurable_object_storage_getCurrentBookmarkdurable_object_storage_waitForBookmarkdurable_object_storage_execdurable_object_storage_ingestdurable_object_storage_getDatabaseSizedurable_object_storage_kv_getdurable_object_storage_kv_listdurable_object_storage_kv_putdurable_object_storage_kv_deletequeue_sendqueue_send(sendWithResponse)queue_send(sendBatch)queue_send(sendBatchWithResponse)memory_cache_read