serilog-sinks-opentelemetry
serilog-sinks-opentelemetry copied to clipboard
Add fallback/file buffering when requests can't be sent
Is your feature request related to a problem? Please describe.
When the specified OTLP endpoint is unreachable or otherwise incapable of receiving the request, it would be great to have support for a fallback to file (or a custom sink). This will ensure that no data loss would occur in the event of a failure to export, as this sink is being used in critical auditing infrastructure.
Proposal:
Change the IExporter
interface for exports on log service requests to return some kind of information about the success/failure state of the exports.
This can then feed into the sink to make a decision about whether to reroute the logs to a secondary sink (or keep it as a filesystem-only fallback), or to continue with ignoring the response.
Expose an option to configure either a filesystem fallback location or a secondary sink fallback.
Edit: upon looking into it, we'd also need to catch exceptions in the case of unreachable grpc endpoints.
Describe alternatives you've considered
- Creating a resilient middleware that can receive the logs, however this still requires a network request.
- Overriding the implementations myself to ensure a fallback is present.
Additional context
I'd be happy to have a crack at implementing this for the filesystem-only approach if there's nothing already in the works.