Add const for interval
parent
cbc551f9dc
commit
28ad7c687b
|
@ -13,6 +13,8 @@
|
||||||
- [#6519](https://github.com/influxdata/influxdb/issues/6519): Support cast syntax for selecting a specific type.
|
- [#6519](https://github.com/influxdata/influxdb/issues/6519): Support cast syntax for selecting a specific type.
|
||||||
- [#6654](https://github.com/influxdata/influxdb/pull/6654): Add new HTTP statistics to monitoring
|
- [#6654](https://github.com/influxdata/influxdb/pull/6654): Add new HTTP statistics to monitoring
|
||||||
|
|
||||||
|
- [#6664](https://github.com/influxdata/influxdb/pull/6664): Adds monitoring statistic for on-disk shard size.
|
||||||
|
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
|
|
||||||
- [#6604](https://github.com/influxdata/influxdb/pull/6604): Remove old cluster code
|
- [#6604](https://github.com/influxdata/influxdb/pull/6604): Remove old cluster code
|
||||||
|
|
|
@ -23,6 +23,10 @@ import (
|
||||||
internal "github.com/influxdata/influxdb/tsdb/internal"
|
internal "github.com/influxdata/influxdb/tsdb/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// monitorStatInterval is the interval at which the shard is inspected
|
||||||
|
// for the purpose of determining certain monitoring statistics.
|
||||||
|
const monitorStatInterval = 30 * time.Second
|
||||||
|
|
||||||
const (
|
const (
|
||||||
statWriteReq = "writeReq"
|
statWriteReq = "writeReq"
|
||||||
statSeriesCreate = "seriesCreate"
|
statSeriesCreate = "seriesCreate"
|
||||||
|
@ -228,9 +232,9 @@ func (s *Shard) closed() bool {
|
||||||
// DiskSize returns the size on disk of this shard
|
// DiskSize returns the size on disk of this shard
|
||||||
func (s *Shard) DiskSize() (int64, error) {
|
func (s *Shard) DiskSize() (int64, error) {
|
||||||
var size int64
|
var size int64
|
||||||
err := filepath.Walk(s.path, func(_ string, info os.FileInfo, err error) error {
|
err := filepath.Walk(s.path, func(_ string, fi os.FileInfo, err error) error {
|
||||||
if !info.IsDir() {
|
if !fi.IsDir() {
|
||||||
size += info.Size()
|
size += fi.Size()
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
@ -238,9 +242,9 @@ func (s *Shard) DiskSize() (int64, error) {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = filepath.Walk(s.walPath, func(_ string, info os.FileInfo, err error) error {
|
err = filepath.Walk(s.walPath, func(_ string, fi os.FileInfo, err error) error {
|
||||||
if !info.IsDir() {
|
if !fi.IsDir() {
|
||||||
size += info.Size()
|
size += fi.Size()
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
@ -606,7 +610,7 @@ func (s *Shard) CreateSnapshot() (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Shard) monitorSize() {
|
func (s *Shard) monitorSize() {
|
||||||
t := time.NewTicker(10 * time.Second)
|
t := time.NewTicker(monitorStatInterval)
|
||||||
defer t.Stop()
|
defer t.Stop()
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
|
@ -615,7 +619,7 @@ func (s *Shard) monitorSize() {
|
||||||
case <-t.C:
|
case <-t.C:
|
||||||
size, err := s.DiskSize()
|
size, err := s.DiskSize()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.logger.Printf("error collecting shard size: %v", err)
|
s.logger.Printf("Error collecting shard size: %v", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
sizeStat := new(expvar.Int)
|
sizeStat := new(expvar.Int)
|
||||||
|
|
Loading…
Reference in New Issue