Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: deprecated kafka-avro #1337

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion currencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@
"isBeta": false,
"ignoreUpdates": false,
"note": "",
"deprecated": false,
"deprecated": true,
"core": false
},
{
Expand Down
14 changes: 13 additions & 1 deletion packages/core/src/tracing/instrumentation/messaging/rdkafka.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ 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) {
hook.onFileLoad(/\/node-rdkafka\/lib\/producer\.js/, instrumentProducer);
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;
};

Expand Down Expand Up @@ -359,3 +364,10 @@ function findInstanaHeaderValues(instanaHeadersAsObject) {

return { level, traceId, longTraceId, parentSpanId };
}

function logDeprecationKafkaAvroMessage() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion for function name logKafkaAvroDeprecationWarning

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha yeah you are right, but I am too lazy to change it now :D

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'
);
}