Browse Source

feat:add filer metric inFlightDataSize(#6017)

Signed-off-by: Lycopene <fqhslycopene@gmail.com>
pull/6037/head
Lycopene 3 months ago
parent
commit
691626a037
  1. 1
      weed/server/filer_server.go
  2. 20
      weed/server/filer_server_metric.go
  3. 9
      weed/stats/metrics.go

1
weed/server/filer_server.go

@ -159,6 +159,7 @@ func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption)
fs.checkWithMaster() fs.checkWithMaster()
go stats.LoopPushingMetric("filer", string(fs.option.Host), fs.metricsAddress, fs.metricsIntervalSec) go stats.LoopPushingMetric("filer", string(fs.option.Host), fs.metricsAddress, fs.metricsIntervalSec)
go fs.loopUpdateMetric()
go fs.filer.KeepMasterClientConnected(context.Background()) go fs.filer.KeepMasterClientConnected(context.Background())
if !util.LoadConfiguration("filer", false) { if !util.LoadConfiguration("filer", false) {

20
weed/server/filer_server_metric.go

@ -0,0 +1,20 @@
package weed_server
import (
"sync/atomic"
"time"
"github.com/seaweedfs/seaweedfs/weed/stats"
)
func (fs *FilerServer) loopUpdateMetric() {
ticker := time.NewTicker(time.Second)
defer ticker.Stop()
for range ticker.C {
inFlightDataSize := atomic.LoadInt64(&fs.inFlightDataSize)
stats.FilerInFlightDataSizeGauge.Set(float64(inFlightDataSize))
}
}

9
weed/stats/metrics.go

@ -135,6 +135,14 @@ var (
Help: "The last send timestamp of the filer subscription.", Help: "The last send timestamp of the filer subscription.",
}, []string{"sourceFiler", "clientName", "path"}) }, []string{"sourceFiler", "clientName", "path"})
FilerInFlightDataSizeGauge = prometheus.NewGauge(
prometheus.GaugeOpts{
Namespace: Namespace,
Subsystem: "filer",
Name: "in_flight_data_size",
Help: "",
})
FilerStoreCounter = prometheus.NewCounterVec( FilerStoreCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Namespace: Namespace, Namespace: Namespace,
@ -299,6 +307,7 @@ func init() {
Gather.MustRegister(FilerStoreHistogram) Gather.MustRegister(FilerStoreHistogram)
Gather.MustRegister(FilerSyncOffsetGauge) Gather.MustRegister(FilerSyncOffsetGauge)
Gather.MustRegister(FilerServerLastSendTsOfSubscribeGauge) Gather.MustRegister(FilerServerLastSendTsOfSubscribeGauge)
Gather.MustRegister(FilerInFlightDataSizeGauge)
Gather.MustRegister(collectors.NewGoCollector()) Gather.MustRegister(collectors.NewGoCollector())
Gather.MustRegister(collectors.NewProcessCollector(collectors.ProcessCollectorOpts{})) Gather.MustRegister(collectors.NewProcessCollector(collectors.ProcessCollectorOpts{}))

Loading…
Cancel
Save