@instana/core
Advanced tools
Comparing version 3.18.0 to 3.18.1
@@ -6,2 +6,9 @@ # Change Log | ||
## [3.18.1](https://github.com/instana/nodejs/compare/v3.18.0...v3.18.1) (2024-09-12) | ||
### Bug Fixes | ||
- added deprecation warning for Kafka header migration ([#1311](https://github.com/instana/nodejs/issues/1311)) ([fa1e4bd](https://github.com/instana/nodejs/commit/fa1e4bd74df6937cb9e5091717b98bc2ff619736)) | ||
- **ioredis:** reverted multi/pipeline handling from [#1292](https://github.com/instana/nodejs/issues/1292) ([#1328](https://github.com/instana/nodejs/issues/1328)) ([09fc2f7](https://github.com/instana/nodejs/commit/09fc2f7112fecf709ccae9eb029da6ac89ee920d)) | ||
# [3.18.0](https://github.com/instana/nodejs/compare/v3.17.1...v3.18.0) (2024-09-06) | ||
@@ -8,0 +15,0 @@ |
{ | ||
"name": "@instana/core", | ||
"version": "3.18.0", | ||
"version": "3.18.1", | ||
"description": "Core library for Instana's Node.js packages", | ||
@@ -75,3 +75,3 @@ "main": "src/index.js", | ||
}, | ||
"gitHead": "283dd73f558fa563b36a9251749d7cdc0464447d" | ||
"gitHead": "47fd9aefb7b472da07934944af4e8bdfc1e55641" | ||
} |
@@ -79,15 +79,13 @@ /* | ||
// ".multi()" commands could actually be recorded as multiple spans, but we ONLY want to record ONE | ||
// batched span considering that a multi call represents a transaction. | ||
// The same is true for pipeline calls, but they have a slightly different semantic. | ||
// TODO: Why do we trace each sub command as separate spans (exec, hset, hget etc.)? | ||
// https://jsw.ibm.com/browse/INSTA-14540 | ||
// NOTE: there is separate "pipeline" call from "instrumentSendCommand" | ||
// only for "multi". Thats why we filter it out here. | ||
if ( | ||
parentSpan.n === exports.spanName && | ||
(parentSpan.data.redis.command === 'multi' || parentSpan.data.redis.command === 'pipeline') | ||
(parentSpan.data.redis.command === 'multi' || parentSpan.data.redis.command === 'pipeline') && | ||
command.name !== 'multi' | ||
) { | ||
// This is the initial .multi()/.pipeline() request. We do not want to record this as subCommand. | ||
if (command.name === 'multi' || command.name === 'pipeline') return original.apply(this, arguments); | ||
const parentSpanSubCommands = (parentSpan.data.redis.subCommands = parentSpan.data.redis.subCommands || []); | ||
parentSpanSubCommands.push(command.name); | ||
return original.apply(this, arguments); | ||
} else if (constants.isExitSpan(parentSpan)) { | ||
@@ -94,0 +92,0 @@ // Apart from the special case of multi/pipeline calls, redis exits can't be child spans of other exits. |
@@ -28,2 +28,3 @@ /* | ||
hook.onFileLoad(/\/kafkajs\/src\/consumer\/runner\.js/, instrumentConsumer); | ||
hook.onModuleLoad('kafkajs', logWarningForKafkaHeaderFormat); | ||
traceCorrelationEnabled = config.tracing.kafka.traceCorrelation; | ||
@@ -536,1 +537,11 @@ headerFormat = config.tracing.kafka.headerFormat; | ||
} | ||
// Note: This function can be removed as soon as we finish the Kafka header migration phase2. | ||
// Might happen in major release v4. | ||
function logWarningForKafkaHeaderFormat() { | ||
logger.warn( | ||
'[Deprecation Warning] The configuration option for specifying the Kafka header format will be removed in the ' + | ||
'next major release as the format will no longer be configurable and Instana tracers will only send string ' + | ||
'headers. More details see: https://ibm.biz/kafka-trace-correlation-header.' | ||
); | ||
} |
@@ -16,3 +16,2 @@ /* | ||
let traceCorrelationEnabled = constants.kafkaTraceCorrelationDefault; | ||
let configHeader = null; | ||
@@ -30,5 +29,5 @@ let logger; | ||
hook.onModuleLoad('node-rdkafka', instrumentConsumer); | ||
hook.onModuleLoad('node-rdkafka', logWarningForKafkaHeaderFormat); | ||
traceCorrelationEnabled = config.tracing.kafka.traceCorrelation; | ||
configHeader = config.tracing.kafka.headerFormat; | ||
}; | ||
@@ -38,7 +37,5 @@ | ||
traceCorrelationEnabled = config.tracing.kafka.traceCorrelation; | ||
configHeader = config.tracing.kafka.headerFormat; | ||
}; | ||
// The extraConfig is coming from the agent configs. You can set the kafka format in the agent. | ||
exports.activate = function activate(extraConfig) { | ||
let extraConfigHeader = null; | ||
if (extraConfig && extraConfig.tracing && extraConfig.tracing.kafka) { | ||
@@ -48,5 +45,4 @@ if (extraConfig.tracing.kafka.traceCorrelation != null) { | ||
} | ||
extraConfigHeader = extraConfig.tracing.kafka.headerFormat; | ||
} | ||
logWarningForKafkaHeaderFormat(extraConfigHeader || configHeader); | ||
isActive = true; | ||
@@ -59,33 +55,11 @@ }; | ||
// Note: This function can be removed as soon as we finish the Kafka header migration and remove the ability to | ||
// configure the header format (at that point, we will only be using string headers). | ||
function logWarningForKafkaHeaderFormat(headerFormat) { | ||
// node-rdkafka's handling of non-string header values is broken, see | ||
// https://github.com/Blizzard/node-rdkafka/pull/968. | ||
// | ||
// For this reason, the legacy binary header format for Instana Kafka trace correlation headers (X_INSTANA_C) will not | ||
// work with node-rdkafka. Fortunately, we are already in the process of migrating away from that binary header format | ||
// to a header format that is purely based on string values. | ||
// | ||
// Trace correlation would be broken for rdkafka senders with the header format 'binary'. If that format has been | ||
// configured explicitly, we log a warning and ignore the config value. The rdkafka instrumentation alwas acts as if | ||
// format 'string' had been configured. | ||
if (headerFormat === 'binary') { | ||
logger.warn( | ||
"Ignoring configuration value 'binary' for Kafka header format in node-rdkafka instrumentation, using header " + | ||
"format 'string' instead. Binary headers do not work with node-rdkafka, see " + | ||
'https://github.com/Blizzard/node-rdkafka/pull/968.' | ||
); | ||
} else if (headerFormat === 'both') { | ||
// The option format 'both' which is available for other tracers/instrumentations (sending both binary and string | ||
// headers also does not make sense for node-rdkafka headers, because sending binary headers along with string | ||
// headers will not have any benefit. Theoretically, we would also want to warn if 'both' has been configured | ||
// explicitly. But both is also the current default value and we cannot differentiate between an explicit | ||
// configuration and the default value here, so we do not log a warning for 'both', just a debug message. | ||
logger.debug( | ||
"Ignoring configuration or default value 'both' for Kafka header format in node-rdkafka instrumentation, using " + | ||
"header format 'string' instead. Binary headers do not work with node-rdkafka, see " + | ||
'https://github.com/Blizzard/node-rdkafka/pull/968.' | ||
); | ||
} | ||
// Note: This function can be removed as soon as we finish the Kafka header migration phase 2 and remove the ability to | ||
// configure the header format. Might happen in major release v4. | ||
function logWarningForKafkaHeaderFormat() { | ||
logger.warn( | ||
'[Deprecation Warning] The Kafka header format configuration will be removed in the next major release. ' + | ||
'Instana tracers will only support string headers, as binary headers are not compatible with node-rdkafka. ' + | ||
'For more information, see the GitHub issue: https://github.com/Blizzard/node-rdkafka/pull/968, and review our ' + | ||
'official documentation on Kafka header configuration: https://ibm.biz/kafka-trace-correlation-header.' | ||
); | ||
} | ||
@@ -92,0 +66,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
785089
20099