MCPcopy
hub / github.com/prometheus/prometheus / testScrapeReportMetadata

Function testScrapeReportMetadata

scrape/scrape_test.go:296–311  ·  view source on GitHub ↗
(t *testing.T, appV2 bool)

Source from the content-addressed store, hash-verified

294}
295
296func testScrapeReportMetadata(t *testing.T, appV2 bool) {
297 appTest := teststorage.NewAppendable()
298 sl, _ := newTestScrapeLoop(t, withAppendable(appTest, appV2))
299 app := sl.appender()
300
301 now := time.Now()
302 require.NoError(t, sl.report(app, now, 2*time.Second, 1, 1, 1, 512, nil))
303 require.NoError(t, app.Commit())
304 teststorage.RequireEqual(t, []sample{
305 {L: labels.FromStrings("__name__", "up"), M: scrapeHealthMetric.Metadata},
306 {L: labels.FromStrings("__name__", "scrape_duration_seconds"), M: scrapeDurationMetric.Metadata},
307 {L: labels.FromStrings("__name__", "scrape_samples_scraped"), M: scrapeSamplesMetric.Metadata},
308 {L: labels.FromStrings("__name__", "scrape_samples_post_metric_relabeling"), M: samplesPostRelabelMetric.Metadata},
309 {L: labels.FromStrings("__name__", "scrape_series_added"), M: scrapeSeriesAddedMetric.Metadata},
310 }, appTest.ResultMetadata())
311}
312
313func TestIsSeriesPartOfFamily(t *testing.T) {
314 t.Run("counter", func(t *testing.T) {

Callers 1

TestScrapeReportMetadataFunction · 0.85

Calls 9

ResultMetadataMethod · 0.95
NewAppendableFunction · 0.92
RequireEqualFunction · 0.92
FromStringsFunction · 0.92
newTestScrapeLoopFunction · 0.85
withAppendableFunction · 0.85
reportMethod · 0.80
CommitMethod · 0.65
appenderMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…