New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cut v1.4.0 #707
Cut v1.4.0 #707
Conversation
f1bcb1a
to
8a93ce5
Compare
👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! LGTM 👍
Well, we could add just a separate interface e.g
type HistogramWithExemplars interface {
// ObserveWithExemplar works like Observe but also replaces the
// currently saved exemplar for the relevant bucket (possibly none) with
// a new one, created from the provided value, the current time as
// timestamp, and the provided Labels. Empty Labels will lead to a valid
// (label-less) exemplar. But if Labels is nil, the current exemplar in
// the relevant bucket is left in place. This method panics if any of
// the provided labels are invalid or if the provided labels contain
// more than 64 runes in total.
ObserveWithExemplar(value float64, exemplar Labels)
}
and then:
- have constructor that returns Histogram like now, then user can try casting it to
HistogramWithExamplar
interface, - have
NewHistogramWithExemplar
constructor as well.
This way technically we don't have any compatibility issue, but might be an overengineering. I can see people implementing their own Histogram implementation (eg wrappers), but fixing this incompatibility indeed might be not a huge issue.
The same path is kind of done by http.ResponseWriter
when if you want to use custom methods you need to cast to certain interfaces.
Wonder what are you thoughts about separate interface idea @beorn7 (: But I think I am fine with this approach as well.
@bwplotka : Yes, your thoughts are precisely what I considered as a strictly compatible solution, but then I thought it's too clunky, at least if the issue we are avoiding by it is not very relevant. But I'm on the fence about it. Or in other words: I could easily be convince to do it that way, for example if there is a lot of backlash with this release. But perhaps we shouldn't even risk it. A related point is that the methods of a I think I'll create a proposal PR with an |
Perfect thanks 👍 I guess this means we wait with the release then. |
Signed-off-by: beorn7 <beorn@grafana.com>
8a93ce5
to
27bee32
Compare
I have rebased with #708 included. The only Please give final approvement or raise objections. |
@@ -4,11 +4,16 @@ require ( | |||
github.com/beorn7/perks v1.0.1 | |||
github.com/cespare/xxhash/v2 v2.1.1 | |||
github.com/golang/protobuf v1.3.2 | |||
github.com/json-iterator/go v1.1.8 | |||
github.com/google/go-cmp v0.4.0 // indirect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why about the indirect dependencies. I think they shouldn't be there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They got introduced by the update of dependencies. go mod tidy
doesn't remove them.
It seems that's the way it has to be.
Do you know a way I could try to get rid of them?
Signed-off-by: beorn7 <beorn@grafana.com>
27bee32
to
1e64193
Compare
Note that adding a method to the
Histogram
andCounter
interfaces is technically a breaking change. However, I cannot really think about any option that wouldn't be terribly convoluted. (It would be much easier if the constructor returned a concrete type that implements certain interfaces, but this mistake was made long ago.)I would expect that very few will have implemented their own
Histogram
andCounter
, and if they did, it will be easy to fix. So the impact will (hopefully) be quite limited.