Skip to content
Snippets Groups Projects
Unverified Commit 4fd9c750 authored by Levente Pap's avatar Levente Pap
Browse files

Export nodeID via prometheus

parent b522e4a1
Branches
No related tags found
No related merge requests found
package prometheus package prometheus
import ( import (
"github.com/iotaledger/goshimmer/plugins/autopeering/local"
"github.com/iotaledger/goshimmer/plugins/banner" "github.com/iotaledger/goshimmer/plugins/banner"
"github.com/iotaledger/goshimmer/plugins/metrics" "github.com/iotaledger/goshimmer/plugins/metrics"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
...@@ -9,6 +10,7 @@ import ( ...@@ -9,6 +10,7 @@ import (
var ( var (
infoApp *prometheus.GaugeVec infoApp *prometheus.GaugeVec
sync prometheus.Gauge sync prometheus.Gauge
nodeID string
) )
func registerInfoMetrics() { func registerInfoMetrics() {
...@@ -17,9 +19,12 @@ func registerInfoMetrics() { ...@@ -17,9 +19,12 @@ func registerInfoMetrics() {
Name: "iota_info_app", Name: "iota_info_app",
Help: "Node software name and version.", Help: "Node software name and version.",
}, },
[]string{"name", "version"}, []string{"name", "version", "nodeID"},
) )
infoApp.WithLabelValues(banner.AppName, banner.AppVersion).Set(1) if local.GetInstance() != nil {
nodeID = local.GetInstance().ID().String()
}
infoApp.WithLabelValues(banner.AppName, banner.AppVersion, nodeID).Set(1)
sync = prometheus.NewGauge(prometheus.GaugeOpts{ sync = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "sync", Name: "sync",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment