You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apologies in advance if I misunderstand or overlook a valid use-case. I have a long experience with zap and opencensus/otel, but only recently started to use the otelzap package.
I think these methods should be removed from the otelzap package:
The use-case for the otelzap package is that the user is in a ctx context.Context with an active span, for which the user wants to attach errors. However, the zap Fatal method os.Exit(1)'s immediately. Therefore the span is never ended and it is also never exported. This function promotes behaviour users should never really want. It'll result in fatal errors not being visible in their APM/jaeger/etc. If the user really want to Fatal, they could still use the original (*zap.Logger).Fatal(..). But it just doesn't make sense to do it with the otelzap wrapper.
Panic should still be fine, as they bubble up the stack deferred span.End() and exporter.Close() can still run.
On breaking changes: Removing these methods would be a breaking change to the otelzap package, which generally should never happen within a major version of a Go package. However, one could argue that usage of the Fatal methods must be considered as a bug in the user's code, so users must change to Panic asap, which may warrant breaking their code...???
The text was updated successfully, but these errors were encountered:
Apologies in advance if I misunderstand or overlook a valid use-case. I have a long experience with zap and opencensus/otel, but only recently started to use the
otelzap
package.I think these methods should be removed from the
otelzap
package:The use-case for the
otelzap
package is that the user is in actx context.Context
with an active span, for which the user wants to attach errors. However, the zapFatal
methodos.Exit(1)
's immediately. Therefore the span is never ended and it is also never exported. This function promotes behaviour users should never really want. It'll result in fatal errors not being visible in their APM/jaeger/etc. If the user really want to Fatal, they could still use the original(*zap.Logger).Fatal(..)
. But it just doesn't make sense to do it with the otelzap wrapper.Panic should still be fine, as they bubble up the stack deferred
span.End()
andexporter.Close()
can still run.On breaking changes: Removing these methods would be a breaking change to the
otelzap
package, which generally should never happen within a major version of a Go package. However, one could argue that usage of the Fatal methods must be considered as a bug in the user's code, so users must change to Panic asap, which may warrant breaking their code...???The text was updated successfully, but these errors were encountered: