Skip to content

[BUG] Request body is not captured if CaptureBody is "errors" #2029

Open
@mstrukov

Description

@mstrukov

APM Agent version

1.20.0

Environment

Linux, Kubernetes, .NET 6, Web API

Describe the bug

I'd like to capture request body for failed transactions only so I set "CaptureBody": "errors" in the application config file but the requests body is not captured and http.request.body.original is N/A

image
image

On the Errors tab http.request.body.original is [REDACTED]

image
image

However, the request body is captured both for failed and successful transactions if I set "CaptureBody": "all" .

To Reproduce

Steps to reproduce the behavior:

  1. Create a basic api with a post action which accepts a model
  2. Make sure the action fails with an exception (unhandled) and 500 error code is returned
  3. Set "CaptureBody": "errors"
  4. Call the action and pass a json to fill the model
  5. Verify that the response code is 500

Expected behavior

http.request.body.original contains the json passed when calling the action

Actual behavior

http.request.body.original is "N/A".

Again, it works as expected if CaptureBody is "all" and I can see http.request.body.original populated with actual request body both on Transactions and Errors tabs but I want request body for failed transactions or errors only.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions