Skip to content
Snippets Groups Projects
info.go 1.01 KiB
Newer Older
	"github.com/iotaledger/goshimmer/plugins/autopeering/local"
	"github.com/iotaledger/goshimmer/plugins/banner"
	"github.com/iotaledger/goshimmer/plugins/metrics"
	"github.com/prometheus/client_golang/prometheus"
)

var (
	infoApp    *prometheus.GaugeVec
	syncStatus prometheus.Gauge
	nodeID     string
)

func registerInfoMetrics() {
	infoApp = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "iota_info_app",
			Help: "Node software name and version.",
		},
		[]string{"name", "version", "nodeID"},
	if local.GetInstance() != nil {
		nodeID = local.GetInstance().ID().String()
	}
	infoApp.WithLabelValues(banner.AppName, banner.AppVersion, nodeID).Set(1)
	syncStatus = prometheus.NewGauge(prometheus.GaugeOpts{
		Name: "sync",
		Help: "Node sync status.",
	})

	registry.MustRegister(infoApp)

	addCollect(collectInfoMetrics)
}

func collectInfoMetrics() {