mirror of
https://github.com/prometheus/prometheus
synced 2026-04-30 14:50:25 +08:00
scrape: remove unused member from cacheEntry (#11281)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
This commit is contained in:
@@ -845,7 +845,6 @@ type cacheEntry struct {
|
||||
lastIter uint64
|
||||
hash uint64
|
||||
lset labels.Labels
|
||||
meta metadata.Metadata
|
||||
}
|
||||
|
||||
type scrapeLoop struct {
|
||||
@@ -991,11 +990,11 @@ func (c *scrapeCache) get(met string) (*cacheEntry, bool) {
|
||||
return e, true
|
||||
}
|
||||
|
||||
func (c *scrapeCache) addRef(met string, ref storage.SeriesRef, lset labels.Labels, meta metadata.Metadata, hash uint64) {
|
||||
func (c *scrapeCache) addRef(met string, ref storage.SeriesRef, lset labels.Labels, hash uint64) {
|
||||
if ref == 0 {
|
||||
return
|
||||
}
|
||||
c.series[met] = &cacheEntry{ref: ref, lastIter: c.iter, lset: lset, meta: meta, hash: hash}
|
||||
c.series[met] = &cacheEntry{ref: ref, lastIter: c.iter, lset: lset, hash: hash}
|
||||
}
|
||||
|
||||
func (c *scrapeCache) addDropped(met string) {
|
||||
@@ -1609,7 +1608,7 @@ loop:
|
||||
// Bypass staleness logic if there is an explicit timestamp.
|
||||
sl.cache.trackStaleness(hash, lset)
|
||||
}
|
||||
sl.cache.addRef(mets, ref, lset, meta, hash)
|
||||
sl.cache.addRef(mets, ref, lset, hash)
|
||||
if sampleAdded && sampleLimitErr == nil {
|
||||
seriesAdded++
|
||||
}
|
||||
@@ -1835,7 +1834,7 @@ func (sl *scrapeLoop) addReportSample(app storage.Appender, s string, t int64, v
|
||||
switch errors.Cause(err) {
|
||||
case nil:
|
||||
if !ok {
|
||||
sl.cache.addRef(s, ref, lset, metadata.Metadata{}, lset.Hash())
|
||||
sl.cache.addRef(s, ref, lset, lset.Hash())
|
||||
}
|
||||
return nil
|
||||
case storage.ErrOutOfOrderSample, storage.ErrDuplicateSampleForTimestamp:
|
||||
|
||||
@@ -39,7 +39,6 @@ import (
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
"github.com/prometheus/prometheus/model/exemplar"
|
||||
"github.com/prometheus/prometheus/model/labels"
|
||||
"github.com/prometheus/prometheus/model/metadata"
|
||||
"github.com/prometheus/prometheus/model/relabel"
|
||||
"github.com/prometheus/prometheus/model/textparse"
|
||||
"github.com/prometheus/prometheus/model/timestamp"
|
||||
@@ -1556,13 +1555,12 @@ func TestScrapeLoopAppendCacheEntryButErrNotFound(t *testing.T) {
|
||||
require.NoError(t, warning)
|
||||
|
||||
var lset labels.Labels
|
||||
var meta metadata.Metadata
|
||||
p.Next()
|
||||
mets := p.Metric(&lset)
|
||||
hash := lset.Hash()
|
||||
|
||||
// Create a fake entry in the cache
|
||||
sl.cache.addRef(mets, fakeRef, lset, meta, hash)
|
||||
sl.cache.addRef(mets, fakeRef, lset, hash)
|
||||
now := time.Now()
|
||||
|
||||
slApp := sl.appender(context.Background())
|
||||
|
||||
Reference in New Issue
Block a user