New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@instana/core

Package Overview
Dependencies
Maintainers
6
Versions
269
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

to
2.0.0-rc.1

src/tracing/instrumentation/messaging/rdkafka.js

69

CHANGELOG.md

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

# [2.0.0-rc.0](https://github.com/instana/nodejs/compare/v1.138.0...v2.0.0-rc.0) (2022-03-08)
# [2.0.0-rc.1](https://github.com/instana/nodejs/compare/v1.140.1...v2.0.0-rc.1) (2022-04-04)
### chore
### Bug Fixes
* removed disableAutomaticTracing legacy config ([#432](https://github.com/instana/nodejs/issues/432)) ([c8f6cef](https://github.com/instana/nodejs/commit/c8f6cef241c8b9f1b06ff6fe6de70386d6086e6f))
* removed legacy support for config.timeBetweenHealthcheckCalls ([#476](https://github.com/instana/nodejs/issues/476)) ([4c4f894](https://github.com/instana/nodejs/commit/4c4f894f9308da8fe3503585a7feac8a108a75af))
* remove npm package instana-nodejs-sensor ([3bbf9cd](https://github.com/instana/nodejs/commit/3bbf9cdb6b1238e314f590601360460fd8101e55))
* removed disableAutomaticTracing legacy config ([#432](https://github.com/instana/nodejs/issues/432)) ([f8f6da4](https://github.com/instana/nodejs/commit/f8f6da4e90f94bbb6081a79ef95b45817ac51267))
* removed legacy support for config.timeBetweenHealthcheckCalls ([#476](https://github.com/instana/nodejs/issues/476)) ([2b70a11](https://github.com/instana/nodejs/commit/2b70a1192c243f16a1682b5e7162a44d8a9ca08b))
* self-disable if detected Node.js runtime version is too old ([fb61677](https://github.com/instana/nodejs/commit/fb6167797cb059fc7f14f69e4cbf2a9d1b709ce9))
### Code Refactoring
* remove npm package instana-nodejs-sensor ([bebfc2d](https://github.com/instana/nodejs/commit/bebfc2da9989ade98034e5a1ae87e0a0bd43a5d8))
### Features
* added asynclocalstorage implementation ([#430](https://github.com/instana/nodejs/issues/430)) ([fe86e3a](https://github.com/instana/nodejs/commit/fe86e3a32592a98de9cb869916435e45db07a1ea))
* self-disable if detected Node.js runtime version is too old ([d934d37](https://github.com/instana/nodejs/commit/d934d37e1f56ea5b877f39e699054c1e4b675dd1))
### BREAKING CHANGES

@@ -31,4 +22,2 @@

Use `instana({ metrics: { timeBetweenHealthcheckCalls: ...}})`.
Co-authored-by: kirrg001 <katharina.irrgang@gmail.com>
* Starting with version 2.0.0, consumers of the package who

@@ -38,8 +27,5 @@ still use the deprecated package name instana-nodejs-sensor will need to follow

to receive updates in the future.
refs 80206
* Removed "disableAutomaticTracing" config option.
Use `instana({ automaticTracingEnabled: Boolean })`.
Co-authored-by: kirrg001 <katharina.irrgang@gmail.com>

@@ -49,3 +35,46 @@

## [1.140.1](https://github.com/instana/nodejs/compare/v1.140.0...v1.140.1) (2022-04-04)
### Bug Fixes
* **metrics:** do not report metrics from worker threads ([#517](https://github.com/instana/nodejs/issues/517)) ([bdf7869](https://github.com/instana/nodejs/commit/bdf7869e08d039e5769131d958e1037dc1748cd1)), closes [#500](https://github.com/instana/nodejs/issues/500)
# [1.140.0](https://github.com/instana/nodejs/compare/v1.138.0...v1.140.0) (2022-03-24)
### Bug Fixes
* **collector:** fix export returned from init ([3cc709c](https://github.com/instana/nodejs/commit/3cc709cccb37ac9b0135a604e33f030a63b6cbda))
### Features
* **collector:** added instrumentation for @grpc/grpc-js ([d12e386](https://github.com/instana/nodejs/commit/d12e386e95ced2c68d2d549dff83ea3ecfe51735)), closes [#87653](https://github.com/instana/nodejs/issues/87653)
* **tracing:** added instrumentation for node-rdfafka/kafka-avro ([7cb7aa4](https://github.com/instana/nodejs/commit/7cb7aa4207e9807de3c826eeac5369bc39a16ffa))
# [1.139.0](https://github.com/instana/nodejs/compare/v1.138.0...v1.139.0) (2022-03-09)
### Bug Fixes
* **collector:** fix export returned from init ([3cc709c](https://github.com/instana/nodejs/commit/3cc709cccb37ac9b0135a604e33f030a63b6cbda))
### Features
* **tracing:** added instrumentation for node-rdfafka/kafka-avro ([7cb7aa4](https://github.com/instana/nodejs/commit/7cb7aa4207e9807de3c826eeac5369bc39a16ffa))
# [1.138.0](https://github.com/instana/nodejs/compare/v1.137.5...v1.138.0) (2022-02-08)

@@ -52,0 +81,0 @@

{
"name": "@instana/core",
"version": "2.0.0-rc.0",
"version": "2.0.0-rc.1",
"description": "Core library for Instana's Node.js packages",

@@ -15,5 +15,5 @@ "main": "src/index.js",

"audit": "npm audit --production",
"test": "NODE_ENV=debug USE_OPENTRACING_DEBUG_IMPL=true npm run test:mocha",
"test:mocha": "echo \"******* Files to be tested:\n $CI_CORE_TEST_FILES\" && mocha --sort --reporter mocha-multi --reporter-options spec=-,xunit=../../test-results/core/results.xml ${CI_CORE_TEST_FILES:=$(find test -iname '*test.js' -not -path '*node_modules*')}",
"test:debug": "WITH_STDOUT=true npm run test:mocha",
"test": "NODE_ENV=debug USE_OPENTRACING_DEBUG_IMPL=true mocha --sort $(find test -iname '*test.js' -not -path '*node_modules*')",
"test:debug": "WITH_STDOUT=true npm run test",
"test:ci": "echo \"******* Files to be tested:\n $CI_CORE_TEST_FILES\" && if [ -z \"${CI_CORE_TEST_FILES}\" ]; then echo \"No Files to test in this node\"; else mocha --reporter mocha-multi-reporters --reporter-options configFile=reporter-config.json --sort ${CI_CORE_TEST_FILES}; fi",
"lint": "eslint src test",

@@ -140,3 +140,3 @@ "verify": "npm run lint && npm test",

},
"gitHead": "040c7b2ab701f2a16ba25b12f684ff9ecc8023eb"
"gitHead": "bf069e63f0d8a5600b575bf1aa85ba72c8b53370"
}

@@ -36,11 +36,17 @@ /*

/**
* In order to increase node version support, this loads the version of context
* that is appropriate for the version of on nodejs that is running.
* Node 12.17 - 16.6 - uses native AsyncLocalStorage. See below:
* There is a bug introduced in Node 16.7 which breaks Async LS: https://github.com/nodejs/node/issues/40693
* Async LS fix introduced in v17.2: https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V17.md#commits-5
* Async LS fix introduced in v16.14: https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V16.md#commits
* Node >= v8 - uses native async-hooks
* In order to increase Node.js version support, this loads an implementation of a CLS (continuation local storage) API
* which is appropriate for the version of on Node.js that is running.
* - Node.js < 12.17: our vendored-in fork of cls-hooked (based on async_hooks)
* - Node.js 12.17 - 16.6: AsyncLocalStorage
* - Node.js 16.7 - 16.6: our vendored-in fork of cls-hooked (based on async_hooks) (see below for reasons)
* - Node.js >= 16.14: AsyncLocalStorage
*
* There is a bug introduced in Node 16.7 which breaks AsyncLocalStorage: https://github.com/nodejs/node/issues/40693
* - AsyncLocalStorage fix introduced in v17.2: https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V17.md#commits-5
* - AsyncLocalStorage fix introduced in v16.14: https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V16.md#commits
*/
if (process && semver.satisfies(process.versions.node, '12.17 - 16.6 || ^16.14 || >=17.2')) {
if (
process.env.INSTANA_FORCE_LEGACY_CLS !== 'true' &&
semver.satisfies(process.versions.node, '12.17 - 16.6 || ^16.14 || >=17.2')
) {
module.exports = require('./async_local_storage_context');

@@ -47,0 +53,0 @@ } else {

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

'./instrumentation/messaging/kafkaNode',
'./instrumentation/messaging/rdkafka',
'./instrumentation/messaging/nats',

@@ -82,2 +83,3 @@ './instrumentation/messaging/natsStreaming',

'./instrumentation/protocols/grpc',
'./instrumentation/protocols/grpcJs',
'./instrumentation/protocols/httpClient',

@@ -199,5 +201,7 @@ './instrumentation/protocols/httpServer',

const instrumentationName = /.\/instrumentation\/[^/]*\/(.*)/.exec(instrumentationKey)[1];
const isDisabled =
config.tracing.disabledTracers.findIndex(disabledKey => instrumentationName.toLowerCase() === disabledKey) !==
-1;
if (!isDisabled) {

@@ -204,0 +208,0 @@ instrumentationModules[instrumentationKey].activate();

@@ -36,10 +36,14 @@ /*

const originalLoggingFunction = originalGenLog.apply(this, arguments);
return function log(mergingObject, message) {
if (isActive && cls.isTracing()) {
const parentSpan = cls.getCurrentSpan();
if (parentSpan && !constants.isExitSpan(parentSpan)) {
const originalArgs = new Array(arguments.length);
for (let i = 0; i < arguments.length; i++) {
originalArgs[i] = arguments[i];
}
const ctx = this;

@@ -49,2 +53,3 @@ return cls.ns.runAndReturn(() => {

span.stack = tracingUtil.getStackTrace(log);
if (typeof mergingObject === 'string') {

@@ -76,8 +81,11 @@ // calls like logger.error('only a message')

}
span.data.log = {
message
};
if (level >= 50) {
span.ec = 1;
}
try {

@@ -84,0 +92,0 @@ return originalLoggingFunction.apply(ctx, originalArgs);

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

let patterns = [
/\/@apollo\/gateway\/dist\//,
/\/@elastic\/elasticsearch\/index.js/,

@@ -25,19 +26,27 @@ /\/@google-cloud\/pubsub\/build\/src\/publisher\/index.js/,

/\/amqplib\/lib\//,
/\/aws-sdk\/lib\/aws.js/,
/\/aws-sdk\/lib\//,
/\/@aws-sdk\/smithy-client\//,
// deliberately not including bunyan because we depend on bunyan ourselves
/\/cls-hooked\/context.js/,
/\/cls-hooked\/context-legacy.js/,
/\/cls-hooked\/index.js/,
/\/elasticsearch\/src\/elasticsearch.js/,
/\/express\/index.js/,
/\/fastify\/lib\//,
/\/fastify\/fastify/,
/\/graphql-subscriptions\/dist\//,
/\/graphql\/execution\//,
/\/grpc\/index.js/,
/\/grpc\/src\//,
/\/@grpc\/grpc-js\/build\/src\//,
/\/ioredis\/built\//,
/\/node-rdkafka\/lib\//,
/\/kafka-node\/lib\//,
/\/kafka-node\/kafka.js/,
/\/kafkajs\/index.js/,
/\/kafkajs\/src\//,
/\/koa-router\/lib\//,
/\/log4js\/lib\/log4js.js/,
/\/log4js\/lib\//,
/\/memored\/index.js/,
/\/mongodb\/index.js/,
/\/mongoose\/index.js/,
/\/mongodb\/lib\//,
/\/mongodb-core\/lib\//,
/\/sqs-consumer\/dist\//,
/\/mssql\/index.js/,

@@ -52,2 +61,3 @@ /\/mysql2\/index.js/,

/\/pino\/lib\//,
/\/bull\/index.js/,
/\/redis\/index.js/,

@@ -101,1 +111,6 @@ /\/superagent\/lib\/node\/index.js/,

};
module.exports.reset = () => {
hasBeenInitializedTooLate = false;
firstCall = true;
};