diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index a7001f84fe..1d2a344d5c 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -31,6 +31,7 @@ Notes: [[release-notes-3.x]] === Node.js Agent version 3.x + ==== Unreleased [float] @@ -45,6 +46,10 @@ Notes: [float] ===== Bug fixes +* Ensure `metadata.service.agent.activation_method` is only sent for APM + server version 8.7.1 or later. APM server 8.7.0 included a bug where + receiving `activation_method` is harmful. ({issues}3230[#3230]) + [float] ===== Chores @@ -52,9 +57,6 @@ Notes: [[release-notes-3.43.0]] ==== 3.43.0 2023/03/02 -[float] -===== Breaking changes - [float] ===== Features @@ -72,7 +74,7 @@ Notes: * Make `Agent.flush()` return a `Promise` if no callback is passed as param. This means that flush is now `await`able: `await apm.flush()`. - ({issues}2857(#2857)) + ({issues}2857[#2857]) [float] ===== Bug fixes diff --git a/lib/instrumentation/azure-functions.js b/lib/instrumentation/azure-functions.js index 61cd681de5..39cd53ef99 100644 --- a/lib/instrumentation/azure-functions.js +++ b/lib/instrumentation/azure-functions.js @@ -252,7 +252,7 @@ function getAzureFunctionsExtraMetadata () { // Passing this service.framework.name to Client#setExtraMetadata() // ensures that it "wins" over a framework name from // `agent.setFramework()`, because in the client `_extraMetadata` - // wins over `_conf.metadata`. + // wins over `_conf.frameworkName`. name: 'Azure Functions', version: process.env.FUNCTIONS_EXTENSION_VERSION }, diff --git a/lib/lambda.js b/lib/lambda.js index eb399edc4b..698dcca5b2 100644 --- a/lib/lambda.js +++ b/lib/lambda.js @@ -58,7 +58,7 @@ function getMetadata (agent, cloudAccountId) { // Passing this service.framework.name to Client#setExtraMetadata() // ensures that it "wins" over a framework name from // `agent.setFramework()`, because in the client `_extraMetadata` - // wins over `_conf.metadata`. + // wins over `_conf.frameworkName`. name: 'AWS Lambda' }, runtime: { diff --git a/package-lock.json b/package-lock.json index a607ea3c44..cffd2983a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "cookie": "^0.5.0", "core-util-is": "^1.0.2", "debug": "^4.1.1", - "elastic-apm-http-client": "11.2.0", + "elastic-apm-http-client": "11.3.1", "end-of-stream": "^1.4.4", "error-callsites": "^2.0.4", "error-stack-parser": "^2.0.6", @@ -6189,9 +6189,9 @@ "dev": true }, "node_modules/elastic-apm-http-client": { - "version": "11.2.0", - "resolved": "https://registry.npmjs.org/elastic-apm-http-client/-/elastic-apm-http-client-11.2.0.tgz", - "integrity": "sha512-XHXK+gQmd34eRN/ffrml7AN4h1VwujB79WEO2C/J59ufvEk+mT1OGBhl6pntHPUWn4Um52C5m84O6jIXzaQwfw==", + "version": "11.3.1", + "resolved": "https://registry.npmjs.org/elastic-apm-http-client/-/elastic-apm-http-client-11.3.1.tgz", + "integrity": "sha512-AicMDPJYmO4tGTRcZQZFS7nhyGAQ6f4hUTKQVxiM/6mHo6F895JsJoPVwOE2yCathKDnD9LVS9zWdT2wvG8gxA==", "dependencies": { "agentkeepalive": "^4.2.1", "breadth-filter": "^2.0.0", @@ -20251,9 +20251,9 @@ "dev": true }, "elastic-apm-http-client": { - "version": "11.2.0", - "resolved": "https://registry.npmjs.org/elastic-apm-http-client/-/elastic-apm-http-client-11.2.0.tgz", - "integrity": "sha512-XHXK+gQmd34eRN/ffrml7AN4h1VwujB79WEO2C/J59ufvEk+mT1OGBhl6pntHPUWn4Um52C5m84O6jIXzaQwfw==", + "version": "11.3.1", + "resolved": "https://registry.npmjs.org/elastic-apm-http-client/-/elastic-apm-http-client-11.3.1.tgz", + "integrity": "sha512-AicMDPJYmO4tGTRcZQZFS7nhyGAQ6f4hUTKQVxiM/6mHo6F895JsJoPVwOE2yCathKDnD9LVS9zWdT2wvG8gxA==", "requires": { "agentkeepalive": "^4.2.1", "breadth-filter": "^2.0.0", diff --git a/package.json b/package.json index 6f35013df9..8fa475f098 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "lint:yaml-files": "./dev-utils/lint-yaml-files.sh # requires node >=10", "coverage": "COVERAGE=true ./test/script/run_tests.sh", "test": "./test/script/run_tests.sh", - "test:deps": "dependency-check index.js start.js start-next.js 'lib/**/*.js' 'test/**/*.js' '!test/activation-method/fixtures' '!test/instrumentation/modules/next/a-nextjs-app' --no-dev -i async_hooks -i perf_hooks -i node:http -i @azure/functions-core", + "test:deps": "dependency-check index.js start.js start-next.js 'lib/**/*.js' 'test/**/*.js' '!test/activation-method/fixtures' '!test/instrumentation/azure-functions/fixtures' '!test/instrumentation/modules/next/a-nextjs-app' --no-dev -i async_hooks -i perf_hooks -i node:http -i @azure/functions-core", "test:tav": "tav --quiet && (cd test/instrumentation/modules/next/a-nextjs-app && tav --quiet)", "test:docs": "./test/script/docker/run_docs.sh", "test:types": "tsc --project test/types/tsconfig.json && tsc --project test/types/transpile/tsconfig.json && node test/types/transpile/index.js && tsc --project test/types/transpile-default/tsconfig.json && node test/types/transpile-default/index.js # requires node >=12.20", @@ -95,7 +95,7 @@ "cookie": "^0.5.0", "core-util-is": "^1.0.2", "debug": "^4.1.1", - "elastic-apm-http-client": "11.2.0", + "elastic-apm-http-client": "11.3.1", "end-of-stream": "^1.4.4", "error-callsites": "^2.0.4", "error-stack-parser": "^2.0.6", diff --git a/test/_capturing_transport.js b/test/_capturing_transport.js index 1625a23eef..a731152cf2 100644 --- a/test/_capturing_transport.js +++ b/test/_capturing_transport.js @@ -98,6 +98,10 @@ class CapturingTransport { return true } + supportsActivationMethodField () { + return true + } + // Inherited from Writable, called in agent.js. destroy () {} } diff --git a/test/_mock_http_client.js b/test/_mock_http_client.js index 4ad07d3c22..74ccea3a1d 100644 --- a/test/_mock_http_client.js +++ b/test/_mock_http_client.js @@ -69,6 +69,9 @@ module.exports = function (expected, done) { }, supportsKeepingUnsampledTransaction () { return true + }, + supportsActivationMethodField () { + return true } } diff --git a/test/_mock_http_client_states.js b/test/_mock_http_client_states.js index df781b7e6e..952ccef894 100644 --- a/test/_mock_http_client_states.js +++ b/test/_mock_http_client_states.js @@ -50,6 +50,9 @@ module.exports = function (expectations = [], done) { }, supportsKeepingUnsampledTransaction () { return true + }, + supportsActivationMethodField () { + return true } } } diff --git a/test/activation-method/activation-method.test.js b/test/activation-method/activation-method.test.js index 9175020280..675cbf627a 100644 --- a/test/activation-method/activation-method.test.js +++ b/test/activation-method/activation-method.test.js @@ -107,7 +107,7 @@ tape.test('metadata.system.agent.activation_method fixtures', function (suite) { const envStr = c.env ? Object.keys(c.env).map(k => `${k}="${c.env[k]}"`).join(' ') : '' suite.test(`${envStr} node ${(c.nodeOpts || []).join(' ')} ${c.script}`, t => { - const server = new MockAPMServer() + const server = new MockAPMServer({ apmServerVersion: '8.7.1' }) const args = c.nodeOpts || [] args.push(c.script) server.start(function (serverUrl) { diff --git a/test/agent.test.js b/test/agent.test.js index 148f5760f0..95f3d6560a 100644 --- a/test/agent.test.js +++ b/test/agent.test.js @@ -34,7 +34,10 @@ const agentOpts = { metricsInterval: '0s', cloudProvider: 'none', spanStackTraceMinDuration: 0, // Always have span stacktraces. - logLevel: 'warn' + logLevel: 'warn', + // Ensure the APM client's `GET /` requests do not get in the way of test + // asserts. Also ensure it is new enough to include 'activation_method'. + apmServerVersion: '8.7.1' } const agentOptsNoopTransport = Object.assign( {}, @@ -574,12 +577,7 @@ test('filters', function (t) { filterAgentOpts = Object.assign( {}, agentOpts, - { - serverUrl, - // Ensure the APM client's `GET /` requests do not get in the way of - // the test asserts below. - apmServerVersion: '8.0.0' - } + { serverUrl } ) t.end() }) diff --git a/test/config.test.js b/test/config.test.js index cc46049bdc..3e47bbecc2 100644 --- a/test/config.test.js +++ b/test/config.test.js @@ -1129,6 +1129,10 @@ test('custom transport', function (t) { supportsKeepingUnsampledTransaction () { return true } + + supportsActivationMethodField () { + return true + } } const myTransport = new MyTransport() diff --git a/test/outcome.test.js b/test/outcome.test.js index 9e448ea032..b3a84fb768 100644 --- a/test/outcome.test.js +++ b/test/outcome.test.js @@ -20,7 +20,8 @@ const noOpClient = { sendError () {}, sendMetricSet () {}, flush () {}, - supportsKeepingUnsampledTransaction () { return true } + supportsKeepingUnsampledTransaction () { return true }, + supportsActivationMethodField () { return true } } agent._transport = noOpClient diff --git a/test/test.js b/test/test.js index 2eece3f5ac..c97c31574b 100644 --- a/test/test.js +++ b/test/test.js @@ -179,7 +179,13 @@ if (opts.help) { // './test/start/env', './test/start/file' which are special // cases var directories = getDirectoriesWithTests( - './test', [], ['./test/start/env', './test/start/file'] + './test', + [], + [ + './test/start/env', + './test/start/file', + './test/activation-method/fixtures' + ] ) mapSeries(directories, readdir, function (err, directoryFiles) {