Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@instana/core

Package Overview
Dependencies
Maintainers
0
Versions
256
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@instana/core - npm Package Compare versions

Comparing version 3.15.2 to 3.16.0

src/util/getPreloadFlags.js

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

# [3.16.0](https://github.com/instana/nodejs/compare/v3.15.2...v3.16.0) (2024-08-28)
### Bug Fixes
- exposed preload flags in debug mode ([#1268](https://github.com/instana/nodejs/issues/1268)) ([775df15](https://github.com/instana/nodejs/commit/775df15105d1599819d9413b8a329deeaedea892))
### Features
- added support for redis cluster ([#1270](https://github.com/instana/nodejs/issues/1270)) ([4d1dc72](https://github.com/instana/nodejs/commit/4d1dc726451d28ccbe3b94f7f12b0b74ba7b5660))
- added support for tedious v18 ([#1289](https://github.com/instana/nodejs/issues/1289)) ([e2990c1](https://github.com/instana/nodejs/commit/e2990c1c47ae94696e25d01d07f0fa5fe7ba7354))
## [3.15.2](https://github.com/instana/nodejs/compare/v3.15.1...v3.15.2) (2024-08-27)

@@ -8,0 +19,0 @@

6

package.json
{
"name": "@instana/core",
"version": "3.15.2",
"version": "3.16.0",
"description": "Core library for Instana's Node.js packages",

@@ -65,3 +65,3 @@ "main": "src/index.js",

"@opentelemetry/instrumentation-socket.io": "0.39.0",
"@opentelemetry/instrumentation-tedious": "0.11.0",
"@opentelemetry/instrumentation-tedious": "0.13.0",
"@opentelemetry/sdk-trace-base": "1.25.0",

@@ -76,3 +76,3 @@ "cls-bluebird": "^2.1.0",

},
"gitHead": "654046cc3111e0ee43d4d32dfb70b76478d0d99c"
"gitHead": "20eaf090e518008a6bba125919c8a9ce6b466c0c"
}

@@ -25,2 +25,3 @@ /*

const iitmHook = require('../util/iitmHook');
const { getPreloadFlags } = require('../util/getPreloadFlags');

@@ -184,2 +185,9 @@ let tracingEnabled = false;

exports.init = function init(_config, downstreamConnection, _processIdentityProvider) {
if (process.env.INSTANA_DEBUG || process.env.INSTANA_LOG_LEVEL === 'debug') {
const preloadFlags = getPreloadFlags();
// eslint-disable-next-line no-console
console.debug(`The App is using the following preload flags: ${preloadFlags}`);
}
// Consider removing this in the next major release(v4.x) of the @instana package.

@@ -186,0 +194,0 @@ if (hasExperimentalLoaderFlag()) {

@@ -31,3 +31,5 @@ /*

hook.onFileLoad(/\/@redis\/client\/dist\/lib\/cluster\/commands.js/, captureCommands);
hook.onModuleLoad('redis', instrument);
hook.onModuleLoad('@redis/client', instrument);
};

@@ -46,2 +48,71 @@

if (!redis.RedisClient) {
const wrapMulti = (addressUrl, isCluster) => {
return function innerWrapMulti(originalMultiFn) {
return function instrumentedMultiInstana() {
const result = originalMultiFn.apply(this, arguments);
const selfMadeQueue = [];
// batch
const wrapExecAsPipeline = execAsPipelineOriginalFn => {
return function instrumentedExecAsPipelineInstana() {
return instrumentMultiExec(
this,
arguments,
execAsPipelineOriginalFn,
addressUrl,
false,
false,
selfMadeQueue
);
};
};
// multi
const wrapExec = execOriginalFn => {
return function instrumentedExecAsPipelineInstana() {
return instrumentMultiExec(this, arguments, execOriginalFn, addressUrl, true, false, selfMadeQueue);
};
};
const wrapAddCommand = addCommandOriginalFn => {
return function instrumentedAddCommandInstana() {
if (isCluster) {
selfMadeQueue.push(arguments[1]);
} else {
selfMadeQueue.push(arguments[0]);
}
return addCommandOriginalFn.apply(this, arguments);
};
};
// NOTE: addCommand will fill our self made queue to know how many
// operations landed in this multi transaction. We are unable to access
// redis internal queue anymore.
shimmer.wrap(result, 'addCommand', wrapAddCommand);
shimmer.wrap(result, 'exec', wrapExec);
// `execAsPipeline` can be used to trigger batches in 4.x
shimmer.wrap(result, 'execAsPipeline', wrapExecAsPipeline);
return result;
};
};
};
const createClusterWrap = originalCreateClusterFn => {
return function instrumentedCreateClusterInstana(createClusterOpts) {
const redisCluster = originalCreateClusterFn.apply(this, arguments);
const addressUrl = createClusterOpts.rootNodes.map(node => node.url).join(', ');
shimAllCommands(redisCluster, addressUrl, false, redisCommandList);
if (redisCluster.multi) {
shimmer.wrap(redisCluster, 'multi', wrapMulti(addressUrl, true));
}
return redisCluster;
};
};
const createClientWrap = originalCreatedClientFn => {

@@ -73,50 +144,3 @@ return function instrumentedCreateClientInstana(createClientOpts) {

if (redisClient.multi) {
const wrapMulti = originalMultiFn => {
return function instrumentedMultiInstana() {
const result = originalMultiFn.apply(this, arguments);
const selfMadeQueue = [];
// batch
const wrapExecAsPipeline = execAsPipelineOriginalFn => {
return function instrumentedExecAsPipelineInstana() {
return instrumentMultiExec(
this,
arguments,
execAsPipelineOriginalFn,
addressUrl,
false,
false,
selfMadeQueue
);
};
};
// multi
const wrapExec = execOriginalFn => {
return function instrumentedExecAsPipelineInstana() {
return instrumentMultiExec(this, arguments, execOriginalFn, addressUrl, true, false, selfMadeQueue);
};
};
const wrapAddCommand = addCommandOriginalFn => {
return function instrumentedAddCommandInstana() {
selfMadeQueue.push(arguments[0]);
return addCommandOriginalFn.apply(this, arguments);
};
};
// NOTE: addCommand will fill our self made queue to know how many
// operations landed in this multi transaction. We are unable to access
// redis internal queue anymore.
shimmer.wrap(result, 'addCommand', wrapAddCommand);
shimmer.wrap(result, 'exec', wrapExec);
// `execAsPipeline` can be used to trigger batches in 4.x
shimmer.wrap(result, 'execAsPipeline', wrapExecAsPipeline);
return result;
};
};
shimmer.wrap(redisClient, 'multi', wrapMulti);
shimmer.wrap(redisClient, 'multi', wrapMulti(addressUrl, false));
}

@@ -128,2 +152,3 @@

shimmer.wrap(redis, 'createCluster', createClusterWrap);
shimmer.wrap(redis, 'createClient', createClientWrap);

@@ -130,0 +155,0 @@ } else {

@@ -32,2 +32,3 @@ /*

/\/@redis\/client\/dist\/lib\/cluster\/commands.js/,
/\/@redis\/client\/dist\/index.js/,
/\/amqplib\/lib\//,

@@ -34,0 +35,0 @@ /\/aws-sdk\/lib\//,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc