elastic-apm-node
Advanced tools
Comparing version 4.9.0 to 4.10.0
@@ -27,2 +27,3 @@ /* | ||
const { elasticApmAwsLambda } = require('./lambda'); | ||
const logging = require('./logging'); | ||
const Metrics = require('./metrics'); | ||
@@ -321,2 +322,19 @@ const parsers = require('./parsers'); | ||
if (!logging.isLoggerCustom(this.logger)) { | ||
// Periodically dump the current config (delta from defaults) when logging | ||
// at "trace"-level. This allows getting the effective config from a running | ||
// agent by setting trace-level logging and getting 1 minute of logs. | ||
// (Sometimes getting logs from application *start* is no possible.) | ||
setInterval(() => { | ||
if (this.logger.isLevelEnabled('trace')) { | ||
try { | ||
const currConfig = this._conf.getCurrConfig(); | ||
this.logger.trace({ currConfig }, 'currConfig'); | ||
} catch (err) { | ||
this.logger.trace({ err }, 'error calculating currConfig'); | ||
} | ||
} | ||
}, 60 * 1000).unref(); | ||
} | ||
if (isPreviewVersion) { | ||
@@ -323,0 +341,0 @@ this.logger.warn( |
@@ -73,2 +73,4 @@ /* | ||
logging.setLogLevel(agent.logger, value); | ||
// Hackily also set the HttpApmClient._log level. | ||
logging.setLogLevel(client._log, value); | ||
agent.logger.info( | ||
@@ -75,0 +77,0 @@ `Central config success: updated logger with new logLevel: ${value}`, |
@@ -37,2 +37,3 @@ /* | ||
readEnvOptions, | ||
CENTRAL_CONFIG_OPTS, | ||
} = require('./schema'); | ||
@@ -248,2 +249,23 @@ | ||
} | ||
// Returns an object showing the current config, excluding default values. | ||
getCurrConfig() { | ||
const currConfig = {}; | ||
// Start with the values from the logging preamble. This selected keys | ||
// that were specified, and handles redaction. | ||
for (let [k, v] of Object.entries(this.loggingPreambleData.config)) { | ||
currConfig[k] = v.value; | ||
} | ||
// Then add the current value of any var possibly set by central config. | ||
currConfig.centralConfig = this.centralConfig; | ||
if (this.centralConfig) { | ||
for (let k of Object.values(CENTRAL_CONFIG_OPTS)) { | ||
currConfig[k] = this[k]; | ||
} | ||
} | ||
return currConfig; | ||
} | ||
} | ||
@@ -250,0 +272,0 @@ |
@@ -748,2 +748,6 @@ /* | ||
) { | ||
agent.logger.debug( | ||
{ trans: transaction.id, trace: transaction.traceId }, | ||
'dropping unsampled transaction', | ||
); | ||
return; | ||
@@ -750,0 +754,0 @@ } |
@@ -91,2 +91,3 @@ /* | ||
trace: this.traceId, | ||
sampled: this.sampled, | ||
name: this.name, | ||
@@ -93,0 +94,0 @@ type: this.type, |
{ | ||
"name": "elastic-apm-node", | ||
"version": "4.9.0", | ||
"version": "4.10.0", | ||
"description": "The official Elastic APM agent for Node.js", | ||
@@ -5,0 +5,0 @@ "type": "commonjs", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
926637
24438