mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-10 07:34:04 -08:00
Revert "Revert "Ensure that all extracted samples are added to view.""
This reverts commit 4b30fb86b4
.
This commit is contained in:
parent
03addcd1a7
commit
eb1f956909
|
@ -200,21 +200,23 @@ func (s *memorySeriesStorage) AppendSample(sample model.Sample) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append raw sample, bypassing indexing. Only used to add data to views, which
|
// Append raw samples, bypassing indexing. Only used to add data to views,
|
||||||
// don't need to lookup by metric.
|
// which don't need to lookup by metric.
|
||||||
func (s *memorySeriesStorage) appendSampleWithoutIndexing(f *model.Fingerprint, timestamp time.Time, value model.SampleValue) {
|
func (s *memorySeriesStorage) appendSamplesWithoutIndexing(fingerprint *model.Fingerprint, samples model.Values) {
|
||||||
s.RLock()
|
s.RLock()
|
||||||
series, ok := s.fingerprintToSeries[*f]
|
series, ok := s.fingerprintToSeries[*fingerprint]
|
||||||
s.RUnlock()
|
s.RUnlock()
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
series = newStream(model.Metric{})
|
series = newStream(model.Metric{})
|
||||||
s.Lock()
|
s.Lock()
|
||||||
s.fingerprintToSeries[*f] = series
|
s.fingerprintToSeries[*fingerprint] = series
|
||||||
s.Unlock()
|
s.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
series.add(timestamp, value)
|
for _, sample := range samples {
|
||||||
|
series.add(sample.Timestamp, sample.Value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *memorySeriesStorage) GetFingerprintsForLabelSet(l model.LabelSet) (fingerprints model.Fingerprints, err error) {
|
func (s *memorySeriesStorage) GetFingerprintsForLabelSet(l model.LabelSet) (fingerprints model.Fingerprints, err error) {
|
||||||
|
|
|
@ -348,12 +348,10 @@ func (t *TieredStorage) renderView(viewJob viewJob) {
|
||||||
|
|
||||||
for op.CurrentTime() != nil && !op.CurrentTime().After(targetTime) {
|
for op.CurrentTime() != nil && !op.CurrentTime().After(targetTime) {
|
||||||
out = op.ExtractSamples(model.Values(currentChunk))
|
out = op.ExtractSamples(model.Values(currentChunk))
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Append the extracted samples to the materialized view.
|
// Append the extracted samples to the materialized view.
|
||||||
for _, sample := range out {
|
view.appendSamples(scanJob.fingerprint, out)
|
||||||
view.appendSample(scanJob.fingerprint, sample.Timestamp, sample.Value)
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Throw away standing ops which are finished.
|
// Throw away standing ops which are finished.
|
||||||
|
|
|
@ -105,8 +105,8 @@ type view struct {
|
||||||
*memorySeriesStorage
|
*memorySeriesStorage
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v view) appendSample(fingerprint *model.Fingerprint, timestamp time.Time, value model.SampleValue) {
|
func (v view) appendSamples(fingerprint *model.Fingerprint, samples model.Values) {
|
||||||
v.memorySeriesStorage.appendSampleWithoutIndexing(fingerprint, timestamp, value)
|
v.memorySeriesStorage.appendSamplesWithoutIndexing(fingerprint, samples)
|
||||||
}
|
}
|
||||||
|
|
||||||
func newView() view {
|
func newView() view {
|
||||||
|
|
Loading…
Reference in a new issue