-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Labels
enhancementNew feature or requestNew feature or request
Description
serilog-sinks-opentelemetry/src/Serilog.Sinks.OpenTelemetry/Sinks/OpenTelemetry/OpenTelemetrySink.cs
Lines 50 to 71 in 2c9ebbc
| public void Emit(LogEvent logEvent) | |
| { | |
| bool? isSpan = null; | |
| if (_logsSink != null) | |
| { | |
| isSpan = IsSpan(logEvent); | |
| if (!isSpan.Value) | |
| { | |
| _logsSink.Emit(logEvent); | |
| return; | |
| } | |
| } | |
| if (_tracesSink != null) | |
| { | |
| isSpan ??= IsSpan(logEvent); | |
| if (isSpan.Value) | |
| { | |
| _tracesSink.Emit(logEvent); | |
| } | |
| } | |
| } |
If I understand the code correctly, if LogEvent is recognized as a span (i.e. it has SpanStartTimestamp property and some other things), it won't end up in logging even if tracing is not enabled - i.e., basically, lost.
I find this somewhat unexpected (but maybe I'm just reading it wrong), and I'd probably prefer this to be a configurable choice between
- "send to traces if trace endpoint present, otherwise logs" (default)
- "send to traces only, lost if not configured"
- "always send to traces and logs" (useful when logging and tracing endpoint are not well coordinated)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request