From 0741d823d3e42c6905b5578ee54c2d4c48fcb7df Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Wed, 8 Sep 2021 23:38:04 -0400 Subject: [PATCH] Cherrypick #5062 to 0.30.x: Use staleness markers generated by prometheus, rather than making our own (#3991) * Revert "receiver/prometheus: glue and complete staleness marking for disappearing metrics (#3423)" This reverts commit 8b79380c1eff5925a3f576cef416d85ac718e253. * Revert "receiver/prometheus: add store to track stale metrics (#3414)" This reverts commit cdc163427b8e29af4170814e0a1c7300ea506692. * stop dropping staleness markers from prometheus, and fix tests * add staleness end to end test from #3423 * fix import grouping --- .../internal/metricsbuilder.go | 15 +-- .../internal/metricsbuilder_test.go | 12 +- .../prometheusreceiver/internal/ocastore.go | 8 +- .../internal/staleness_end_to_end_test.go | 2 - .../internal/staleness_store.go | 118 ------------------ .../internal/staleness_store_test.go | 58 --------- .../internal/transaction.go | 31 +---- .../internal/transaction_test.go | 29 +---- .../metrics_receiver_test.go | 1 - 9 files changed, 17 insertions(+), 257 deletions(-) delete mode 100644 receiver/prometheusreceiver/internal/staleness_store.go delete mode 100644 receiver/prometheusreceiver/internal/staleness_store_test.go diff --git a/receiver/prometheusreceiver/internal/metricsbuilder.go b/receiver/prometheusreceiver/internal/metricsbuilder.go index 7210db9b41d..6d8e5c1e3fb 100644 --- a/receiver/prometheusreceiver/internal/metricsbuilder.go +++ b/receiver/prometheusreceiver/internal/metricsbuilder.go @@ -26,7 +26,6 @@ import ( "github.com/prometheus/common/model" "github.com/prometheus/prometheus/pkg/labels" "github.com/prometheus/prometheus/pkg/textparse" - "github.com/prometheus/prometheus/pkg/value" "go.uber.org/zap" "google.golang.org/protobuf/types/known/timestamppb" ) @@ -59,13 +58,12 @@ type metricBuilder struct { startTime float64 logger *zap.Logger currentMf MetricFamily - stalenessStore *stalenessStore } // newMetricBuilder creates a MetricBuilder which is allowed to feed all the datapoints from a single prometheus // scraped page by calling its AddDataPoint function, and turn them into an opencensus data.MetricsData object // by calling its Build function -func newMetricBuilder(mc MetadataCache, useStartTimeMetric bool, startTimeMetricRegex string, logger *zap.Logger, stalenessStore *stalenessStore) *metricBuilder { +func newMetricBuilder(mc MetadataCache, useStartTimeMetric bool, startTimeMetricRegex string, logger *zap.Logger) *metricBuilder { var regex *regexp.Regexp if startTimeMetricRegex != "" { regex, _ = regexp.Compile(startTimeMetricRegex) @@ -78,7 +76,6 @@ func newMetricBuilder(mc MetadataCache, useStartTimeMetric bool, startTimeMetric droppedTimeseries: 0, useStartTimeMetric: useStartTimeMetric, startTimeMetricRegex: regex, - stalenessStore: stalenessStore, } } @@ -91,7 +88,7 @@ func (b *metricBuilder) matchStartTimeMetric(metricName string) bool { } // AddDataPoint is for feeding prometheus data complexValue in its processing order -func (b *metricBuilder) AddDataPoint(ls labels.Labels, t int64, v float64) (rerr error) { +func (b *metricBuilder) AddDataPoint(ls labels.Labels, t int64, v float64) error { // Any datapoint with duplicate labels MUST be rejected per: // * https://github.com/open-telemetry/wg-prometheus/issues/44 // * https://github.com/open-telemetry/opentelemetry-collector/issues/3407 @@ -109,14 +106,6 @@ func (b *metricBuilder) AddDataPoint(ls labels.Labels, t int64, v float64) (rerr return fmt.Errorf("invalid sample: non-unique label names: %q", dupLabels) } - defer func() { - // Only mark this data point as in the current scrape - // iff it isn't a stale metric. - if rerr == nil && !value.IsStaleNaN(v) { - b.stalenessStore.markAsCurrentlySeen(ls, t) - } - }() - metricName := ls.Get(model.MetricNameLabel) switch { case metricName == "": diff --git a/receiver/prometheusreceiver/internal/metricsbuilder_test.go b/receiver/prometheusreceiver/internal/metricsbuilder_test.go index 68bb9b70d39..d1825f4ea49 100644 --- a/receiver/prometheusreceiver/internal/metricsbuilder_test.go +++ b/receiver/prometheusreceiver/internal/metricsbuilder_test.go @@ -99,7 +99,7 @@ func runBuilderTests(t *testing.T, tests []buildTestData) { mc := newMockMetadataCache(testMetadata) st := startTs for i, page := range tt.inputs { - b := newMetricBuilder(mc, true, "", testLogger, dummyStalenessStore()) + b := newMetricBuilder(mc, true, "", testLogger) b.startTime = defaultBuilderStartTime // set to a non-zero value for _, pt := range page.pts { // set ts for testing @@ -123,7 +123,7 @@ func runBuilderStartTimeTests(t *testing.T, tests []buildTestData, st := startTs for _, page := range tt.inputs { b := newMetricBuilder(mc, true, startTimeMetricRegex, - testLogger, dummyStalenessStore()) + testLogger) b.startTime = defaultBuilderStartTime // set to a non-zero value for _, pt := range page.pts { // set ts for testing @@ -1201,7 +1201,7 @@ func Test_metricBuilder_summary(t *testing.T) { func Test_metricBuilder_baddata(t *testing.T) { t.Run("empty-metric-name", func(t *testing.T) { mc := newMockMetadataCache(testMetadata) - b := newMetricBuilder(mc, true, "", testLogger, dummyStalenessStore()) + b := newMetricBuilder(mc, true, "", testLogger) b.startTime = 1.0 // set to a non-zero value if err := b.AddDataPoint(labels.FromStrings("a", "b"), startTs, 123); err != errMetricNameNotFound { t.Error("expecting errMetricNameNotFound error, but get nil") @@ -1215,7 +1215,7 @@ func Test_metricBuilder_baddata(t *testing.T) { t.Run("histogram-datapoint-no-bucket-label", func(t *testing.T) { mc := newMockMetadataCache(testMetadata) - b := newMetricBuilder(mc, true, "", testLogger, dummyStalenessStore()) + b := newMetricBuilder(mc, true, "", testLogger) b.startTime = 1.0 // set to a non-zero value if err := b.AddDataPoint(createLabels("hist_test", "k", "v"), startTs, 123); err != errEmptyBoundaryLabel { t.Error("expecting errEmptyBoundaryLabel error, but get nil") @@ -1224,7 +1224,7 @@ func Test_metricBuilder_baddata(t *testing.T) { t.Run("summary-datapoint-no-quantile-label", func(t *testing.T) { mc := newMockMetadataCache(testMetadata) - b := newMetricBuilder(mc, true, "", testLogger, dummyStalenessStore()) + b := newMetricBuilder(mc, true, "", testLogger) b.startTime = 1.0 // set to a non-zero value if err := b.AddDataPoint(createLabels("summary_test", "k", "v"), startTs, 123); err != errEmptyBoundaryLabel { t.Error("expecting errEmptyBoundaryLabel error, but get nil") @@ -1452,7 +1452,7 @@ func Test_heuristicalMetricAndKnownUnits(t *testing.T) { // Ensure that we reject duplicate label keys. See https://github.com/open-telemetry/wg-prometheus/issues/44. func TestMetricBuilderDuplicateLabelKeysAreRejected(t *testing.T) { mc := newMockMetadataCache(testMetadata) - mb := newMetricBuilder(mc, true, "", testLogger, dummyStalenessStore()) + mb := newMetricBuilder(mc, true, "", testLogger) dupLabels := labels.Labels{ {Name: "__name__", Value: "test"}, diff --git a/receiver/prometheusreceiver/internal/ocastore.go b/receiver/prometheusreceiver/internal/ocastore.go index b7ed0427b18..eb21704f169 100644 --- a/receiver/prometheusreceiver/internal/ocastore.go +++ b/receiver/prometheusreceiver/internal/ocastore.go @@ -51,8 +51,7 @@ type OcaStore struct { receiverID config.ComponentID externalLabels labels.Labels - logger *zap.Logger - stalenessStore *stalenessStore + logger *zap.Logger } // NewOcaStore returns an ocaStore instance, which can be acted as prometheus' scrape.Appendable @@ -75,7 +74,6 @@ func NewOcaStore( startTimeMetricRegex: startTimeMetricRegex, receiverID: receiverID, externalLabels: externalLabels, - stalenessStore: newStalenessStore(), } } @@ -90,9 +88,6 @@ func (o *OcaStore) SetScrapeManager(scrapeManager *scrape.Manager) { func (o *OcaStore) Appender(context.Context) storage.Appender { state := atomic.LoadInt32(&o.running) if state == runningStateReady { - // Firstly prepare the stalenessStore for a new scrape cyle. - o.stalenessStore.refresh() - return newTransaction( o.ctx, o.jobsMap, @@ -103,7 +98,6 @@ func (o *OcaStore) Appender(context.Context) storage.Appender { o.sink, o.externalLabels, o.logger, - o.stalenessStore, ) } else if state == runningStateInit { panic("ScrapeManager is not set") diff --git a/receiver/prometheusreceiver/internal/staleness_end_to_end_test.go b/receiver/prometheusreceiver/internal/staleness_end_to_end_test.go index bf34180cca5..61e68249749 100644 --- a/receiver/prometheusreceiver/internal/staleness_end_to_end_test.go +++ b/receiver/prometheusreceiver/internal/staleness_end_to_end_test.go @@ -121,14 +121,12 @@ receivers: scrape_interval: 2ms static_configs: - targets: [%q] - processors: batch: exporters: prometheusremotewrite: endpoint: %q insecure: true - service: pipelines: metrics: diff --git a/receiver/prometheusreceiver/internal/staleness_store.go b/receiver/prometheusreceiver/internal/staleness_store.go deleted file mode 100644 index 66cecc27075..00000000000 --- a/receiver/prometheusreceiver/internal/staleness_store.go +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internal - -import ( - "math" - "sync" - - "github.com/prometheus/prometheus/pkg/labels" - "github.com/prometheus/prometheus/pkg/value" -) - -// Prometheus uses a special NaN to record staleness as per -// https://github.com/prometheus/prometheus/blob/67dc912ac8b24f94a1fc478f352d25179c94ab9b/pkg/value/value.go#L24-L28 -var stalenessSpecialValue = math.Float64frombits(value.StaleNaN) - -// stalenessStore tracks metrics/labels that appear between scrapes, the current and last scrape. -// The labels that appear only in the previous scrape are considered stale and for those, we -// issue a staleness marker aka a special NaN value. -// See https://github.com/open-telemetry/opentelemetry-collector/issues/3413 -type stalenessStore struct { - mu sync.Mutex // mu protects all the fields below. - currentHashes map[uint64]int64 - previousHashes map[uint64]int64 - previous []labels.Labels - current []labels.Labels -} - -func newStalenessStore() *stalenessStore { - return &stalenessStore{ - previousHashes: make(map[uint64]int64), - currentHashes: make(map[uint64]int64), - } -} - -// refresh copies over all the current values to previous, and prepares. -// refresh must be called before every new scrape. -func (ss *stalenessStore) refresh() { - ss.mu.Lock() - defer ss.mu.Unlock() - - // 1. Clear ss.previousHashes firstly. Please don't edit - // this map clearing idiom as it ensures speed. - // See: - // * https://github.com/golang/go/issues/20138 - // * https://github.com/golang/go/commit/aee71dd70b3779c66950ce6a952deca13d48e55e - for hash := range ss.previousHashes { - delete(ss.previousHashes, hash) - } - // 2. Copy over ss.currentHashes to ss.previousHashes. - for hash := range ss.currentHashes { - ss.previousHashes[hash] = ss.currentHashes[hash] - } - // 3. Clear ss.currentHashes, with the map clearing idiom for speed. - // See: - // * https://github.com/golang/go/issues/20138 - // * https://github.com/golang/go/commit/aee71dd70b3779c66950ce6a952deca13d48e55e - for hash := range ss.currentHashes { - delete(ss.currentHashes, hash) - } - // 4. Copy all the prior labels from what was previously ss.current. - ss.previous = ss.current - // 5. Clear ss.current to make for another cycle. - ss.current = nil -} - -// isStale returns whether lbl was seen only in the previous scrape and not the current. -func (ss *stalenessStore) isStale(lbl labels.Labels) bool { - ss.mu.Lock() - defer ss.mu.Unlock() - - hash := lbl.Hash() - _, inPrev := ss.previousHashes[hash] - _, inCurrent := ss.currentHashes[hash] - return inPrev && !inCurrent -} - -// markAsCurrentlySeen adds lbl to the manifest of labels seen in the current scrape. -// This method should be called before refresh, but during a scrape whenever labels are encountered. -func (ss *stalenessStore) markAsCurrentlySeen(lbl labels.Labels, seenAtMs int64) { - ss.mu.Lock() - defer ss.mu.Unlock() - - ss.currentHashes[lbl.Hash()] = seenAtMs - ss.current = append(ss.current, lbl) -} - -type staleEntry struct { - labels labels.Labels - seenAtMs int64 -} - -// emitStaleLabels returns the labels that were previously seen in -// the prior scrape, but are not currently present in this scrape cycle. -func (ss *stalenessStore) emitStaleLabels() (stale []*staleEntry) { - ss.mu.Lock() - defer ss.mu.Unlock() - - for _, labels := range ss.previous { - hash := labels.Hash() - if _, ok := ss.currentHashes[hash]; !ok { - stale = append(stale, &staleEntry{seenAtMs: ss.previousHashes[hash], labels: labels}) - } - } - return stale -} diff --git a/receiver/prometheusreceiver/internal/staleness_store_test.go b/receiver/prometheusreceiver/internal/staleness_store_test.go deleted file mode 100644 index d6f099241ed..00000000000 --- a/receiver/prometheusreceiver/internal/staleness_store_test.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internal - -import ( - "testing" - "time" - - "github.com/prometheus/prometheus/pkg/labels" - "github.com/stretchr/testify/require" -) - -func TestStalenessStore(t *testing.T) { - ss := newStalenessStore() - require.NotNil(t, ss.previousHashes) - require.Zero(t, len(ss.previousHashes)) - require.NotNil(t, ss.currentHashes) - require.Zero(t, len(ss.currentHashes)) - - lbl1 := labels.Labels{ - {Name: "__name__", Value: "lbl1"}, - {Name: "a", Value: "1"}, - } - lbl2 := labels.Labels{ - {Name: "__name__", Value: "lbl2"}, - {Name: "b", Value: "1"}, - } - ss.markAsCurrentlySeen(lbl1, time.Now().Unix()) - require.Nil(t, ss.emitStaleLabels()) - require.False(t, ss.isStale(lbl1)) - require.False(t, ss.isStale(lbl2)) - - // Now refresh, the case of a new scrape. - // Without having marked lbl1 as being current, it should be reported as stale. - ss.refresh() - require.True(t, ss.isStale(lbl1)) - require.False(t, ss.isStale(lbl2)) - // .previous should have been the prior contents of current and current should be nil. - require.Equal(t, ss.previous, []labels.Labels{lbl1}) - require.Nil(t, ss.current) - - // After the next refresh cycle, we shouldn't have any stale labels. - ss.refresh() - require.False(t, ss.isStale(lbl1)) - require.False(t, ss.isStale(lbl2)) -} diff --git a/receiver/prometheusreceiver/internal/transaction.go b/receiver/prometheusreceiver/internal/transaction.go index 48cc5479627..2dd5accecfe 100644 --- a/receiver/prometheusreceiver/internal/transaction.go +++ b/receiver/prometheusreceiver/internal/transaction.go @@ -17,7 +17,6 @@ package internal import ( "context" "errors" - "math" "net" "sync/atomic" @@ -76,8 +75,6 @@ type transaction struct { externalLabels labels.Labels logger *zap.Logger obsrecv *obsreport.Receiver - stalenessStore *stalenessStore - startTimeMs int64 } func newTransaction( @@ -89,7 +86,7 @@ func newTransaction( ms *metadataService, sink consumer.Metrics, externalLabels labels.Labels, - logger *zap.Logger, stalenessStore *stalenessStore) *transaction { + logger *zap.Logger) *transaction { return &transaction{ id: atomic.AddInt64(&idSeq, 1), ctx: ctx, @@ -103,8 +100,6 @@ func newTransaction( externalLabels: externalLabels, logger: logger, obsrecv: obsreport.NewReceiver(obsreport.ReceiverSettings{ReceiverID: receiverID, Transport: transport}), - stalenessStore: stalenessStore, - startTimeMs: -1, } } @@ -113,17 +108,6 @@ var _ storage.Appender = (*transaction)(nil) // Append always returns 0 to disable label caching. func (tr *transaction) Append(ref uint64, ls labels.Labels, t int64, v float64) (uint64, error) { - if tr.startTimeMs < 0 { - tr.startTimeMs = t - } - // Important, must handle. prometheus will still try to feed the appender some data even if it failed to - // scrape the remote target, if the previous scrape was success and some data were cached internally - // in our case, we don't need these data, simply drop them shall be good enough. more details: - // https://github.com/prometheus/prometheus/blob/851131b0740be7291b98f295567a97f32fffc655/scrape/scrape.go#L933-L935 - if math.IsNaN(v) { - return 0, nil - } - select { case <-tr.ctx.Done(): return 0, errTransactionAborted @@ -138,7 +122,6 @@ func (tr *transaction) Append(ref uint64, ls labels.Labels, t int64, v float64) return 0, err } } - return 0, tr.metricBuilder.AddDataPoint(ls, t, v) } @@ -166,7 +149,7 @@ func (tr *transaction) initTransaction(ls labels.Labels) error { tr.instance = instance } tr.node, tr.resource = createNodeAndResource(job, instance, mc.SharedLabels().Get(model.SchemeLabel)) - tr.metricBuilder = newMetricBuilder(mc, tr.useStartTimeMetric, tr.startTimeMetricRegex, tr.logger, tr.stalenessStore) + tr.metricBuilder = newMetricBuilder(mc, tr.useStartTimeMetric, tr.startTimeMetricRegex, tr.logger) tr.isNew = false return nil } @@ -179,15 +162,6 @@ func (tr *transaction) Commit() error { return nil } - // Before building metrics, issue staleness markers for every stale metric. - staleLabels := tr.stalenessStore.emitStaleLabels() - - for _, sEntry := range staleLabels { - tr.metricBuilder.AddDataPoint(sEntry.labels, sEntry.seenAtMs, stalenessSpecialValue) - } - - tr.startTimeMs = -1 - ctx := tr.obsrecv.StartMetricsOp(tr.ctx) metrics, _, _, err := tr.metricBuilder.Build() if err != nil { @@ -225,7 +199,6 @@ func (tr *transaction) Commit() error { } func (tr *transaction) Rollback() error { - tr.startTimeMs = -1 return nil } diff --git a/receiver/prometheusreceiver/internal/transaction_test.go b/receiver/prometheusreceiver/internal/transaction_test.go index 7cccd24f9f5..b6179fab354 100644 --- a/receiver/prometheusreceiver/internal/transaction_test.go +++ b/receiver/prometheusreceiver/internal/transaction_test.go @@ -16,7 +16,6 @@ package internal import ( "context" - "math" "testing" "time" @@ -32,8 +31,6 @@ import ( "go.opentelemetry.io/collector/translator/internaldata" ) -func dummyStalenessStore() *stalenessStore { return newStalenessStore() } - func Test_transaction(t *testing.T) { // discoveredLabels contain labels prior to any processing discoveredLabels := labels.New( @@ -68,7 +65,7 @@ func Test_transaction(t *testing.T) { t.Run("Commit Without Adding", func(t *testing.T) { nomc := consumertest.NewNop() - tr := newTransaction(context.Background(), nil, true, "", rID, ms, nomc, nil, testLogger, dummyStalenessStore()) + tr := newTransaction(context.Background(), nil, true, "", rID, ms, nomc, nil, testLogger) if got := tr.Commit(); got != nil { t.Errorf("expecting nil from Commit() but got err %v", got) } @@ -76,7 +73,7 @@ func Test_transaction(t *testing.T) { t.Run("Rollback dose nothing", func(t *testing.T) { nomc := consumertest.NewNop() - tr := newTransaction(context.Background(), nil, true, "", rID, ms, nomc, nil, testLogger, dummyStalenessStore()) + tr := newTransaction(context.Background(), nil, true, "", rID, ms, nomc, nil, testLogger) if got := tr.Rollback(); got != nil { t.Errorf("expecting nil from Rollback() but got err %v", got) } @@ -85,7 +82,7 @@ func Test_transaction(t *testing.T) { badLabels := labels.Labels([]labels.Label{{Name: "foo", Value: "bar"}}) t.Run("Add One No Target", func(t *testing.T) { nomc := consumertest.NewNop() - tr := newTransaction(context.Background(), nil, true, "", rID, ms, nomc, nil, testLogger, dummyStalenessStore()) + tr := newTransaction(context.Background(), nil, true, "", rID, ms, nomc, nil, testLogger) if _, got := tr.Append(0, badLabels, time.Now().Unix()*1000, 1.0); got == nil { t.Errorf("expecting error from Add() but got nil") } @@ -97,7 +94,7 @@ func Test_transaction(t *testing.T) { {Name: "foo", Value: "bar"}}) t.Run("Add One Job not found", func(t *testing.T) { nomc := consumertest.NewNop() - tr := newTransaction(context.Background(), nil, true, "", rID, ms, nomc, nil, testLogger, dummyStalenessStore()) + tr := newTransaction(context.Background(), nil, true, "", rID, ms, nomc, nil, testLogger) if _, got := tr.Append(0, jobNotFoundLb, time.Now().Unix()*1000, 1.0); got == nil { t.Errorf("expecting error from Add() but got nil") } @@ -108,7 +105,7 @@ func Test_transaction(t *testing.T) { {Name: "__name__", Value: "foo"}}) t.Run("Add One Good", func(t *testing.T) { sink := new(consumertest.MetricsSink) - tr := newTransaction(context.Background(), nil, true, "", rID, ms, sink, nil, testLogger, dummyStalenessStore()) + tr := newTransaction(context.Background(), nil, true, "", rID, ms, sink, nil, testLogger) if _, got := tr.Append(0, goodLabels, time.Now().Unix()*1000, 1.0); got != nil { t.Errorf("expecting error == nil from Add() but got: %v\n", got) } @@ -142,7 +139,7 @@ func Test_transaction(t *testing.T) { t.Run("Error when start time is zero", func(t *testing.T) { sink := new(consumertest.MetricsSink) - tr := newTransaction(context.Background(), nil, true, "", rID, ms, sink, nil, testLogger, dummyStalenessStore()) + tr := newTransaction(context.Background(), nil, true, "", rID, ms, sink, nil, testLogger) if _, got := tr.Append(0, goodLabels, time.Now().Unix()*1000, 1.0); got != nil { t.Errorf("expecting error == nil from Add() but got: %v\n", got) } @@ -155,18 +152,4 @@ func Test_transaction(t *testing.T) { } }) - t.Run("Drop NaN value", func(t *testing.T) { - sink := new(consumertest.MetricsSink) - tr := newTransaction(context.Background(), nil, true, "", rID, ms, sink, nil, testLogger, dummyStalenessStore()) - if _, got := tr.Append(0, goodLabels, time.Now().Unix()*1000, math.NaN()); got != nil { - t.Errorf("expecting error == nil from Add() but got: %v\n", got) - } - if got := tr.Commit(); got != nil { - t.Errorf("expecting nil from Commit() but got err %v", got) - } - if len(sink.AllMetrics()) != 0 { - t.Errorf("wanted nil, got %v\n", sink.AllMetrics()) - } - }) - } diff --git a/receiver/prometheusreceiver/metrics_receiver_test.go b/receiver/prometheusreceiver/metrics_receiver_test.go index 0502bf9bb83..613a4050bfe 100644 --- a/receiver/prometheusreceiver/metrics_receiver_test.go +++ b/receiver/prometheusreceiver/metrics_receiver_test.go @@ -1511,7 +1511,6 @@ func TestStartTimeMetricRegex(t *testing.T) { validateFunc: verifyStartTimeMetricPage, }, } - // Splitting out targets, because the prior tests were oblivious // about staleness metrics being emitted, and hence when trying // to compare values across 2 different scrapes emits staleness