mirror of
https://github.com/prometheus/prometheus
synced 2025-04-11 03:52:13 +00:00
parent
e7c8a612de
commit
f70b52d0b6
@ -180,6 +180,7 @@ type MemorySeriesStorage struct {
|
|||||||
persistErrors prometheus.Counter
|
persistErrors prometheus.Counter
|
||||||
queuedChunksToPersist prometheus.Counter
|
queuedChunksToPersist prometheus.Counter
|
||||||
numSeries prometheus.Gauge
|
numSeries prometheus.Gauge
|
||||||
|
numHeadChunks prometheus.Gauge
|
||||||
dirtySeries prometheus.Gauge
|
dirtySeries prometheus.Gauge
|
||||||
seriesOps *prometheus.CounterVec
|
seriesOps *prometheus.CounterVec
|
||||||
ingestedSamplesCount prometheus.Counter
|
ingestedSamplesCount prometheus.Counter
|
||||||
@ -254,6 +255,12 @@ func NewMemorySeriesStorage(o *MemorySeriesStorageOptions) *MemorySeriesStorage
|
|||||||
Name: "memory_series",
|
Name: "memory_series",
|
||||||
Help: "The current number of series in memory.",
|
Help: "The current number of series in memory.",
|
||||||
}),
|
}),
|
||||||
|
numHeadChunks: prometheus.NewGauge(prometheus.GaugeOpts{
|
||||||
|
Namespace: namespace,
|
||||||
|
Subsystem: subsystem,
|
||||||
|
Name: "num_head_chunks_open",
|
||||||
|
Help: "The current number of open head chunks.",
|
||||||
|
}),
|
||||||
dirtySeries: prometheus.NewGauge(prometheus.GaugeOpts{
|
dirtySeries: prometheus.NewGauge(prometheus.GaugeOpts{
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Subsystem: subsystem,
|
Subsystem: subsystem,
|
||||||
@ -372,6 +379,16 @@ func (s *MemorySeriesStorage) Start() (err error) {
|
|||||||
|
|
||||||
log.Info("Loading series map and head chunks...")
|
log.Info("Loading series map and head chunks...")
|
||||||
s.fpToSeries, s.numChunksToPersist, err = p.loadSeriesMapAndHeads()
|
s.fpToSeries, s.numChunksToPersist, err = p.loadSeriesMapAndHeads()
|
||||||
|
openHeadCount := 0
|
||||||
|
for fp := range s.fpToSeries.fpIter() {
|
||||||
|
if series, ok := s.fpToSeries.get(fp); ok {
|
||||||
|
if !series.headChunkClosed {
|
||||||
|
openHeadCount += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
s.numHeadChunks.Set(float64(openHeadCount))
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -977,6 +994,9 @@ func (s *MemorySeriesStorage) getOrCreateSeries(fp model.Fingerprint, m model.Me
|
|||||||
}
|
}
|
||||||
s.fpToSeries.put(fp, series)
|
s.fpToSeries.put(fp, series)
|
||||||
s.numSeries.Inc()
|
s.numSeries.Inc()
|
||||||
|
if !series.headChunkClosed {
|
||||||
|
s.numHeadChunks.Inc()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return series, nil
|
return series, nil
|
||||||
}
|
}
|
||||||
@ -1383,6 +1403,7 @@ func (s *MemorySeriesStorage) maintainMemorySeries(
|
|||||||
}
|
}
|
||||||
if closed {
|
if closed {
|
||||||
s.incNumChunksToPersist(1)
|
s.incNumChunksToPersist(1)
|
||||||
|
s.numHeadChunks.Dec()
|
||||||
}
|
}
|
||||||
|
|
||||||
seriesWasDirty := series.dirty
|
seriesWasDirty := series.dirty
|
||||||
@ -1783,6 +1804,7 @@ func (s *MemorySeriesStorage) Describe(ch chan<- *prometheus.Desc) {
|
|||||||
ch <- maxChunksToPersistDesc
|
ch <- maxChunksToPersistDesc
|
||||||
ch <- numChunksToPersistDesc
|
ch <- numChunksToPersistDesc
|
||||||
ch <- s.numSeries.Desc()
|
ch <- s.numSeries.Desc()
|
||||||
|
ch <- s.numHeadChunks.Desc()
|
||||||
ch <- s.dirtySeries.Desc()
|
ch <- s.dirtySeries.Desc()
|
||||||
s.seriesOps.Describe(ch)
|
s.seriesOps.Describe(ch)
|
||||||
ch <- s.ingestedSamplesCount.Desc()
|
ch <- s.ingestedSamplesCount.Desc()
|
||||||
@ -1812,6 +1834,7 @@ func (s *MemorySeriesStorage) Collect(ch chan<- prometheus.Metric) {
|
|||||||
float64(s.getNumChunksToPersist()),
|
float64(s.getNumChunksToPersist()),
|
||||||
)
|
)
|
||||||
ch <- s.numSeries
|
ch <- s.numSeries
|
||||||
|
ch <- s.numHeadChunks
|
||||||
ch <- s.dirtySeries
|
ch <- s.dirtySeries
|
||||||
s.seriesOps.Collect(ch)
|
s.seriesOps.Collect(ch)
|
||||||
ch <- s.ingestedSamplesCount
|
ch <- s.ingestedSamplesCount
|
||||||
|
Loading…
Reference in New Issue
Block a user