mirror of
https://github.com/prometheus/prometheus.git
synced 2025-08-05 13:47:10 +02:00
add NumFloatSamples to TSDB block stats
Signed-off-by: Ahmed Hassan <afayekhassan@gmail.com>
This commit is contained in:
parent
6d77b47d13
commit
01be7bfb2e
@ -189,6 +189,7 @@ type BlockMeta struct {
|
||||
// BlockStats contains stats about contents of a block.
|
||||
type BlockStats struct {
|
||||
NumSamples uint64 `json:"numSamples,omitempty"`
|
||||
NumFloatSamples uint64 `json:"numFloatSamples,omitempty"`
|
||||
NumHistogramSamples uint64 `json:"numHistogramSamples,omitempty"`
|
||||
NumSeries uint64 `json:"numSeries,omitempty"`
|
||||
NumChunks uint64 `json:"numChunks,omitempty"`
|
||||
|
@ -895,10 +895,13 @@ func (c DefaultBlockPopulator) PopulateBlock(ctx context.Context, metrics *Compa
|
||||
meta.Stats.NumChunks += uint64(len(chks))
|
||||
meta.Stats.NumSeries++
|
||||
for _, chk := range chks {
|
||||
meta.Stats.NumSamples += uint64(chk.Chunk.NumSamples())
|
||||
enc := chk.Chunk.Encoding()
|
||||
if enc == chunkenc.EncHistogram || enc == chunkenc.EncFloatHistogram {
|
||||
meta.Stats.NumHistogramSamples += uint64(chk.Chunk.NumSamples())
|
||||
samples := uint64(chk.Chunk.NumSamples())
|
||||
meta.Stats.NumSamples += samples
|
||||
switch chk.Chunk.Encoding() {
|
||||
case chunkenc.EncHistogram, chunkenc.EncFloatHistogram:
|
||||
meta.Stats.NumHistogramSamples += samples
|
||||
case chunkenc.EncXOR:
|
||||
meta.Stats.NumFloatSamples += samples
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1101,6 +1101,8 @@ func TestCompaction_populateBlock(t *testing.T) {
|
||||
for _, smpl := range chk {
|
||||
if smpl.h != nil || smpl.fh != nil {
|
||||
s.NumHistogramSamples++
|
||||
} else {
|
||||
s.NumFloatSamples++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user