Skip to content

Commit 39859db

Browse files
authored
feat: metadata.system.{configured_hostname,detected_hostname}, prefer FQDN for host.name ECS field (#3437)
1 parent 171020f commit 39859db

File tree

6 files changed

+17
-12
lines changed

6 files changed

+17
-12
lines changed

CHANGELOG.asciidoc

+5
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ recent versions of node v12-v18. ESM support will remain experimental while the
6464
https://nodejs.org/api/esm.html#loaders[Node.js Loaders API] is experimental.
6565
See <<esm>> for full details.
6666
67+
* Send `configured_hostname` and `detected_hostname` metadata separately,
68+
rather than the old deprecated single `hostname` metadatum. As well, the
69+
detected hostname now attempts to collect a FQDN to be used in the
70+
`host.name` field in the Elasticsearch document. ({issues}3310[#3310])
71+
6772
[float]
6873
===== Bug fixes
6974

lib/apm-client/http-apm-client.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function getHttpClientConfig (conf, agent) {
3838
frameworkName: conf.frameworkName,
3939
frameworkVersion: conf.frameworkVersion,
4040
globalLabels: maybePairsToObject(conf.globalLabels),
41-
hostname: conf.hostname,
41+
configuredHostname: conf.hostname,
4242
environment: conf.environment,
4343

4444
// Sanitize conf

lib/instrumentation/modules/http2.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ module.exports = function (http2, agent, { enabled }) {
6565
const tracestate = headers.tracestate
6666
const trans = agent.startTransaction(null, 'request', {
6767
childOf: traceparent,
68-
tracestate: tracestate
68+
tracestate
6969
})
7070
// `trans.req` and `trans.res` are fake representations of Node.js's
7171
// core `http.IncomingMessage` and `http.ServerResponse` objects,

package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
"basic-auth": "^2.0.1",
9696
"cookie": "^0.5.0",
9797
"core-util-is": "^1.0.2",
98-
"elastic-apm-http-client": "11.4.0",
98+
"elastic-apm-http-client": "12.0.0",
9999
"end-of-stream": "^1.4.4",
100100
"error-callsites": "^2.0.4",
101101
"error-stack-parser": "^2.0.6",

test/agent.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ function assertMetadata (t, payload) {
6565
'metadata: service.agent')
6666

6767
const system = Object.assign({}, payload.system)
68-
t.strictEqual(system.hostname, os.hostname(), 'metadata: system.hostname')
69-
delete system.hostname
68+
t.ok(system.detected_hostname.startsWith(os.hostname()), 'metadata: system.detected_hostname')
69+
delete system.detected_hostname
7070
t.strictEqual(system.architecture, process.arch, 'metadata: system.architecture')
7171
delete system.architecture
7272
t.strictEqual(system.platform, process.platform, 'metadata: system.platform')

0 commit comments

Comments
 (0)