Skip to content

Commit

Permalink
fix: dropped support for x-instana-service header (#1355)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: 
- Migration: Please configure the Instana agent to capture the X-Instana-Service header in the agent's configuration file. 
- For details, see: https://www.ibm.com/docs/en/instana-observability/current?topic=applications-services#specify-the-x-instana-service-http-header.
  • Loading branch information
aryamohanan committed Oct 23, 2024
1 parent 955cf67 commit 7aa5f4b
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 58 deletions.
23 changes: 0 additions & 23 deletions packages/collector/test/tracing/common/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,23 +168,6 @@ mochaSuiteFn('tracing/common', function () {
);
});

describe('with header when agent is configured to capture the header', function () {
const agentControls = new AgentStubControls();
const agentConfig = { extraHeaders: ['x-iNsTanA-sErViCe'] };

before(async () => {
await agentControls.startAgent(agentConfig);
});
after(async () => {
await agentControls.stopAgent();
});

registerServiceNameTest.call(this, agentControls, {
configMethod: 'X-Instana-Service header',
expectServiceNameOnSpans: 'on-entry-span'
});
});

describe('with header when agent is _not_ configured to capture the header', function () {
const agentControls = new AgentStubControls();

Expand All @@ -196,7 +179,6 @@ mochaSuiteFn('tracing/common', function () {
});

registerServiceNameTest.call(this, agentControls, {
configMethod: 'X-Instana-Service header',
expectServiceNameOnSpans: 'no'
});
});
Expand Down Expand Up @@ -236,11 +218,6 @@ mochaSuiteFn('tracing/common', function () {
const req = {
path: '/with-intermediate-and-exit-spans'
};
if (configMethod === 'X-Instana-Service header') {
req.headers = {
'x-InsTana-sErvice': 'much-custom-very-wow service'
};
}
return controls.sendRequest(req).then(() => verifyServiceName(agentControls, expectServiceNameOnSpans));
});
}
Expand Down
21 changes: 1 addition & 20 deletions packages/collector/test/tracing/protocols/http2/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ mochaSuiteFn('tracing/http2', function () {
extraHeaders: [
//
'X-My-Request-Header',
'X-My-Response-Header',
'x-iNsTanA-sErViCe'
'X-My-Response-Header'
],
secretsList: ['remove']
});
Expand Down Expand Up @@ -210,24 +209,6 @@ mochaSuiteFn('tracing/http2', function () {
)
));

it('must use x-service-service', () =>
serverControls
.sendRequest({
method: 'GET',
path: '/request',
headers: {
'x-instanA-SERVICE': 'Custom Service'
}
})
.then(() =>
retry(() =>
agentControls.getSpans().then(spans => {
const entry = verifyRootHttpEntry(spans, `localhost:${serverControls.getPort()}`, '/request');
expect(entry.data.service).to.equal('Custom Service');
})
)
));

describe('Server-Timing header', () => {
it('must expose trace id as Server-Timing header', () =>
serverControls
Expand Down
3 changes: 0 additions & 3 deletions packages/core/src/tracing/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ exports.w3cTraceState = 'tracestate';
exports.w3cInstana = 'in';
exports.w3cInstanaEquals = `${exports.w3cInstana}=`;

exports.serviceNameHeaderName = 'X-Instana-Service';
exports.serviceNameHeaderNameLowerCase = exports.serviceNameHeaderName.toLowerCase();

exports.ENTRY = 1;
exports.EXIT = 2;
exports.INTERMEDIATE = 3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,6 @@ function shimEmit(realEmit) {
header: getExtraHeadersFromNormalizedObjectLiteral(headers, extraHttpHeadersToCapture)
};

const incomingServiceName =
span.data.http.header && span.data.http.header[constants.serviceNameHeaderNameLowerCase];
if (incomingServiceName != null) {
span.data.service = incomingServiceName;
}

if (!headers['x-instana-t']) {
// In cases where we have started a fresh trace (that is, there is no X-INSTANA-T in the incoming request
// headers, we add the new trace ID to the incoming request so a customer's app can render it reliably into the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,6 @@ function shimEmit(realEmit) {
header: getExtraHeadersFromMessage(req, extraHttpHeadersToCapture)
};

const incomingServiceName =
span.data.http.header && span.data.http.header[constants.serviceNameHeaderNameLowerCase];
if (incomingServiceName != null) {
span.data.service = incomingServiceName;
}

if (!req.headers['x-instana-t']) {
// In cases where we have started a fresh trace (that is, there is no X-INSTANA-T in the incoming request
// headers, we add the new trace ID to the incoming request so a customer's app can render it reliably into the
Expand Down

0 comments on commit 7aa5f4b

Please sign in to comment.