mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-15 08:23:34 +01:00
7f4fb34182
It is better developing vmctl tool in VictoriaMetrics repository, so it could be released together with the rest of vmutils tools such as vmalert, vmagent, vmbackup, vmrestore and vmauth.
37 lines
779 B
Go
37 lines
779 B
Go
package prometheus
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
type Stats struct {
|
|
Filtered bool
|
|
MinTime int64
|
|
MaxTime int64
|
|
Samples uint64
|
|
Series uint64
|
|
Blocks int
|
|
SkippedBlocks int
|
|
}
|
|
|
|
func (s Stats) String() string {
|
|
str := fmt.Sprintf("Prometheus snapshot stats:\n"+
|
|
" blocks found: %d;\n"+
|
|
" blocks skipped by time filter: %d;\n"+
|
|
" min time: %d (%v);\n"+
|
|
" max time: %d (%v);\n"+
|
|
" samples: %d;\n"+
|
|
" series: %d.",
|
|
s.Blocks, s.SkippedBlocks,
|
|
s.MinTime, time.Unix(s.MinTime/1e3, 0).Format(time.RFC3339),
|
|
s.MaxTime, time.Unix(s.MaxTime/1e3, 0).Format(time.RFC3339),
|
|
s.Samples, s.Series)
|
|
|
|
if s.Filtered {
|
|
str += "\n* Stats numbers are based on blocks meta info and don't account for applied filters."
|
|
}
|
|
|
|
return str
|
|
}
|