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

chore: set useElasticTraceparentHeader's default value to false #3555

Merged
merged 10 commits into from
Aug 4, 2023
2 changes: 2 additions & 0 deletions CHANGELOG4.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
* Add a warning message when a duration config option is provided
without units. ({issues}2121[#2121])

* Change default value of `useElasticTraceparentHeader` config option to `false`.
david-luna marked this conversation as resolved.
Show resolved Hide resolved

[[release-notes-3.x]]
=== Node.js Agent version 3.x

Expand Down
2 changes: 1 addition & 1 deletion docs/configuration.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,7 @@ The captured request body (if any) is stored on the `span.db.statement` field. C
==== `useElasticTraceparentHeader`

david-luna marked this conversation as resolved.
Show resolved Hide resolved
* *Type:* Boolean
* *Default:* `true`
* *Default:* `false`
* *Env:* `ELASTIC_APM_USE_ELASTIC_TRACEPARENT_HEADER`

To enable {apm-guide-ref}/apm-distributed-tracing.html[distributed tracing], the agent
Expand Down
6 changes: 6 additions & 0 deletions docs/upgrade-to-v4.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ Support for `filterHttpHeaders` config option has been removed. Redaction of
HTTP headers and also request cookies is controlled by the existing config
option <<sanitize-field-names, `sanitizeFieldNames`>>.

===== `useElasticTraceparentHeader`

The default value of `useElasticTraceparentHeader` config option has changed
to `false` since the standard `traceparent` header is added in outgoing
HTTP requests. If you want the agent to continue sending `elastic-apm-traceparent`
HTTP header you can set to `true` via env var or start options.
david-luna marked this conversation as resolved.
Show resolved Hide resolved

[[v4-api-changes]]
==== API changes
Expand Down
2 changes: 1 addition & 1 deletion lib/config/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const DEFAULTS = {
transactionIgnoreUrls: [],
transactionMaxSpans: 500,
transactionSampleRate: 1.0,
useElasticTraceparentHeader: true,
useElasticTraceparentHeader: false,
usePathAsTransactionName: false,
verifyServerCert: true,
};
Expand Down
8 changes: 4 additions & 4 deletions test/instrumentation/modules/http/outgoing.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ test(

test(
'http: consider useElasticTraceparentHeader config option',
echoTest('http', { useElasticTraceparentHeader: false }, (port, cb) => {
echoTest('http', { useElasticTraceparentHeader: true }, (port, cb) => {
var options = { port };
return http.request(options, cb);
}),
Expand Down Expand Up @@ -364,13 +364,13 @@ function echoTest(type, opts, handler) {

var traceparent = req.getHeader('traceparent');
t.ok(traceparent, 'should have traceparent header');
if (opts && opts.useElasticTraceparentHeader === false) {
t.strictEqual(req.getHeader('elastic-apm-traceparent'), undefined);
} else {
if (opts && opts.useElasticTraceparentHeader) {
t.ok(
req.getHeader('elastic-apm-traceparent'),
'should have elastic-apm-traceparent header',
);
} else {
t.strictEqual(req.getHeader('elastic-apm-traceparent'), undefined);
}

var expected = TraceParent.fromString(trans._context.toString());
Expand Down
2 changes: 0 additions & 2 deletions test/instrumentation/modules/http2.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,6 @@ function assertPath(t, trans, secure, port, path, httpVersion) {
if (trans.context.request.headers.traceparent) {
expectedReqHeaders.traceparent = trans.context.request.headers.traceparent;
expectedReqHeaders.tracestate = trans.context.request.headers.tracestate;
expectedReqHeaders['elastic-apm-traceparent'] =
trentm marked this conversation as resolved.
Show resolved Hide resolved
trans.context.request.headers['elastic-apm-traceparent'];
}

// What is "expected" for transaction.context.request.socket.remote_address
Expand Down