client_golang icon indicating copy to clipboard operation
client_golang copied to clipboard

More powerful and more customizable MultiError

Open beorn7 opened this issue 4 years ago • 4 comments

The ad-hoc prometheus.MultiError implementation doesn't support the new goodies from the standard errors package. It also formats into a multi-line error string, which is undesired by some users.

Both could be solved by replacing it with something like https://github.com/hashicorp/go-multierror , which allows customizable formatting. However, it would break existing users and therefore has to be a v2 feature.

beorn7 avatar Dec 02 '20 18:12 beorn7

Also, check what flavors of multi-error other parts of the Prometheus ecosystem are using.

beorn7 avatar Jan 25 '21 13:01 beorn7

I moved our Prometheus multi error to separate module so it's easy to use. The plan would be to use that on Promeheus too (if team agress). Also Thanos etc

It's here: https://github.com/efficientgo/tools/tree/main/core/pkg/merrors

Do you think it would be easier to just focus on one? I used same formatting. We could think of customizing formatting. I think can allow this. WDYT?

bwplotka avatar Jan 25 '21 13:01 bwplotka

To keep things in scope of this issue: We can only change the MultiError in client_golang when we bump the major version. That won't happen tomorrow, so I'd say just do whatever is best for the MultiError in a more general Prometheus (or even wider) context. Once we get to solving this issue here, we'll just check if it it a fit (which I assume it will).

beorn7 avatar Jan 25 '21 13:01 beorn7

I mostly assigned this to myself as a “default” because I used to be the maintainer of this repo. Therefore, I'm un-assigning this from myself no. New maintainers @bwplotka & @kakkoyun, please deal with this as you see fit.

beorn7 avatar Jun 02 '21 18:06 beorn7