[feature request] [otlp-logs] Drop Exception StackTrace #6068
Description
Package
OpenTelemetry.Exporter.OpenTelemetryProtocol
Is your feature request related to a problem?
If an exception is provided on a log it gets written as three attributes in OTLP exporter:
logRecord.Exception.GetType().Name
->exception.type
logRecord.Exception.Message
->exception.message
logRecord.Exception.ToInvariantString()
->exception.stacktrace
exception.stacktrace
is particularly expensive in the regard it causes a string allocation and is something largeish which needs to be stored in backends.
It came up in discussion users may not want to pay for this.
We have some settings in GenevaExporter to change the behavior.
Should we have a similar feature in OTLP exporter?
This issue is for tracking demand for such a feature. If you are an interested user, please reply or 👍 this issue.
What is the expected behavior?
Expose an option to opt-out of capturing exception stack trace.
Which alternative solutions or features have you considered?
Users may manually capture exception details today:
logger.LogError("Could not say hello from {food} {price} {exception.type} {exception.message}.", food, price, ex.GetType().Name, ex.Message);
But this isn't a perfect solution because it must be done for every log message with an exception and in the case of library dependencies, it may not be possible to modify them.
Additional context
No response