Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
blumamir committed Apr 11, 2024
1 parent 069e709 commit 797f390
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 60 deletions.
110 changes: 54 additions & 56 deletions plugins/node/instrumentation-socket.io/src/socket.io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,37 +102,36 @@ export class SocketIoInstrumentation extends InstrumentationBase {
}
);

const broadcastOperatorInstrumentation =
new InstrumentationNodeModuleFile(
'socket.io/dist/broadcast-operator.js',
['>=4 <5'],
(moduleExports, moduleVersion) => {
if (moduleExports === undefined || moduleExports === null) {
return moduleExports;
}
if (moduleVersion === undefined) {
return moduleExports;
}
this._diag.debug(
`applying patch to socket.io@${moduleVersion} StrictEventEmitter`
);
if (isWrapped(moduleExports?.BroadcastOperator?.prototype?.emit)) {
this._unwrap(moduleExports.BroadcastOperator.prototype, 'emit');
}
this._wrap(
moduleExports.BroadcastOperator.prototype,
'emit',
this._patchEmit(moduleVersion)
);
const broadcastOperatorInstrumentation = new InstrumentationNodeModuleFile(
'socket.io/dist/broadcast-operator.js',
['>=4 <5'],
(moduleExports, moduleVersion) => {
if (moduleExports === undefined || moduleExports === null) {
return moduleExports;
},
moduleExports => {
if (isWrapped(moduleExports?.BroadcastOperator?.prototype?.emit)) {
this._unwrap(moduleExports.BroadcastOperator.prototype, 'emit');
}
}
if (moduleVersion === undefined) {
return moduleExports;
}
);
this._diag.debug(
`applying patch to socket.io@${moduleVersion} StrictEventEmitter`
);
if (isWrapped(moduleExports?.BroadcastOperator?.prototype?.emit)) {
this._unwrap(moduleExports.BroadcastOperator.prototype, 'emit');
}
this._wrap(
moduleExports.BroadcastOperator.prototype,
'emit',
this._patchEmit(moduleVersion)
);
return moduleExports;
},
moduleExports => {
if (isWrapped(moduleExports?.BroadcastOperator?.prototype?.emit)) {
this._unwrap(moduleExports.BroadcastOperator.prototype, 'emit');
}
return moduleExports;
}
);
const namespaceInstrumentation = new InstrumentationNodeModuleFile(
'socket.io/dist/namespace.js',
['<4'],
Expand Down Expand Up @@ -197,36 +196,35 @@ export class SocketIoInstrumentation extends InstrumentationBase {
return moduleExports;
}
);
const namespaceInstrumentationLegacy =
new InstrumentationNodeModuleFile(
'socket.io/lib/namespace.js',
['2'],
(moduleExports, moduleVersion) => {
if (moduleExports === undefined || moduleExports === null) {
return moduleExports;
}
if (moduleVersion === undefined) {
return moduleExports;
}
this._diag.debug(
`applying patch to socket.io@${moduleVersion} Namespace`
);
if (isWrapped(moduleExports?.prototype?.emit)) {
this._unwrap(moduleExports.prototype, 'emit');
}
this._wrap(
moduleExports.prototype,
'emit',
this._patchEmit(moduleVersion)
);
const namespaceInstrumentationLegacy = new InstrumentationNodeModuleFile(
'socket.io/lib/namespace.js',
['2'],
(moduleExports, moduleVersion) => {
if (moduleExports === undefined || moduleExports === null) {
return moduleExports;
}
if (moduleVersion === undefined) {
return moduleExports;
},
moduleExports => {
if (isWrapped(moduleExports?.prototype?.emit)) {
this._unwrap(moduleExports.prototype, 'emit');
}
}
);
this._diag.debug(
`applying patch to socket.io@${moduleVersion} Namespace`
);
if (isWrapped(moduleExports?.prototype?.emit)) {
this._unwrap(moduleExports.prototype, 'emit');
}
this._wrap(
moduleExports.prototype,
'emit',
this._patchEmit(moduleVersion)
);
return moduleExports;
},
moduleExports => {
if (isWrapped(moduleExports?.prototype?.emit)) {
this._unwrap(moduleExports.prototype, 'emit');
}
}
);

return [
new InstrumentationNodeModuleDefinition(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,13 @@ export class AwsInstrumentation extends InstrumentationBase {
// as for aws-sdk v3.13.1, constructStack is exported from @aws-sdk/middleware-stack as
// getter instead of function, which fails shimmer.
// so we are patching the MiddlewareStack.js file directly to get around it.
const v3MiddlewareStack = new InstrumentationNodeModuleDefinition('@aws-sdk/middleware-stack', ['^3.1.0'], undefined, undefined, [
v3MiddlewareStackFileOldVersions,
v3MiddlewareStackFileNewVersions,
]);
const v3MiddlewareStack = new InstrumentationNodeModuleDefinition(
'@aws-sdk/middleware-stack',
['^3.1.0'],
undefined,
undefined,
[v3MiddlewareStackFileOldVersions, v3MiddlewareStackFileNewVersions]
);

// Patch for @smithy/middleware-stack for @aws-sdk/* packages v3.363.0+.
// As of @smithy/middleware-stack@2.1.0 `constructStack` is only available
Expand Down

0 comments on commit 797f390

Please sign in to comment.