New fallback sink on failed exports #156
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Disclaimer: I used ChatGPT to help with writing parts of this summary.
Summary
We introduce a new robust fallback mechanism to the sink, allowing logs and traces to be saved locally when the primary export to OpenTelemetry fails. This enhancement ensures greater resilience and data integrity by capturing logs and traces that would otherwise be lost during export failures.
Publicly visible changes
Fallback Configuration:
FallbackConfigurationOptions
to allow users to configure fallback paths for logs and traces separately or using a unified fallback. This configuration is part of theOpenTelemetrySinkOptions
.LogFallback
), traces (TraceFallback
), and a general fallback (Fallback
) if specific configurations are not enabled.Support for NDJSON and Protobuf Formats:
New Tests and Validation:
Documentation and Examples:
Internal changes
ExportResult
s. Consumption of these reults has been handled with a functional approach using deferred execution pipelines to fully capture failures and prevent thread-blocking behaviour.Serilog.Sinks.File
package was necessarily introduced to prevent duplicated efforts.LogEvent
and instead grabs the actual transformed OTLP message from aLogEvent
property, as we're using the File sink as a redirect mechanism and not a real logger.Benefits
Resolved Issues
Serilog.Sinks.File
sink