mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-01 14:47:38 +00:00
25e54d2b50
add progress bars to the VM importer The new progress bars supposed to display the processing speed per each VM importer worker. This info should help to identify if there is a bottleneck on the VM side during the import process, without waiting for its finish. The new progress bars can be disabled by passing `vm-disable-progress-bar` flag. Plotting multiple progress bars requires using experimental progress bar pool from github.com/cheggaaa/pb/v3. Switch to progress bar pool required changes in all import modes. The openTSDB mode wasn't changed due to its implementation, which implies individual progress bars per each series. Because of this, using the pool wasn't possible. Signed-off-by: dmitryk-dk <kozlovdmitriyy@gmail.com> Co-authored-by: hagen1778 <roman@victoriametrics.com>
26 lines
683 B
Go
26 lines
683 B
Go
// Package barpool provides access to the global
|
|
// pool of progress bars, so they could be rendered
|
|
// altogether.
|
|
package barpool
|
|
|
|
import "github.com/cheggaaa/pb/v3"
|
|
|
|
var pool = pb.NewPool()
|
|
|
|
// Add adds bar to the global pool
|
|
func Add(bar *pb.ProgressBar) { pool.Add(bar) }
|
|
|
|
// Start starts the global pool
|
|
// Must be called after all progress bars were added
|
|
func Start() error { return pool.Start() }
|
|
|
|
// Stop stops the global pool
|
|
func Stop() { _ = pool.Stop() }
|
|
|
|
// AddWithTemplate adds bar with the given template
|
|
// to the global pool
|
|
func AddWithTemplate(format string, total int) *pb.ProgressBar {
|
|
bar := pb.ProgressBarTemplate(format).New(total)
|
|
Add(bar)
|
|
return bar
|
|
}
|