From 925bbe6ed57104cc5922a564f5de2fd7a2a439e8 Mon Sep 17 00:00:00 2001 From: Andrei Borza Date: Mon, 19 May 2025 11:27:32 +0200 Subject: [PATCH] chore(node): Remove unused `stealthWrap` and utils around it The utilities around wrapping are no longer in use since the switch to diagnostics channels in #16177. --- packages/node/src/integrations/http/utils.ts | 39 -------------------- 1 file changed, 39 deletions(-) delete mode 100644 packages/node/src/integrations/http/utils.ts diff --git a/packages/node/src/integrations/http/utils.ts b/packages/node/src/integrations/http/utils.ts deleted file mode 100644 index ddb803c8fc58..000000000000 --- a/packages/node/src/integrations/http/utils.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * This is a minimal version of `wrap` from shimmer: - * https://github.com/othiym23/shimmer/blob/master/index.js - * - * In contrast to the original implementation, this version does not allow to unwrap, - * and does not make it clear that the method is wrapped. - * This is necessary because we want to wrap the http module with our own code, - * while still allowing to use the HttpInstrumentation from OTEL. - * - * Without this, if we'd just use `wrap` from shimmer, the OTEL instrumentation would remove our wrapping, - * because it only allows any module to be wrapped a single time. - */ -export function stealthWrap( - nodule: Nodule, - name: FieldName, - wrapper: (original: Nodule[FieldName]) => Nodule[FieldName], -): Nodule[FieldName] { - const original = nodule[name]; - const wrapped = wrapper(original); - - defineProperty(nodule, name, wrapped); - return wrapped; -} - -// Sets a property on an object, preserving its enumerability. -function defineProperty( - obj: Nodule, - name: FieldName, - value: Nodule[FieldName], -): void { - const enumerable = !!obj[name] && Object.prototype.propertyIsEnumerable.call(obj, name); - - Object.defineProperty(obj, name, { - configurable: true, - enumerable: enumerable, - writable: true, - value: value, - }); -}