forked from TrueCloudLab/frostfs-node
70 lines
1.6 KiB
Go
70 lines
1.6 KiB
Go
package metrics
|
|
|
|
import (
|
|
"git.frostfs.info/TrueCloudLab/frostfs-observability/metrics"
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
)
|
|
|
|
const namespace = "frostfs_node"
|
|
|
|
type NodeMetrics struct {
|
|
engine *engineMetrics
|
|
state *stateMetrics
|
|
replicator *replicatorMetrics
|
|
objectService *objectServiceMetrics
|
|
treeService *treeServiceMetrics
|
|
epoch prometheus.Gauge
|
|
fstree *fstreeMetrics
|
|
blobstore *blobstoreMetrics
|
|
}
|
|
|
|
func NewNodeMetrics() *NodeMetrics {
|
|
return &NodeMetrics{
|
|
objectService: newObjectServiceMetrics(),
|
|
engine: newEngineMetrics(),
|
|
state: newStateMetrics(),
|
|
replicator: newReplicatorMetrics(),
|
|
treeService: newTreeServiceMetrics(),
|
|
epoch: metrics.NewGauge(prometheus.GaugeOpts{
|
|
Namespace: namespace,
|
|
Subsystem: innerRingSubsystem,
|
|
Name: "epoch",
|
|
Help: "Current epoch as seen by inner-ring node.",
|
|
}),
|
|
fstree: newFSTreeMetrics(),
|
|
blobstore: newBlobstoreMetrics(),
|
|
}
|
|
}
|
|
|
|
// SetEpoch updates epoch metric.
|
|
func (m *NodeMetrics) SetEpoch(epoch uint64) {
|
|
m.epoch.Set(float64(epoch))
|
|
}
|
|
|
|
func (m *NodeMetrics) TreeService() TreeMetricsRegister {
|
|
return m.treeService
|
|
}
|
|
|
|
func (m *NodeMetrics) Replicator() ReplicatorMetrics {
|
|
return m.replicator
|
|
}
|
|
|
|
func (m *NodeMetrics) ObjectService() ObjectServiceMetrics {
|
|
return m.objectService
|
|
}
|
|
|
|
func (m *NodeMetrics) Engine() EngineMetrics {
|
|
return m.engine
|
|
}
|
|
|
|
func (m *NodeMetrics) State() StateMetrics {
|
|
return m.state
|
|
}
|
|
|
|
func (m *NodeMetrics) FSTree() FSTreeMetrics {
|
|
return m.fstree
|
|
}
|
|
|
|
func (m *NodeMetrics) Blobstore() BlobstoreMetrics {
|
|
return m.blobstore
|
|
}
|