25
vendor/k8s.io/component-base/metrics/summary.go
generated
vendored
25
vendor/k8s.io/component-base/metrics/summary.go
generated
vendored
@@ -37,10 +37,8 @@ type Summary struct {
|
||||
//
|
||||
// DEPRECATED: as per the metrics overhaul KEP
|
||||
func NewSummary(opts *SummaryOpts) *Summary {
|
||||
// todo: handle defaulting better
|
||||
if opts.StabilityLevel == "" {
|
||||
opts.StabilityLevel = ALPHA
|
||||
}
|
||||
opts.StabilityLevel.setDefaults()
|
||||
|
||||
s := &Summary{
|
||||
SummaryOpts: opts,
|
||||
lazyMetric: lazyMetric{},
|
||||
@@ -93,10 +91,8 @@ type SummaryVec struct {
|
||||
//
|
||||
// DEPRECATED: as per the metrics overhaul KEP
|
||||
func NewSummaryVec(opts *SummaryOpts, labels []string) *SummaryVec {
|
||||
// todo: handle defaulting better
|
||||
if opts.StabilityLevel == "" {
|
||||
opts.StabilityLevel = ALPHA
|
||||
}
|
||||
opts.StabilityLevel.setDefaults()
|
||||
|
||||
v := &SummaryVec{
|
||||
SummaryOpts: opts,
|
||||
originalLabels: labels,
|
||||
@@ -144,7 +140,7 @@ func (v *SummaryVec) WithLabelValues(lvs ...string) ObserverMetric {
|
||||
// must match those of the VariableLabels in Desc). If that label map is
|
||||
// accessed for the first time, a new ObserverMetric is created IFF the summaryVec has
|
||||
// been registered to a metrics registry.
|
||||
func (v *SummaryVec) With(labels prometheus.Labels) ObserverMetric {
|
||||
func (v *SummaryVec) With(labels map[string]string) ObserverMetric {
|
||||
if !v.IsCreated() {
|
||||
return noop
|
||||
}
|
||||
@@ -158,9 +154,18 @@ func (v *SummaryVec) With(labels prometheus.Labels) ObserverMetric {
|
||||
// with those of the VariableLabels in Desc. However, such inconsistent Labels
|
||||
// can never match an actual metric, so the method will always return false in
|
||||
// that case.
|
||||
func (v *SummaryVec) Delete(labels prometheus.Labels) bool {
|
||||
func (v *SummaryVec) Delete(labels map[string]string) bool {
|
||||
if !v.IsCreated() {
|
||||
return false // since we haven't created the metric, we haven't deleted a metric with the passed in values
|
||||
}
|
||||
return v.SummaryVec.Delete(labels)
|
||||
}
|
||||
|
||||
// Reset deletes all metrics in this vector.
|
||||
func (v *SummaryVec) Reset() {
|
||||
if !v.IsCreated() {
|
||||
return
|
||||
}
|
||||
|
||||
v.SummaryVec.Reset()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user