MCPcopy
hub / github.com/prometheus/client_golang / compareMetricFamilies

Function compareMetricFamilies

prometheus/testutil/testutil.go:290–297  ·  view source on GitHub ↗

compareMetricFamilies would compare 2 slices of metric families, and optionally filters both of them to the `metricNames` provided.

(got, expected []*dto.MetricFamily, metricNames ...string)

Source from the content-addressed store, hash-verified

288// compareMetricFamilies would compare 2 slices of metric families, and optionally filters both of
289// them to the `metricNames` provided.
290func compareMetricFamilies(got, expected []*dto.MetricFamily, metricNames ...string) error {
291 if metricNames != nil {
292 got = filterMetrics(got, metricNames)
293 expected = filterMetrics(expected, metricNames)
294 }
295
296 return compare(got, expected)
297}
298
299// compare encodes both provided slices of metric families into the text format,
300// compares their string message, and returns an error if they do not match.

Callers 2

ScrapeAndCompareFunction · 0.85

Calls 2

filterMetricsFunction · 0.85
compareFunction · 0.85

Tested by

no test coverage detected