Skip to content

Commit

Permalink
Merge pull request #113609 from haircommander/sandbox-metrics
Browse files Browse the repository at this point in the history
kubelet: add support for broadcasting metrics from CRI

Kubernetes-commit: b4040b3b863737674a492f8fd415eff8503ba0b4
  • Loading branch information
k8s-publishing-bot committed Nov 9, 2022
2 parents 021afb5 + 90b1123 commit 4e8a958
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions metrics/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ func NewLazyConstMetric(desc *Desc, valueType ValueType, value float64, labelVal
return prometheus.MustNewConstMetric(desc.toPrometheusDesc(), valueType.toPromValueType(), value, labelValues...)
}

// NewConstMetric is a helper of NewConstMetric.
//
// Note: If the metrics described by the desc is hidden, the metrics will not be created.
func NewConstMetric(desc *Desc, valueType ValueType, value float64, labelValues ...string) (Metric, error) {
if desc.IsHidden() {
return nil, nil
}
return prometheus.NewConstMetric(desc.toPrometheusDesc(), valueType.toPromValueType(), value, labelValues...)
}

// NewLazyMetricWithTimestamp is a helper of NewMetricWithTimestamp.
//
// Warning: the Metric 'm' must be the one created by NewLazyConstMetric(),
Expand Down

0 comments on commit 4e8a958

Please sign in to comment.