diff --git a/.changeset/fluffy-wasps-laugh.md b/.changeset/fluffy-wasps-laugh.md new file mode 100644 index 0000000..df85345 --- /dev/null +++ b/.changeset/fluffy-wasps-laugh.md @@ -0,0 +1,5 @@ +--- +"@microlabs/otel-cf-workers": patch +--- + +Add back instrumentation of fetch in service bindings diff --git a/src/instrumentation/env.ts b/src/instrumentation/env.ts index 7a5a6b4..09c8e41 100644 --- a/src/instrumentation/env.ts +++ b/src/instrumentation/env.ts @@ -22,11 +22,6 @@ const isDurableObject = (item?: unknown): item is DurableObjectNamespace => { return !isJSRPC(item) && !!(item as DurableObjectNamespace)?.idFromName } -const isServiceBinding = (item?: unknown): item is Fetcher => { - const binding = item as Fetcher - return (!isJSRPC(item) && !!binding.connect) || !!binding.fetch || binding.queue || binding.scheduled -} - export const isVersionMetadata = (item?: unknown): item is WorkerVersionMetadata => { return ( !isJSRPC(item) && @@ -47,16 +42,13 @@ const instrumentEnv = (env: Record): Record => return item } if (isJSRPC(item)) { - // TODO instrument JSRPC and maybe remove serviceBinding? - return item + return instrumentServiceBinding(item, String(prop)) } else if (isKVNamespace(item)) { return instrumentKV(item, String(prop)) } else if (isQueue(item)) { return instrumentQueueSender(item, String(prop)) } else if (isDurableObject(item)) { return instrumentDOBinding(item, String(prop)) - } else if (isServiceBinding(item)) { - return instrumentServiceBinding(item, String(prop)) } else if (isVersionMetadata(item)) { // we do not need to log accesses to the metadata return item