prometheus / client_golang

Prometheus instrumentation library for Go applications
https://pkg.go.dev/github.com/prometheus/client_golang
Apache License 2.0
5.39k stars 1.18k forks source link

More powerful and more customizable MultiError #820

Open beorn7 opened 3 years ago

beorn7 commented 3 years ago

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 commented 3 years ago

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

bwplotka commented 3 years ago

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?

beorn7 commented 3 years ago

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 commented 3 years ago

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.