2021-03-16 08:14:56 +00:00
|
|
|
package metrics
|
|
|
|
|
2023-05-24 07:01:50 +00:00
|
|
|
import (
|
2024-06-26 11:46:32 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/misc"
|
2023-10-04 07:03:37 +00:00
|
|
|
morphmetrics "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/metrics"
|
2023-10-08 09:32:00 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
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-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-08-18 08:14:10 +00:00
|
|
|
blobobvnizca *blobovnicza
|
2023-06-09 09:45:31 +00:00
|
|
|
metabase *metabaseMetrics
|
2023-06-09 13:19:47 +00:00
|
|
|
pilorama *piloramaMetrics
|
2023-08-09 06:23:03 +00:00
|
|
|
grpc *grpcServerMetrics
|
2023-10-04 16:20:59 +00:00
|
|
|
policer *policerMetrics
|
2023-10-04 07:03:37 +00:00
|
|
|
morphClient *morphClientMetrics
|
|
|
|
morphCache *morphCacheMetrics
|
2023-10-08 09:32:00 +00:00
|
|
|
log logger.LogMetrics
|
2024-06-26 11:46:32 +00:00
|
|
|
appInfo *ApplicationInfo
|
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(),
|
2023-08-18 08:14:10 +00:00
|
|
|
blobobvnizca: newBlobovnicza(),
|
2023-06-09 09:45:31 +00:00
|
|
|
metabase: newMetabaseMetrics(),
|
2023-06-09 13:19:47 +00:00
|
|
|
pilorama: newPiloramaMetrics(),
|
2023-08-09 06:23:03 +00:00
|
|
|
grpc: newGrpcServerMetrics(),
|
2023-10-04 16:20:59 +00:00
|
|
|
policer: newPolicerMetrics(),
|
2023-10-04 07:03:37 +00:00
|
|
|
morphClient: newMorphClientMetrics(),
|
|
|
|
morphCache: newMorphCacheMetrics(namespace),
|
2023-10-08 09:32:00 +00:00
|
|
|
log: logger.NewLogMetrics(namespace),
|
2024-06-26 11:46:32 +00:00
|
|
|
appInfo: NewApplicationInfo(misc.Version),
|
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
|
|
|
|
}
|
2023-08-09 06:23:03 +00:00
|
|
|
|
|
|
|
func (m *NodeMetrics) GrpcServerMetrics() GrpcServerMetrics {
|
|
|
|
return m.grpc
|
|
|
|
}
|
2023-10-04 16:20:59 +00:00
|
|
|
|
|
|
|
func (m *NodeMetrics) PolicerMetrics() PolicerMetrics {
|
|
|
|
return m.policer
|
|
|
|
}
|
2023-10-04 07:03:37 +00:00
|
|
|
|
|
|
|
func (m *NodeMetrics) MorphClientMetrics() morphmetrics.Register {
|
|
|
|
return m.morphClient
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *NodeMetrics) MorphCacheMetrics() MorphCacheMetrics {
|
|
|
|
return m.morphCache
|
|
|
|
}
|
2023-10-08 09:32:00 +00:00
|
|
|
|
|
|
|
func (m *NodeMetrics) LogMetrics() logger.LogMetrics {
|
|
|
|
return m.log
|
|
|
|
}
|