2021-03-16 08:14:56 +00:00
|
|
|
package metrics
|
|
|
|
|
2023-05-24 07:01:50 +00:00
|
|
|
import (
|
2023-05-31 09:25:32 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-observability/metrics"
|
2023-05-24 07:01:50 +00:00
|
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
|
|
)
|
2021-12-28 10:39:42 +00:00
|
|
|
|
2022-12-23 17:35:35 +00:00
|
|
|
const namespace = "frostfs_node"
|
2021-03-16 08:14:56 +00:00
|
|
|
|
2022-07-19 15:16:42 +00:00
|
|
|
type NodeMetrics struct {
|
2023-06-14 07:05:51 +00:00
|
|
|
engine *engineMetrics
|
|
|
|
state *stateMetrics
|
|
|
|
replicator *replicatorMetrics
|
|
|
|
objectService *objectServiceMetrics
|
|
|
|
treeService *treeServiceMetrics
|
|
|
|
epoch prometheus.Gauge
|
2023-06-07 14:06:02 +00:00
|
|
|
fstree *fstreeMetrics
|
2021-03-16 08:14:56 +00:00
|
|
|
}
|
|
|
|
|
2022-07-19 15:16:42 +00:00
|
|
|
func NewNodeMetrics() *NodeMetrics {
|
2021-03-16 08:14:56 +00:00
|
|
|
objectService := newObjectServiceMetrics()
|
|
|
|
|
|
|
|
engine := newEngineMetrics()
|
|
|
|
|
2022-07-19 15:16:42 +00:00
|
|
|
state := newStateMetrics()
|
|
|
|
|
2023-05-12 08:44:21 +00:00
|
|
|
replicator := newReplicatorMetrics()
|
|
|
|
|
2023-05-24 07:01:50 +00:00
|
|
|
treeService := newTreeServiceMetrics()
|
|
|
|
|
2023-05-31 09:25:32 +00:00
|
|
|
epoch := metrics.NewGauge(prometheus.GaugeOpts{
|
2021-12-28 10:39:42 +00:00
|
|
|
Namespace: namespace,
|
|
|
|
Subsystem: innerRingSubsystem,
|
|
|
|
Name: "epoch",
|
|
|
|
Help: "Current epoch as seen by inner-ring node.",
|
|
|
|
})
|
|
|
|
|
2022-07-19 15:16:42 +00:00
|
|
|
return &NodeMetrics{
|
2023-06-14 07:05:51 +00:00
|
|
|
objectService: objectService,
|
|
|
|
engine: engine,
|
|
|
|
state: state,
|
|
|
|
replicator: replicator,
|
|
|
|
treeService: treeService,
|
|
|
|
epoch: epoch,
|
2023-06-07 14:06:02 +00:00
|
|
|
fstree: newFSTreeMetrics(),
|
2021-03-16 08:14:56 +00:00
|
|
|
}
|
|
|
|
}
|
2021-12-28 10:39:42 +00:00
|
|
|
|
|
|
|
// SetEpoch updates epoch metric.
|
2022-07-19 15:16:42 +00:00
|
|
|
func (m *NodeMetrics) SetEpoch(epoch uint64) {
|
2023-05-31 09:25:32 +00:00
|
|
|
m.epoch.Set(float64(epoch))
|
2021-12-28 10:39:42 +00:00
|
|
|
}
|
2023-05-19 08:17:19 +00:00
|
|
|
|
2023-05-26 09:15:50 +00:00
|
|
|
func (m *NodeMetrics) TreeService() TreeMetricsRegister {
|
2023-05-24 07:01:50 +00:00
|
|
|
return m.treeService
|
|
|
|
}
|
2023-05-29 14:32:13 +00:00
|
|
|
|
2023-06-14 07:05:51 +00:00
|
|
|
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
|
2023-05-29 14:32:13 +00:00
|
|
|
}
|
2023-06-07 14:06:02 +00:00
|
|
|
|
|
|
|
func (m *NodeMetrics) FSTree() FSTreeMetrics {
|
|
|
|
return m.fstree
|
|
|
|
}
|