mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-08-08 23:37:11 +00:00
component-base metrics: allow usage of Prometheus types in tests
Test code using the testutil.Metrics type already depended on the Prometheus types, but couldn't reference them by name. This is necessary for example when using Gomega (to cast from `any` in a matcher) or when defining a `var sample *Sample` which gets set later.
This commit is contained in:
@@ -38,8 +38,20 @@ var (
|
||||
QuantileLabel model.LabelName = model.QuantileLabel
|
||||
)
|
||||
|
||||
// Metrics is generic metrics for other specific metrics
|
||||
type Metrics map[string]model.Samples
|
||||
// Metrics is generic metrics for other specific metrics.
|
||||
// This directly exposes Prometheus types. Test code may
|
||||
// use those via type aliases provided by this package
|
||||
// instead of imorting the Prometheus packages (https://github.com/kubernetes/kubernetes/issues/89267).
|
||||
type Metrics map[string]Samples
|
||||
type Samples = model.Samples
|
||||
type Sample = model.Sample
|
||||
type Metric = model.Metric
|
||||
type LabelValue = model.LabelValue
|
||||
type LabelName = model.LabelName
|
||||
type SampleHistogram = model.SampleHistogram
|
||||
type FloatString = model.FloatString
|
||||
type HistogramBuckets = model.HistogramBuckets
|
||||
type HistogramBucket = model.HistogramBucket
|
||||
|
||||
// Equal returns true if all metrics are the same as the arguments.
|
||||
func (m *Metrics) Equal(o Metrics) bool {
|
||||
|
||||
Reference in New Issue
Block a user