opentelemetry-js icon indicating copy to clipboard operation
opentelemetry-js copied to clipboard

ability to capture errors from exporters

Open nferch opened this issue 1 year ago • 4 comments
trafficstars

Is your feature request related to a problem? Please describe.

It's not clear to me how one could programmatically capture errors from an exporter, e.g. when the URL or authentication is misconfigured or the endpoint is down.

You can set a logger with diag.setLogger() to log errors which is better than nothing, but without this there will be nothing to indicate a error condition.

Describe the solution you'd like

Exporters could provide an event or callback that gets invoked when there's a fatal error so the application or middleware can act accordingly. Depending on the circumstance, it might want to ignore the error, disable or backoff the exporting, or completely crash the program.

Describe alternatives you've considered

Implementing a DiagLogger that acts when it is asked to log an Error could work, but it seems like a misuse of a Logging interface and places the behavioral logic far from the caller.

I also believe this would be global for all errors in the API, not just errors from an Exporter, or a specific Exporter.

Additional context

Apologies in advance if there's some existing solution for this problem, as I'm a bit new to this implementation.

nferch avatar Jun 25 '24 13:06 nferch