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
Currently, when multiple errors are desired to be rolled into a single error we have not standard way of doing this. In fact, there are three separate ways:
This package has a clean interface designed around a well designed Error type. It does not have as many "helper" functions as github.com/uber-go/multierr, but it seems to be able to do the same features.
Can unwrap and wrap errors. Supports errors.As and errors.Is.
It has an ErrorOrNil method which we use in the metric SDK already.
Fine tuned error string with a function.
Versioning: stable v1.X
Dependencies: 1 direct
Popularity: 20919 packages depend on this (direct and indirect)
License: MPL-2.0
This license is not ideal for users planning to make their own distributions. They will be required to include a notice that portions of the source code use this license and they will need to link to github.com/hashicorp/go-multierror
The clean Error design of github.com/hashicorp/go-multierror is missing, but instead there are a good set of "helper" functions to combine function output.
Can unwrap and wrap errors. Supports errors.As and errors.Is.
There is no ErrorOrNil method which we use in the metric SDK.
Error string is clear, but not customizable.
Versioning: stable v1.X
Dependencies: 2 direct, 3 indirect
Popularity: 1152 packages depend on this (direct and indirect)
License: MIT
There are no patent guarantees, though I'm not sure this matters given this project is licensed with an Apache 2.0 license.
Build our own
I'm not sure we can improve on the multi-error design, but we would be able to ensure features we want are there.
Licensing: Apache 2.0 (like the rest of the project)
It will be really hard to ensure our implementation doesn't borrow from the prior two packages. Which means they would need to be attributed anyways.
The text was updated successfully, but these errors were encountered:
If the Go OTEL project is going to upgrade to v1.20, and there is a decision made to use the standard multi err implementation, then I think a good approach to consolidate this type of error handling might be to simply refactor the functions in opentelemetry-go/sdk/metric/config.go pointed out above
Currently, when multiple errors are desired to be rolled into a single error we have not standard way of doing this. In fact, there are three separate ways:
opentelemetry-go/sdk/metric/pipeline.go
Lines 479 to 482 in 7a60bc7
opentelemetry-go/exporters/otlp/otlpmetric/internal/transform/error.go
Lines 48 to 54 in 7a60bc7
opentelemetry-go/sdk/metric/config.go
Lines 51 to 57 in 7a60bc7
With the last example being replicated in a variety of formats in multiple packages.
Possible Solutions
github.com/hashicorp/go-multierror
Error
type. It does not have as many "helper" functions as github.com/uber-go/multierr, but it seems to be able to do the same features.errors.As
anderrors.Is
.ErrorOrNil
method which we use in the metric SDK already.github.com/uber-go/multierr
Error
design of github.com/hashicorp/go-multierror is missing, but instead there are a good set of "helper" functions to combine function output.errors.As
anderrors.Is
.ErrorOrNil
method which we use in the metric SDK.Build our own
The text was updated successfully, but these errors were encountered: