forked from TrueCloudLab/frostfs-node
[#451] metrics: Move to internal
`metrics` don't look like something others want to import. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
11a38a0a84
commit
81ea91de52
35 changed files with 14 additions and 14 deletions
118
internal/metrics/node.go
Normal file
118
internal/metrics/node.go
Normal file
|
@ -0,0 +1,118 @@
|
|||
package metrics
|
||||
|
||||
import (
|
||||
morphmetrics "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/metrics"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-observability/metrics"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
type NodeMetrics struct {
|
||||
engine *engineMetrics
|
||||
state *stateMetrics
|
||||
replicator *replicatorMetrics
|
||||
objectService *objectServiceMetrics
|
||||
treeService *treeServiceMetrics
|
||||
epoch prometheus.Gauge
|
||||
fstree *fstreeMetrics
|
||||
blobstore *blobstoreMetrics
|
||||
blobobvnizca *blobovnicza
|
||||
metabase *metabaseMetrics
|
||||
pilorama *piloramaMetrics
|
||||
grpc *grpcServerMetrics
|
||||
policer *policerMetrics
|
||||
morphClient *morphClientMetrics
|
||||
morphCache *morphCacheMetrics
|
||||
log logger.LogMetrics
|
||||
}
|
||||
|
||||
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(),
|
||||
blobobvnizca: newBlobovnicza(),
|
||||
metabase: newMetabaseMetrics(),
|
||||
pilorama: newPiloramaMetrics(),
|
||||
grpc: newGrpcServerMetrics(),
|
||||
policer: newPolicerMetrics(),
|
||||
morphClient: newMorphClientMetrics(),
|
||||
morphCache: newMorphCacheMetrics(namespace),
|
||||
log: logger.NewLogMetrics(namespace),
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
func (m *NodeMetrics) BlobobvnizcaTreeMetrics() BlobobvnizcaMetrics {
|
||||
return m.blobobvnizca
|
||||
}
|
||||
|
||||
func (m *NodeMetrics) MetabaseMetrics() MetabaseMetrics {
|
||||
return m.metabase
|
||||
}
|
||||
|
||||
func (m *NodeMetrics) PiloramaMetrics() PiloramaMetrics {
|
||||
return m.pilorama
|
||||
}
|
||||
|
||||
func (m *NodeMetrics) GrpcServerMetrics() GrpcServerMetrics {
|
||||
return m.grpc
|
||||
}
|
||||
|
||||
func (m *NodeMetrics) PolicerMetrics() PolicerMetrics {
|
||||
return m.policer
|
||||
}
|
||||
|
||||
func (m *NodeMetrics) MorphClientMetrics() morphmetrics.Register {
|
||||
return m.morphClient
|
||||
}
|
||||
|
||||
func (m *NodeMetrics) MorphCacheMetrics() MorphCacheMetrics {
|
||||
return m.morphCache
|
||||
}
|
||||
|
||||
func (m *NodeMetrics) LogMetrics() logger.LogMetrics {
|
||||
return m.log
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue