Add info metric #1202

Merged
fyrchik merged 2 commits from achuprov/frostfs-node:feat/info_metric into master 2024-06-27 12:02:58 +00:00
2 changed files with 24 additions and 0 deletions
Showing only changes of commit 406272d52d - Show all commits

View file

@ -0,0 +1,21 @@
package metrics
import (
"git.frostfs.info/TrueCloudLab/frostfs-observability/metrics"
"github.com/prometheus/client_golang/prometheus"
)
type ApplicationInfo struct {
versionValue *prometheus.GaugeVec
}
func NewApplicationInfo(version string) *ApplicationInfo {
appInfo := &ApplicationInfo{
versionValue: metrics.NewGaugeVec(prometheus.GaugeOpts{
Name: "app_info",
Help: "General information about the application.",
}, []string{"version"}),
}
appInfo.versionValue.With(prometheus.Labels{"version": version})
return appInfo
}

View file

@ -1,6 +1,7 @@
package metrics
import (
"git.frostfs.info/TrueCloudLab/frostfs-node/misc"
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"
@ -24,6 +25,7 @@ type NodeMetrics struct {
morphClient *morphClientMetrics
morphCache *morphCacheMetrics
log logger.LogMetrics
appInfo *ApplicationInfo
}
func NewNodeMetrics() *NodeMetrics {
@ -49,6 +51,7 @@ func NewNodeMetrics() *NodeMetrics {
morphClient: newMorphClientMetrics(),
morphCache: newMorphCacheMetrics(namespace),
log: logger.NewLogMetrics(namespace),
appInfo: NewApplicationInfo(misc.Version),
}
}