Skip to content

Commit db287cb

Browse files
committed
fix(kafka): enforced string format for Kafka trace headers and dropped binary support (#1296)
BREAKING CHANGE: - Removed the ability to configure the header format; headers will always be sent in 'string' format. - Removed support for 'binary' format and code related to sending headers in 'binary' or 'both' formats. refs INSTA-809
1 parent e93bf7f commit db287cb

File tree

16 files changed

+148
-531
lines changed

16 files changed

+148
-531
lines changed

packages/aws-fargate/test/using_api/test.js

+3-13
Original file line numberDiff line numberDiff line change
@@ -106,20 +106,10 @@ describe('Using the API', function () {
106106
return retry(async () => {
107107
expect(response).to.be.an('object');
108108
expect(response.message).to.equal('Hello Fargate!');
109-
110-
// During phase 1 of the Kafka header migration (October 2022 - October 2023) there will be a debug log about
111-
// ignoring the option 'both' for rdkafka. We do not care about that log message in this test.
112-
const debug = response.logs.debug.filter(msg => !msg.includes('Ignoring configuration or default value'));
113-
114-
// As part of the Kafka header migration phase 2, we have added warning logs regarding the removal of the option
115-
// to configure Kafka header formats. This test skips the warning message, and the warning itself will be removed
116-
// in the next major release.
117-
const warn = response.logs.warn.filter(msg => !msg.includes('Kafka header format'));
118-
expect(debug).to.contain('Sending data to Instana (/serverless/metrics).');
119-
expect(debug).to.contain('Sent data to Instana (/serverless/metrics).');
120-
109+
expect(response.logs.debug).to.contain('Sending data to Instana (/serverless/metrics).');
110+
expect(response.logs.debug).to.contain('Sent data to Instana (/serverless/metrics).');
121111
expect(response.logs.info).to.be.empty;
122-
expect(warn).to.deep.equal([
112+
expect(response.logs.warn).to.deep.equal([
123113
'INSTANA_DISABLE_CA_CHECK is set, which means that the server certificate will not be verified against the ' +
124114
'list of known CAs. This makes your service vulnerable to MITM attacks when connecting to Instana. This ' +
125115
'setting should never be used in production, unless you use our on-premises product and are unable to ' +

packages/collector/src/announceCycle/unannounced.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ const maxRetryDelay = 60 * 1000; // one minute
4949
/**
5050
* @typedef {Object} KafkaTracingConfig
5151
* @property {boolean} [trace-correlation]
52-
* @property {string} [header-format]
5352
*/
5453

5554
module.exports = {
@@ -192,11 +191,7 @@ function applyKafkaTracingConfiguration(agentResponse) {
192191
traceCorrelation:
193192
kafkaTracingConfigFromAgent['trace-correlation'] != null
194193
? kafkaTracingConfigFromAgent['trace-correlation']
195-
: tracingConstants.kafkaTraceCorrelationDefault,
196-
headerFormat:
197-
kafkaTracingConfigFromAgent['header-format'] != null
198-
? kafkaTracingConfigFromAgent['header-format']
199-
: tracingConstants.kafkaHeaderFormatDefault
194+
: tracingConstants.kafkaTraceCorrelationDefault
200195
};
201196
ensureNestedObjectExists(agentOpts.config, ['tracing', 'kafka']);
202197
agentOpts.config.tracing.kafka = kafkaTracingConfig;

packages/collector/test/announceCycle/unannounced_test.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,7 @@ describe('unannounced state', () => {
153153
expect(agentOptsStub.config).to.deep.equal({
154154
tracing: {
155155
kafka: {
156-
traceCorrelation: constants.kafkaTraceCorrelationDefault,
157-
headerFormat: constants.kafkaHeaderFormatDefault
156+
traceCorrelation: constants.kafkaTraceCorrelationDefault
158157
}
159158
}
160159
});
@@ -167,8 +166,7 @@ describe('unannounced state', () => {
167166
prepareAnnounceResponse({
168167
tracing: {
169168
kafka: {
170-
'trace-correlation': false,
171-
'header-format': 'string'
169+
'trace-correlation': false
172170
}
173171
}
174172
});
@@ -177,8 +175,7 @@ describe('unannounced state', () => {
177175
expect(agentOptsStub.config).to.deep.equal({
178176
tracing: {
179177
kafka: {
180-
traceCorrelation: false,
181-
headerFormat: 'string'
178+
traceCorrelation: false
182179
}
183180
}
184181
});

packages/collector/test/apps/agentStub.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ const enableSpanBatching = process.env.ENABLE_SPANBATCHING === 'true';
3838
const kafkaTraceCorrelation = process.env.KAFKA_TRACE_CORRELATION
3939
? process.env.KAFKA_TRACE_CORRELATION === 'true'
4040
: null;
41-
const kafkaHeaderFormat = process.env.KAFKA_HEADER_FORMAT;
4241

4342
let discoveries = {};
4443
let rejectAnnounceAttempts = 0;
@@ -87,21 +86,18 @@ app.put('/com.instana.plugin.nodejs.discovery', (req, res) => {
8786
}
8887
};
8988

90-
if (kafkaTraceCorrelation != null || kafkaHeaderFormat || extraHeaders.length > 0 || enableSpanBatching) {
89+
if (kafkaTraceCorrelation != null || extraHeaders.length > 0 || enableSpanBatching) {
9190
response.tracing = {};
9291

9392
if (extraHeaders.length > 0) {
9493
response.tracing['extra-http-headers'] = extraHeaders;
9594
}
9695

97-
if (kafkaTraceCorrelation != null || kafkaHeaderFormat) {
96+
if (kafkaTraceCorrelation != null) {
9897
response.tracing.kafka = {};
9998
if (kafkaTraceCorrelation != null) {
10099
response.tracing.kafka['trace-correlation'] = kafkaTraceCorrelation;
101100
}
102-
if (kafkaHeaderFormat) {
103-
response.tracing.kafka['header-format'] = kafkaHeaderFormat;
104-
}
105101
}
106102

107103
if (enableSpanBatching) {

packages/collector/test/apps/agentStubControls.js

-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ class AgentStubControls {
4242
if (opts.kafkaConfig.traceCorrelation != null) {
4343
env.KAFKA_TRACE_CORRELATION = opts.kafkaConfig.traceCorrelation.toString();
4444
}
45-
if (opts.kafkaConfig.headerFormat) {
46-
env.KAFKA_HEADER_FORMAT = opts.kafkaConfig.headerFormat;
47-
}
4845
}
4946

5047
this.agentStub = spawn('node', [path.join(__dirname, 'agentStub.js')], {

0 commit comments

Comments
 (0)