mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
Merge pull request #1537 from kmlebedev/metric_read_only_volumes
add number of read only volumes to prometheus metrics
This commit is contained in:
commit
b03b51aea4
|
@ -77,6 +77,14 @@ var (
|
||||||
Help: "Number of volumes or shards.",
|
Help: "Number of volumes or shards.",
|
||||||
}, []string{"collection", "type"})
|
}, []string{"collection", "type"})
|
||||||
|
|
||||||
|
VolumeServerReadOnlyVolumeGauge = prometheus.NewGaugeVec(
|
||||||
|
prometheus.GaugeOpts{
|
||||||
|
Namespace: "SeaweedFS",
|
||||||
|
Subsystem: "volumeServer",
|
||||||
|
Name: "read_only_volumes",
|
||||||
|
Help: "Number of read only volumes.",
|
||||||
|
}, []string{"collection", "type"})
|
||||||
|
|
||||||
VolumeServerMaxVolumeCounter = prometheus.NewGauge(
|
VolumeServerMaxVolumeCounter = prometheus.NewGauge(
|
||||||
prometheus.GaugeOpts{
|
prometheus.GaugeOpts{
|
||||||
Namespace: "SeaweedFS",
|
Namespace: "SeaweedFS",
|
||||||
|
@ -122,6 +130,7 @@ func init() {
|
||||||
Gather.MustRegister(VolumeServerRequestHistogram)
|
Gather.MustRegister(VolumeServerRequestHistogram)
|
||||||
Gather.MustRegister(VolumeServerVolumeCounter)
|
Gather.MustRegister(VolumeServerVolumeCounter)
|
||||||
Gather.MustRegister(VolumeServerMaxVolumeCounter)
|
Gather.MustRegister(VolumeServerMaxVolumeCounter)
|
||||||
|
Gather.MustRegister(VolumeServerReadOnlyVolumeGauge)
|
||||||
Gather.MustRegister(VolumeServerDiskSizeGauge)
|
Gather.MustRegister(VolumeServerDiskSizeGauge)
|
||||||
|
|
||||||
Gather.MustRegister(S3RequestCounter)
|
Gather.MustRegister(S3RequestCounter)
|
||||||
|
|
|
@ -200,6 +200,7 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
|
||||||
maxVolumeCount := 0
|
maxVolumeCount := 0
|
||||||
var maxFileKey NeedleId
|
var maxFileKey NeedleId
|
||||||
collectionVolumeSize := make(map[string]uint64)
|
collectionVolumeSize := make(map[string]uint64)
|
||||||
|
collectionVolumeReadOnlyCount := make(map[string]uint8)
|
||||||
for _, location := range s.Locations {
|
for _, location := range s.Locations {
|
||||||
var deleteVids []needle.VolumeId
|
var deleteVids []needle.VolumeId
|
||||||
maxVolumeCount = maxVolumeCount + location.MaxVolumeCount
|
maxVolumeCount = maxVolumeCount + location.MaxVolumeCount
|
||||||
|
@ -219,6 +220,9 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
|
||||||
}
|
}
|
||||||
fileSize, _, _ := v.FileStat()
|
fileSize, _, _ := v.FileStat()
|
||||||
collectionVolumeSize[v.Collection] += fileSize
|
collectionVolumeSize[v.Collection] += fileSize
|
||||||
|
if v.IsReadOnly() {
|
||||||
|
collectionVolumeReadOnlyCount[v.Collection] += 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
location.volumesLock.RUnlock()
|
location.volumesLock.RUnlock()
|
||||||
|
|
||||||
|
@ -243,6 +247,10 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
|
||||||
stats.VolumeServerDiskSizeGauge.WithLabelValues(col, "normal").Set(float64(size))
|
stats.VolumeServerDiskSizeGauge.WithLabelValues(col, "normal").Set(float64(size))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for col, count := range collectionVolumeReadOnlyCount {
|
||||||
|
stats.VolumeServerReadOnlyVolumeGauge.WithLabelValues(col, "normal").Set(float64(count))
|
||||||
|
}
|
||||||
|
|
||||||
return &master_pb.Heartbeat{
|
return &master_pb.Heartbeat{
|
||||||
Ip: s.Ip,
|
Ip: s.Ip,
|
||||||
Port: uint32(s.Port),
|
Port: uint32(s.Port),
|
||||||
|
|
Loading…
Reference in a new issue