forked from mirror/client_golang
Pull currying methods up into ObserverVec interface
This commit is contained in:
parent
dd20712622
commit
1ba60c7d58
|
@ -387,7 +387,7 @@ func (v *HistogramVec) With(labels Labels) Observer {
|
||||||
// vectors behave identically in terms of collection. Only one must be
|
// vectors behave identically in terms of collection. Only one must be
|
||||||
// registered with a given registry (usually the uncurried version). The Reset
|
// registered with a given registry (usually the uncurried version). The Reset
|
||||||
// method deletes all metrics, even if called on a curried vector.
|
// method deletes all metrics, even if called on a curried vector.
|
||||||
func (v *HistogramVec) CurryWith(labels Labels) (*HistogramVec, error) {
|
func (v *HistogramVec) CurryWith(labels Labels) (ObserverVec, error) {
|
||||||
vec, err := v.curryWith(labels)
|
vec, err := v.curryWith(labels)
|
||||||
if vec != nil {
|
if vec != nil {
|
||||||
return &HistogramVec{vec}, err
|
return &HistogramVec{vec}, err
|
||||||
|
@ -397,7 +397,7 @@ func (v *HistogramVec) CurryWith(labels Labels) (*HistogramVec, error) {
|
||||||
|
|
||||||
// MustCurryWith works as CurryWith but panics where CurryWith would have
|
// MustCurryWith works as CurryWith but panics where CurryWith would have
|
||||||
// returned an error.
|
// returned an error.
|
||||||
func (v *HistogramVec) MustCurryWith(labels Labels) *HistogramVec {
|
func (v *HistogramVec) MustCurryWith(labels Labels) ObserverVec {
|
||||||
vec, err := v.CurryWith(labels)
|
vec, err := v.CurryWith(labels)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
|
@ -45,6 +45,8 @@ type ObserverVec interface {
|
||||||
GetMetricWithLabelValues(lvs ...string) (Observer, error)
|
GetMetricWithLabelValues(lvs ...string) (Observer, error)
|
||||||
With(Labels) Observer
|
With(Labels) Observer
|
||||||
WithLabelValues(...string) Observer
|
WithLabelValues(...string) Observer
|
||||||
|
CurryWith(Labels) (ObserverVec, error)
|
||||||
|
MustCurryWith(Labels) ObserverVec
|
||||||
|
|
||||||
Collector
|
Collector
|
||||||
}
|
}
|
||||||
|
|
|
@ -504,7 +504,7 @@ func (v *SummaryVec) With(labels Labels) Observer {
|
||||||
// vectors behave identically in terms of collection. Only one must be
|
// vectors behave identically in terms of collection. Only one must be
|
||||||
// registered with a given registry (usually the uncurried version). The Reset
|
// registered with a given registry (usually the uncurried version). The Reset
|
||||||
// method deletes all metrics, even if called on a curried vector.
|
// method deletes all metrics, even if called on a curried vector.
|
||||||
func (v *SummaryVec) CurryWith(labels Labels) (*SummaryVec, error) {
|
func (v *SummaryVec) CurryWith(labels Labels) (ObserverVec, error) {
|
||||||
vec, err := v.curryWith(labels)
|
vec, err := v.curryWith(labels)
|
||||||
if vec != nil {
|
if vec != nil {
|
||||||
return &SummaryVec{vec}, err
|
return &SummaryVec{vec}, err
|
||||||
|
@ -514,7 +514,7 @@ func (v *SummaryVec) CurryWith(labels Labels) (*SummaryVec, error) {
|
||||||
|
|
||||||
// MustCurryWith works as CurryWith but panics where CurryWith would have
|
// MustCurryWith works as CurryWith but panics where CurryWith would have
|
||||||
// returned an error.
|
// returned an error.
|
||||||
func (v *SummaryVec) MustCurryWith(labels Labels) *SummaryVec {
|
func (v *SummaryVec) MustCurryWith(labels Labels) ObserverVec {
|
||||||
vec, err := v.CurryWith(labels)
|
vec, err := v.CurryWith(labels)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
Loading…
Reference in New Issue