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

feat(config): add serviceNodeName #1498

Merged
merged 1 commit into from
Nov 1, 2019
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
14 changes: 14 additions & 0 deletions docs/configuration.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ Your Elastic APM service name.

Allowed characters: `a-z`, `A-Z`, `0-9`, `-`, `_`, and space.

[float]
[[service-node-name]]
==== `serviceNodeName`

* *Type:* String
* *Env:* `ELASTIC_APM_SERVICE_NODE_NAME`

A unique name for the service node.
This is optional, and if omitted,
the APM Server will fall back on `system.container.id` if available,
and finally `host.name` if necessary.

This option allows you to set the node name manually to ensure uniqueness and meaningfulness.

[[secret-token]]
==== `secretToken`

Expand Down
3 changes: 3 additions & 0 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ var DEFAULTS = {
logUncaughtExceptions: false, // TODO: Change to `true` in the v4.0.0
metricsInterval: '30s',
metricsLimit: 1000,
serviceNodeName: undefined,
serverTimeout: '30s',
sourceLinesErrorAppFrames: 5,
sourceLinesErrorLibraryFrames: 5,
Expand Down Expand Up @@ -114,6 +115,7 @@ var ENV_TABLE = {
serverTimeout: 'ELASTIC_APM_SERVER_TIMEOUT',
serverUrl: 'ELASTIC_APM_SERVER_URL',
serviceName: 'ELASTIC_APM_SERVICE_NAME',
serviceNodeName: 'ELASTIC_APM_SERVICE_NODE_NAME',
serviceVersion: 'ELASTIC_APM_SERVICE_VERSION',
sourceLinesErrorAppFrames: 'ELASTIC_APM_SOURCE_LINES_ERROR_APP_FRAMES',
sourceLinesErrorLibraryFrames: 'ELASTIC_APM_SOURCE_LINES_ERROR_LIBRARY_FRAMES',
Expand Down Expand Up @@ -233,6 +235,7 @@ class Config {
agentName: 'nodejs',
agentVersion: version,
serviceName: conf.serviceName,
serviceNodeName: conf.serviceNodeName,
serviceVersion: conf.serviceVersion,
frameworkName: conf.frameworkName,
frameworkVersion: conf.frameworkVersion,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"console-log-level": "^1.4.1",
"cookie": "^0.4.0",
"core-util-is": "^1.0.2",
"elastic-apm-http-client": "^9.0.0",
"elastic-apm-http-client": "^9.2.0",
"end-of-stream": "^1.4.1",
"fast-safe-stringify": "^2.0.7",
"http-headers": "^3.0.2",
Expand Down
1 change: 1 addition & 0 deletions test/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ var optionFixtures = [
['serverTimeout', 'SERVER_TIMEOUT', 30],
['serverUrl', 'SERVER_URL'],
['serviceName', 'SERVICE_NAME', apmName],
['serviceNodeName', 'SERVICE_NODE_NAME'],
['serviceVersion', 'SERVICE_VERSION', apmVersion],
['sourceLinesErrorAppFrames', 'SOURCE_LINES_ERROR_APP_FRAMES', 5],
['sourceLinesErrorLibraryFrames', 'SOURCE_LINES_ERROR_LIBRARY_FRAMES', 5],
Expand Down