mirror of
https://github.com/openziti/zrok.git
synced 2024-11-22 16:13:47 +01:00
parent
044ba042aa
commit
8bd7991b2b
@ -141,8 +141,9 @@ func (mh *metricsHandler) run() {
|
||||
}
|
||||
mtr := &model.Metrics{}
|
||||
if err := bson.Unmarshal(mtrBuf.Bytes(), &mtr); err == nil {
|
||||
out := "metrics = {\n"
|
||||
var pts []*write.Point
|
||||
if len(mtr.Sessions) > 0 {
|
||||
out := "metrics = {\n"
|
||||
for k, v := range mtr.Sessions {
|
||||
if mh.writeApi != nil {
|
||||
pt := influxdb2.NewPoint("xfer",
|
||||
@ -151,10 +152,11 @@ func (mh *metricsHandler) run() {
|
||||
time.UnixMilli(v.LastUpdate))
|
||||
pts = append(pts, pt)
|
||||
}
|
||||
out += fmt.Sprintf("\t[%v.%v]: %v/%v\n", mtr.Namespace, k, util.BytesToSize(v.BytesRead), util.BytesToSize(v.BytesWritten))
|
||||
out += fmt.Sprintf("\t[%v.%v]: %v/%v (%v)\n", mtr.Namespace, k, util.BytesToSize(v.BytesRead), util.BytesToSize(v.BytesWritten), time.Since(time.UnixMilli(v.LastUpdate)))
|
||||
}
|
||||
out += "}"
|
||||
logrus.Info(out)
|
||||
}
|
||||
|
||||
if len(pts) > 0 {
|
||||
if err := mh.writeApi.WritePoint(context.Background(), pts...); err == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user