aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2019-06-17 21:02:50 -0700
committerChris Lu <chris.lu@gmail.com>2019-06-17 21:02:50 -0700
commit115558e5f529f119ca4ba60a45a28fc7bb8d25ae (patch)
treeef3a686e61f4b6e3705109e1f0acb8d051474114
parentd8ed73926dc79aaea57e9eb305c718e82dace64c (diff)
downloadseaweedfs-115558e5f529f119ca4ba60a45a28fc7bb8d25ae.tar.xz
seaweedfs-115558e5f529f119ca4ba60a45a28fc7bb8d25ae.zip
adjust counters
-rw-r--r--weed/stats/metrics.go14
-rw-r--r--weed/storage/erasure_coding/ec_shard.go4
-rw-r--r--weed/storage/store.go1
-rw-r--r--weed/storage/volume.go2
-rw-r--r--weed/storage/volume_loading.go2
-rw-r--r--weed/storage/volume_vacuum.go2
6 files changed, 13 insertions, 12 deletions
diff --git a/weed/stats/metrics.go b/weed/stats/metrics.go
index 2912bd34e..4147fd067 100644
--- a/weed/stats/metrics.go
+++ b/weed/stats/metrics.go
@@ -48,20 +48,20 @@ var (
Buckets: prometheus.ExponentialBuckets(0.0001, 2, 24),
}, []string{"type"})
- VolumeServerVolumeCounter = prometheus.NewGauge(
+ VolumeServerVolumeCounter = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: "SeaweedFS",
Subsystem: "volumeServer",
Name: "volumes",
- Help: "Number of volumes.",
- })
+ Help: "Number of volumes or shards.",
+ }, []string{"collection", "type"})
- VolumeServerEcShardCounter = prometheus.NewGauge(
+ VolumeServerMaxVolumeCounter = prometheus.NewGauge(
prometheus.GaugeOpts{
Namespace: "SeaweedFS",
Subsystem: "volumeServer",
- Name: "ec_shards",
- Help: "Number of EC shards.",
+ Name: "volumes",
+ Help: "Maximum number of volumes.",
})
VolumeServerDiskSizeGauge = prometheus.NewGaugeVec(
@@ -81,7 +81,7 @@ func init() {
VolumeServerGather.MustRegister(VolumeServerRequestCounter)
VolumeServerGather.MustRegister(VolumeServerRequestHistogram)
VolumeServerGather.MustRegister(VolumeServerVolumeCounter)
- VolumeServerGather.MustRegister(VolumeServerEcShardCounter)
+ VolumeServerGather.MustRegister(VolumeServerMaxVolumeCounter)
VolumeServerGather.MustRegister(VolumeServerDiskSizeGauge)
}
diff --git a/weed/storage/erasure_coding/ec_shard.go b/weed/storage/erasure_coding/ec_shard.go
index bcfa2c721..b280157b8 100644
--- a/weed/storage/erasure_coding/ec_shard.go
+++ b/weed/storage/erasure_coding/ec_shard.go
@@ -37,7 +37,7 @@ func NewEcVolumeShard(dirname string, collection string, id needle.VolumeId, sha
}
v.ecdFileSize = ecdFi.Size()
- stats.VolumeServerEcShardCounter.Inc()
+ stats.VolumeServerVolumeCounter.WithLabelValues(v.Collection, "ec_shards").Inc()
return
}
@@ -81,7 +81,7 @@ func (shard *EcVolumeShard) Close() {
func (shard *EcVolumeShard) Destroy() {
os.Remove(shard.FileName() + ToExt(int(shard.ShardId)))
- stats.VolumeServerEcShardCounter.Dec()
+ stats.VolumeServerVolumeCounter.WithLabelValues(shard.Collection, "ec_shards").Inc()
}
func (shard *EcVolumeShard) ReadAt(buf []byte, offset int64) (int, error) {
diff --git a/weed/storage/store.go b/weed/storage/store.go
index 2d8be7be3..7476de348 100644
--- a/weed/storage/store.go
+++ b/weed/storage/store.go
@@ -49,6 +49,7 @@ func NewStore(grpcDialOption grpc.DialOption, port int, ip, publicUrl string, di
location := NewDiskLocation(dirnames[i], maxVolumeCounts[i])
location.loadExistingVolumes(needleMapKind)
s.Locations = append(s.Locations, location)
+ stats.VolumeServerMaxVolumeCounter.Add(float64(maxVolumeCounts[i]))
}
s.NewVolumesChan = make(chan master_pb.VolumeShortInformationMessage, 3)
s.DeletedVolumesChan = make(chan master_pb.VolumeShortInformationMessage, 3)
diff --git a/weed/storage/volume.go b/weed/storage/volume.go
index f3d5b9922..a1d9d7e8d 100644
--- a/weed/storage/volume.go
+++ b/weed/storage/volume.go
@@ -103,7 +103,7 @@ func (v *Volume) Close() {
if v.dataFile != nil {
_ = v.dataFile.Close()
v.dataFile = nil
- stats.VolumeServerVolumeCounter.Dec()
+ stats.VolumeServerVolumeCounter.WithLabelValues(v.Collection, "volume").Dec()
}
}
diff --git a/weed/storage/volume_loading.go b/weed/storage/volume_loading.go
index 4c7b93418..ed1cfe124 100644
--- a/weed/storage/volume_loading.go
+++ b/weed/storage/volume_loading.go
@@ -117,7 +117,7 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind
}
}
- stats.VolumeServerVolumeCounter.Inc()
+ stats.VolumeServerVolumeCounter.WithLabelValues(v.Collection, "volume").Inc()
return e
}
diff --git a/weed/storage/volume_vacuum.go b/weed/storage/volume_vacuum.go
index 6e8d3a861..cc7c7d6e6 100644
--- a/weed/storage/volume_vacuum.go
+++ b/weed/storage/volume_vacuum.go
@@ -53,7 +53,7 @@ func (v *Volume) CommitCompact() error {
glog.V(0).Infof("fail to close volume %d", v.Id)
}
v.dataFile = nil
- stats.VolumeServerVolumeCounter.Dec()
+ stats.VolumeServerVolumeCounter.WithLabelValues(v.Collection, "volume").Inc()
var e error
if e = v.makeupDiff(v.FileName()+".cpd", v.FileName()+".cpx", v.FileName()+".dat", v.FileName()+".idx"); e != nil {