elastic / elastic/apm-agent-nodejs
clarify and tweak `captureBody: "errors"` handling
- Dominant language
- JavaScript
- Stars
- 594
- Forks
- 244
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 16
Description
https://discuss.elastic.co/t/not-able-to-see-request-body-for-errors-in-nodejs-elastic-apm-agent-for-express-framework/336760 shows a case where `captureBody: "errors"` really doesn't do what could reasonably be expected. Suggestions:
1. I think that [the config var docs](https://www.elastic.co/guide/en/apm/agent/nodejs/current/configuration.html#capture-body) could be a little bit clearer here.
2. I also wonder about changing two things in the implementation: (a) If a request body is not configured to be captured, then the `http.request.body` field should not be reported rather than reported as `[REDACTED]`. (b) I wonder if we could have the body capturing for a *transaction* notice if there is a reported error that is associated with this transaction; if so and if `captureBody: 'errors'`, then we capture the body on the transaction object as well. I think that is what you would have expected, and having the body on the transaction object makes it much more accessible in the UI.
I think we can do the former for sure. @david-luna Thoughts on (2)?
Contributor guide
Assessment
This issue has not been assessed yet.