Skip to content

Commit ec081da

Browse files
committed
chore: add payloadLogFile debug config option (#500)
1 parent 5d635e4 commit ec081da

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,13 @@ npm install elastic-apm-node --save
4747
Contributions are welcome,
4848
but we recommend that you take a moment and read our [contribution guide](CONTRIBUTING.md) first.
4949

50-
To ease development,
51-
set the environment variable `DEBUG_PAYLOAD=1` to have the agent dump the JSON payload sent to the APM Server to a temporary file on your local harddrive.
50+
To see what data is being sent to the APM Server,
51+
use the environment variable `ELASTIC_APM_PAYLOAD_LOG_FILE` (or the config option `payloadLogFile`) to speicfy a log file,
52+
e.g:
53+
54+
```
55+
ELASTIC_APM_PAYLOAD_LOG_FILE=/tmp/payload.ndjson
56+
```
5257

5358
Please see [TESTING.md](TESTING.md) for instructions on how to run the test suite.
5459

lib/agent.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,10 @@ Agent.prototype.start = function (opts) {
152152

153153
// Streaming conf
154154
size: this._conf.apiRequestSize,
155-
time: this._conf.apiRequestTime * 1000
155+
time: this._conf.apiRequestTime * 1000,
156+
157+
// Debugging
158+
payloadLogFile: this._conf.payloadLogFile
156159
})
157160
this._apmServer.on('error', err => {
158161
this.logger.error('An error occrued while communicating with the APM Server:', err.message)

lib/config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ var ENV_TABLE = {
8989
transactionMaxSpans: 'ELASTIC_APM_TRANSACTION_MAX_SPANS',
9090
transactionSampleRate: 'ELASTIC_APM_TRANSACTION_SAMPLE_RATE',
9191
serverTimeout: 'ELASTIC_APM_SERVER_TIMEOUT',
92-
disableInstrumentations: 'ELASTIC_APM_DISABLE_INSTRUMENTATIONS'
92+
disableInstrumentations: 'ELASTIC_APM_DISABLE_INSTRUMENTATIONS',
93+
payloadLogFile: 'ELASTIC_APM_PAYLOAD_LOG_FILE'
9394
}
9495

9596
var BOOL_OPTS = [

0 commit comments

Comments
 (0)