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
|
2023-06-07 15:04:23 +00:00
|
|
|
blobstore *blobstoreMetrics
|
2023-06-09 09:14:32 +00:00
|
|
|
blobobvnizca *blobovnizca
|
2023-06-09 09:45:31 +00:00
|
|
|
metabase *metabaseMetrics
|
2023-06-09 13:19:47 +00:00
|
|
|
pilorama *piloramaMetrics
|
2021-03-16 08:14:56 +00:00
|
|
|
}
|
|
|
|
|
2022-07-19 15:16:42 +00:00
|
|
|
func NewNodeMetrics() *NodeMetrics {
|
|
|
|
return &NodeMetrics{
|
2023-06-07 15:04:23 +00:00
|
|
|
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.",
|
|
|
|
}),
|
2023-06-09 09:14:32 +00:00
|
|
|
fstree: newFSTreeMetrics(),
|
|
|
|
blobstore: newBlobstoreMetrics(),
|
|
|
|
blobobvnizca: newBlobovnizca(),
|
2023-06-09 09:45:31 +00:00
|
|
|
metabase: newMetabaseMetrics(),
|
2023-06-09 13:19:47 +00:00
|
|
|
pilorama: newPiloramaMetrics(),
|
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
|
|
|
|
}
|
2023-06-07 15:04:23 +00:00
|
|
|
|
|
|
|
func (m *NodeMetrics) Blobstore() BlobstoreMetrics {
|
|
|
|
return m.blobstore
|
|
|
|
}
|
2023-06-09 09:14:32 +00:00
|
|
|
|
|
|
|
func (m *NodeMetrics) BlobobvnizcaTreeMetrics() BlobobvnizcaMetrics {
|
|
|
|
return m.blobobvnizca
|
|
|
|
}
|
2023-06-09 09:45:31 +00:00
|
|
|
|
|
|
|
func (m *NodeMetrics) MetabaseMetrics() MetabaseMetrics {
|
|
|
|
return m.metabase
|
|
|
|
}
|
2023-06-09 13:19:47 +00:00
|
|
|
|
|
|
|
func (m *NodeMetrics) PiloramaMetrics() PiloramaMetrics {
|
|
|
|
return m.pilorama
|
|
|
|
}
|