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
10 changes: 6 additions & 4 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Notes:
[[release-notes-3.x]]
=== Node.js Agent version 3.x


==== Unreleased

[float]
Expand All @@ -45,16 +46,17 @@ 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


[[release-notes-3.43.0]]
==== 3.43.0 2023/03/02

[float]
===== Breaking changes

[float]
===== Features

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/instrumentation/azure-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down
2 changes: 1 addition & 1 deletion lib/lambda.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 4 additions & 0 deletions test/_capturing_transport.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ class CapturingTransport {
return true
}

supportsActivationMethodField () {
return true
}

// Inherited from Writable, called in agent.js.
destroy () {}
}
Expand Down
3 changes: 3 additions & 0 deletions test/_mock_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ module.exports = function (expected, done) {
},
supportsKeepingUnsampledTransaction () {
return true
},
supportsActivationMethodField () {
return true
}
}

Expand Down
3 changes: 3 additions & 0 deletions test/_mock_http_client_states.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ module.exports = function (expectations = [], done) {
},
supportsKeepingUnsampledTransaction () {
return true
},
supportsActivationMethodField () {
return true
}
}
}
2 changes: 1 addition & 1 deletion test/activation-method/activation-method.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
12 changes: 5 additions & 7 deletions test/agent.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
{},
Expand Down Expand Up @@ -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()
})
Expand Down
4 changes: 4 additions & 0 deletions test/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1129,6 +1129,10 @@ test('custom transport', function (t) {
supportsKeepingUnsampledTransaction () {
return true
}

supportsActivationMethodField () {
return true
}
}
const myTransport = new MyTransport()

Expand Down
3 changes: 2 additions & 1 deletion test/outcome.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const noOpClient = {
sendError () {},
sendMetricSet () {},
flush () {},
supportsKeepingUnsampledTransaction () { return true }
supportsKeepingUnsampledTransaction () { return true },
supportsActivationMethodField () { return true }
}
agent._transport = noOpClient

Expand Down
8 changes: 7 additions & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down