Skip to content

Commit b977ff6

Browse files
committed
chore: add payloadLogFile debug config option (#500)
1 parent 2c62c8c commit b977ff6

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
@@ -156,7 +156,10 @@ Agent.prototype.start = function (opts) {
156156

157157
// Streaming conf
158158
size: this._conf.apiRequestSize,
159-
time: this._conf.apiRequestTime * 1000
159+
time: this._conf.apiRequestTime * 1000,
160+
161+
// Debugging
162+
payloadLogFile: this._conf.payloadLogFile
160163
})
161164
this._apmServer.on('error', err => {
162165
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
@@ -88,7 +88,8 @@ var ENV_TABLE = {
8888
transactionMaxSpans: 'ELASTIC_APM_TRANSACTION_MAX_SPANS',
8989
transactionSampleRate: 'ELASTIC_APM_TRANSACTION_SAMPLE_RATE',
9090
serverTimeout: 'ELASTIC_APM_SERVER_TIMEOUT',
91-
disableInstrumentations: 'ELASTIC_APM_DISABLE_INSTRUMENTATIONS'
91+
disableInstrumentations: 'ELASTIC_APM_DISABLE_INSTRUMENTATIONS',
92+
payloadLogFile: 'ELASTIC_APM_PAYLOAD_LOG_FILE'
9293
}
9394

9495
var BOOL_OPTS = [

0 commit comments

Comments
 (0)