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