Skip to content
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
7 changes: 7 additions & 0 deletions CHANGELOG4.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@
* 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`.
This means that for outgoing HTTP requests, the APM agent will no longer add the
`elastic-apm-traceparent` header. This vendor-specific header was used in the past
while the https://w3c.github.io/trace-context/[W3C trace-context] spec was still
in development. Now that it is in wide use, the `elastic-apm-traceparent` header is
only useful for interaction with very old Elastic APM agents.

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

Expand Down
4 changes: 3 additions & 1 deletion docs/configuration.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -1422,8 +1422,10 @@ The captured request body (if any) is stored on the `span.db.statement` field. C
[[use-elastic-traceparent-header]]
==== `useElasticTraceparentHeader`

[small]#Change default in v4.0.0, in v3.x the default was `true`#

* *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
12 changes: 12 additions & 0 deletions docs/upgrade-to-v4.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The following is a guide on upgrading your APM Node.js agent

Version 4.0.0 of the Node.js APM agent supports Node.js v14.5.0 and later.


[[v4-config-options]]
==== Config options

Expand All @@ -34,6 +35,17 @@ 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 the <<use-elastic-traceparent-header>> config option has
changed to `false`. This means that the vendor-specific
`elastic-apm-traceparent` header will no longer be added to outgoing HTTP
requests. The `traceparent` header (from the
https://w3c.github.io/trace-context/[W3C trace-context standard]) is added by
the APM agent. If you want the agent to continue sending
`elastic-apm-traceparent` HTTP header you can set it to `true` via env var or
start options.


[[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'] =
trans.context.request.headers['elastic-apm-traceparent'];
}

// What is "expected" for transaction.context.request.socket.remote_address
Expand Down
4 changes: 0 additions & 4 deletions test/opentelemetry-bridge/fixtures.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,6 @@ const cases = [
trans.context.request.headers.traceparent,
'incoming http "traceparent" header',
);
t.ok(
trans.context.request.headers['elastic-apm-traceparent'],
'incoming http "elastic-apm-traceparent" header',
);
t.ok(
(trans.context.request.headers.tracestate || '').indexOf('es=s:1') !==
-1,
Expand Down
8 changes: 4 additions & 4 deletions test/tracecontext/tracecontext.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ tape.test('propagateTraceContextHeaders tests', function (suite) {
span.end();
transaction.end();

t.equals(span._context.traceparent.toString(), newHeaders.traceparent);
t.equals(traceStateString, newHeaders.tracestate);
t.equals(
span._context.traceparent.toString(),
newHeaders['elastic-apm-traceparent'],
newHeaders.traceparent,
'traceparent',
);
t.true(span._hasPropagatedTraceContext);
t.equals(traceStateString, newHeaders.tracestate, 'tracestate');
t.true(span._hasPropagatedTraceContext, '_hasPropagatedTraceContext');
t.end();
});

Expand Down