storagenode: add bandwidth metrics (#3623)

* storagenode: add bandwidth metrics

* remove unecessary metric
This commit is contained in:
Rafael Antonio Ribeiro Gomes 2019-11-21 16:51:40 -03:00 committed by GitHub
parent 976881f72b
commit 2739771761
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -63,3 +63,5 @@ storj.io/storj/satellite/satellitedb."audit_reputation_alpha" FloatVal
storj.io/storj/satellite/satellitedb."audit_reputation_beta" FloatVal
storj.io/storj/storagenode/contact."satellite_contact_request" Meter
storj.io/storj/storagenode/gracefulexit."satellite_gracefulexit_request" Meter
storj.io/storj/storagenode/monitor."allocated_bandwidth" IntVal
storj.io/storj/storagenode/monitor."used_bandwidth" IntVal

View File

@ -197,5 +197,9 @@ func (service *Service) AvailableBandwidth(ctx context.Context) (_ int64, err er
return 0, Error.Wrap(err)
}
allocatedBandwidth := service.allocatedBandwidth
mon.IntVal("allocated_bandwidth").Observe(allocatedBandwidth) //locked
mon.IntVal("used_bandwidth").Observe(usage) //locked
return allocatedBandwidth - usage, nil
}