Capturing Inner Exceptions in CurrentTransaction.CaptureException


I am manually capturing exceptions during requests using the CaptureException method from ITransaction. I've noticed that it sores data only from the current exception but not the InnerException property. I extended the logic to capture also all inner exceptions and this seems to be working, however, as a result I have a list of errors which happened during transaction for which I am loosing the parent-child relation.

Am I doing this right? Should I call CaptureException for exception and all its inner exceptions or should this be done differently?

.net core: 3.1

Agent version: 1.7.1

APM Server version: 7.11.1

Hi @kbalys,

The APM server spec defines a "cause" property that can be used to capture a chain of exceptions on the captured exception of an APM error.

At the moment, the .NET agent does not use this property, but we've opened Capture Inner Exceptions on Error cause · Issue #1267 · elastic/apm-agent-dotnet · GitHub to implement in a future release.

1 Like