mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
remove all (currently existing) collection volume metrics
This commit is contained in:
parent
709c83716c
commit
47c72e6f35
|
@ -17,6 +17,16 @@ import (
|
||||||
"github.com/prometheus/client_golang/prometheus/push"
|
"github.com/prometheus/client_golang/prometheus/push"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Readonly volume types
|
||||||
|
const (
|
||||||
|
IsReadOnly = "IsReadOnly"
|
||||||
|
NoWriteOrDelete = "noWriteOrDelete"
|
||||||
|
NoWriteCanDelete = "noWriteCanDelete"
|
||||||
|
IsDiskSpaceLow = "isDiskSpaceLow"
|
||||||
|
)
|
||||||
|
|
||||||
|
var readOnlyVolumeTypes = [4]string{IsReadOnly, NoWriteOrDelete, NoWriteCanDelete, IsDiskSpaceLow}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Gather = prometheus.NewRegistry()
|
Gather = prometheus.NewRegistry()
|
||||||
|
|
||||||
|
@ -249,3 +259,11 @@ func SourceName(port uint32) string {
|
||||||
}
|
}
|
||||||
return net.JoinHostPort(hostname, strconv.Itoa(int(port)))
|
return net.JoinHostPort(hostname, strconv.Itoa(int(port)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func DeleteCollectionMetrics(collection string) {
|
||||||
|
VolumeServerDiskSizeGauge.DeleteLabelValues(collection, "normal")
|
||||||
|
for _, volume_type := range readOnlyVolumeTypes {
|
||||||
|
VolumeServerReadOnlyVolumeGauge.DeleteLabelValues(collection, volume_type)
|
||||||
|
}
|
||||||
|
VolumeServerVolumeCounter.DeleteLabelValues(collection, "volume")
|
||||||
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ func (s *Store) DeleteCollection(collection string) (e error) {
|
||||||
if e != nil {
|
if e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
stats.VolumeServerDiskSizeGauge.DeleteLabelValues(collection, "normal")
|
stats.DeleteCollectionMetrics(collection)
|
||||||
// let the heartbeat send the list of volumes, instead of sending the deleted volume ids to DeletedVolumesChan
|
// let the heartbeat send the list of volumes, instead of sending the deleted volume ids to DeletedVolumesChan
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -272,22 +272,22 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
|
||||||
|
|
||||||
if _, exist := collectionVolumeReadOnlyCount[v.Collection]; !exist {
|
if _, exist := collectionVolumeReadOnlyCount[v.Collection]; !exist {
|
||||||
collectionVolumeReadOnlyCount[v.Collection] = map[string]uint8{
|
collectionVolumeReadOnlyCount[v.Collection] = map[string]uint8{
|
||||||
"IsReadOnly": 0,
|
stats.IsReadOnly: 0,
|
||||||
"noWriteOrDelete": 0,
|
stats.NoWriteOrDelete: 0,
|
||||||
"noWriteCanDelete": 0,
|
stats.NoWriteCanDelete: 0,
|
||||||
"isDiskSpaceLow": 0,
|
stats.IsDiskSpaceLow: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !shouldDeleteVolume && v.IsReadOnly() {
|
if !shouldDeleteVolume && v.IsReadOnly() {
|
||||||
collectionVolumeReadOnlyCount[v.Collection]["IsReadOnly"] += 1
|
collectionVolumeReadOnlyCount[v.Collection][stats.IsReadOnly] += 1
|
||||||
if v.noWriteOrDelete {
|
if v.noWriteOrDelete {
|
||||||
collectionVolumeReadOnlyCount[v.Collection]["noWriteOrDelete"] += 1
|
collectionVolumeReadOnlyCount[v.Collection][stats.NoWriteOrDelete] += 1
|
||||||
}
|
}
|
||||||
if v.noWriteCanDelete {
|
if v.noWriteCanDelete {
|
||||||
collectionVolumeReadOnlyCount[v.Collection]["noWriteCanDelete"] += 1
|
collectionVolumeReadOnlyCount[v.Collection][stats.NoWriteCanDelete] += 1
|
||||||
}
|
}
|
||||||
if v.location.isDiskSpaceLow {
|
if v.location.isDiskSpaceLow {
|
||||||
collectionVolumeReadOnlyCount[v.Collection]["isDiskSpaceLow"] += 1
|
collectionVolumeReadOnlyCount[v.Collection][stats.IsDiskSpaceLow] += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -459,6 +459,7 @@ func (s *Store) UnmountVolume(i needle.VolumeId) error {
|
||||||
err := location.UnloadVolume(i)
|
err := location.UnloadVolume(i)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
glog.V(0).Infof("UnmountVolume %d", i)
|
glog.V(0).Infof("UnmountVolume %d", i)
|
||||||
|
stats.DeleteCollectionMetrics(v.Collection)
|
||||||
s.DeletedVolumesChan <- message
|
s.DeletedVolumesChan <- message
|
||||||
return nil
|
return nil
|
||||||
} else if err == ErrVolumeNotFound {
|
} else if err == ErrVolumeNotFound {
|
||||||
|
|
Loading…
Reference in a new issue