mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-04-05 20:52:50 +08:00
adjust counters
This commit is contained in:
parent
d8ed73926d
commit
115558e5f5
@ -48,20 +48,20 @@ var (
|
|||||||
Buckets: prometheus.ExponentialBuckets(0.0001, 2, 24),
|
Buckets: prometheus.ExponentialBuckets(0.0001, 2, 24),
|
||||||
}, []string{"type"})
|
}, []string{"type"})
|
||||||
|
|
||||||
VolumeServerVolumeCounter = prometheus.NewGauge(
|
VolumeServerVolumeCounter = prometheus.NewGaugeVec(
|
||||||
prometheus.GaugeOpts{
|
prometheus.GaugeOpts{
|
||||||
Namespace: "SeaweedFS",
|
Namespace: "SeaweedFS",
|
||||||
Subsystem: "volumeServer",
|
Subsystem: "volumeServer",
|
||||||
Name: "volumes",
|
Name: "volumes",
|
||||||
Help: "Number of volumes.",
|
Help: "Number of volumes or shards.",
|
||||||
})
|
}, []string{"collection", "type"})
|
||||||
|
|
||||||
VolumeServerEcShardCounter = prometheus.NewGauge(
|
VolumeServerMaxVolumeCounter = prometheus.NewGauge(
|
||||||
prometheus.GaugeOpts{
|
prometheus.GaugeOpts{
|
||||||
Namespace: "SeaweedFS",
|
Namespace: "SeaweedFS",
|
||||||
Subsystem: "volumeServer",
|
Subsystem: "volumeServer",
|
||||||
Name: "ec_shards",
|
Name: "volumes",
|
||||||
Help: "Number of EC shards.",
|
Help: "Maximum number of volumes.",
|
||||||
})
|
})
|
||||||
|
|
||||||
VolumeServerDiskSizeGauge = prometheus.NewGaugeVec(
|
VolumeServerDiskSizeGauge = prometheus.NewGaugeVec(
|
||||||
@ -81,7 +81,7 @@ func init() {
|
|||||||
VolumeServerGather.MustRegister(VolumeServerRequestCounter)
|
VolumeServerGather.MustRegister(VolumeServerRequestCounter)
|
||||||
VolumeServerGather.MustRegister(VolumeServerRequestHistogram)
|
VolumeServerGather.MustRegister(VolumeServerRequestHistogram)
|
||||||
VolumeServerGather.MustRegister(VolumeServerVolumeCounter)
|
VolumeServerGather.MustRegister(VolumeServerVolumeCounter)
|
||||||
VolumeServerGather.MustRegister(VolumeServerEcShardCounter)
|
VolumeServerGather.MustRegister(VolumeServerMaxVolumeCounter)
|
||||||
VolumeServerGather.MustRegister(VolumeServerDiskSizeGauge)
|
VolumeServerGather.MustRegister(VolumeServerDiskSizeGauge)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ func NewEcVolumeShard(dirname string, collection string, id needle.VolumeId, sha
|
|||||||
}
|
}
|
||||||
v.ecdFileSize = ecdFi.Size()
|
v.ecdFileSize = ecdFi.Size()
|
||||||
|
|
||||||
stats.VolumeServerEcShardCounter.Inc()
|
stats.VolumeServerVolumeCounter.WithLabelValues(v.Collection, "ec_shards").Inc()
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ func (shard *EcVolumeShard) Close() {
|
|||||||
|
|
||||||
func (shard *EcVolumeShard) Destroy() {
|
func (shard *EcVolumeShard) Destroy() {
|
||||||
os.Remove(shard.FileName() + ToExt(int(shard.ShardId)))
|
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) {
|
func (shard *EcVolumeShard) ReadAt(buf []byte, offset int64) (int, error) {
|
||||||
|
@ -49,6 +49,7 @@ func NewStore(grpcDialOption grpc.DialOption, port int, ip, publicUrl string, di
|
|||||||
location := NewDiskLocation(dirnames[i], maxVolumeCounts[i])
|
location := NewDiskLocation(dirnames[i], maxVolumeCounts[i])
|
||||||
location.loadExistingVolumes(needleMapKind)
|
location.loadExistingVolumes(needleMapKind)
|
||||||
s.Locations = append(s.Locations, location)
|
s.Locations = append(s.Locations, location)
|
||||||
|
stats.VolumeServerMaxVolumeCounter.Add(float64(maxVolumeCounts[i]))
|
||||||
}
|
}
|
||||||
s.NewVolumesChan = make(chan master_pb.VolumeShortInformationMessage, 3)
|
s.NewVolumesChan = make(chan master_pb.VolumeShortInformationMessage, 3)
|
||||||
s.DeletedVolumesChan = make(chan master_pb.VolumeShortInformationMessage, 3)
|
s.DeletedVolumesChan = make(chan master_pb.VolumeShortInformationMessage, 3)
|
||||||
|
@ -103,7 +103,7 @@ func (v *Volume) Close() {
|
|||||||
if v.dataFile != nil {
|
if v.dataFile != nil {
|
||||||
_ = v.dataFile.Close()
|
_ = v.dataFile.Close()
|
||||||
v.dataFile = nil
|
v.dataFile = nil
|
||||||
stats.VolumeServerVolumeCounter.Dec()
|
stats.VolumeServerVolumeCounter.WithLabelValues(v.Collection, "volume").Dec()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
return e
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ func (v *Volume) CommitCompact() error {
|
|||||||
glog.V(0).Infof("fail to close volume %d", v.Id)
|
glog.V(0).Infof("fail to close volume %d", v.Id)
|
||||||
}
|
}
|
||||||
v.dataFile = nil
|
v.dataFile = nil
|
||||||
stats.VolumeServerVolumeCounter.Dec()
|
stats.VolumeServerVolumeCounter.WithLabelValues(v.Collection, "volume").Inc()
|
||||||
|
|
||||||
var e error
|
var e error
|
||||||
if e = v.makeupDiff(v.FileName()+".cpd", v.FileName()+".cpx", v.FileName()+".dat", v.FileName()+".idx"); e != nil {
|
if e = v.makeupDiff(v.FileName()+".cpd", v.FileName()+".cpx", v.FileName()+".dat", v.FileName()+".idx"); e != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user