From c96441957694bcb4f4369ce5af11581a301e1649 Mon Sep 17 00:00:00 2001 From: gurke Date: Mon, 23 Sep 2024 09:24:17 +0200 Subject: [PATCH] fix: deprecated kafka-avro (#1337) refs https://jsw.ibm.com/browse/INSTA-1042 refs https://github.com/waldophotos/kafka-avro/issues/120 --- currencies.json | 2 +- .../tracing/instrumentation/messaging/rdkafka.js | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/currencies.json b/currencies.json index c20c8b8c88..ccdcd6864a 100644 --- a/currencies.json +++ b/currencies.json @@ -764,7 +764,7 @@ "isBeta": false, "ignoreUpdates": false, "note": "", - "deprecated": false, + "deprecated": true, "core": false }, { diff --git a/packages/core/src/tracing/instrumentation/messaging/rdkafka.js b/packages/core/src/tracing/instrumentation/messaging/rdkafka.js index 88bcd4e1ad..0f47454b5e 100644 --- a/packages/core/src/tracing/instrumentation/messaging/rdkafka.js +++ b/packages/core/src/tracing/instrumentation/messaging/rdkafka.js @@ -12,8 +12,12 @@ const constants = require('../../constants'); const cls = require('../../cls'); const shimmer = require('../../shimmer'); const { getFunctionArguments } = require('../../../util/function_arguments'); -let traceCorrelationEnabled = constants.kafkaTraceCorrelationDefault; +let logger; +logger = require('../../../logger').getLogger('tracing/rdkafka', newLogger => { + logger = newLogger; +}); +let traceCorrelationEnabled = constants.kafkaTraceCorrelationDefault; let isActive = false; exports.init = function init(config) { @@ -21,6 +25,7 @@ exports.init = function init(config) { hook.onFileLoad(/\/node-rdkafka\/lib\/kafka-consumer-stream\.js/, instrumentConsumerAsStream); hook.onModuleLoad('node-rdkafka', instrumentConsumer); + hook.onModuleLoad('kafka-avro', logDeprecationKafkaAvroMessage); traceCorrelationEnabled = config.tracing.kafka.traceCorrelation; }; @@ -359,3 +364,10 @@ function findInstanaHeaderValues(instanaHeadersAsObject) { return { level, traceId, longTraceId, parentSpanId }; } + +function logDeprecationKafkaAvroMessage() { + logger.warn( + // eslint-disable-next-line max-len + '[Deprecation Warning] The support for kafka-avro library is deprecated and might be removed in the next major release. See https://github.com/waldophotos/kafka-avro/issues/120' + ); +}