Skip to content
Snippets Groups Projects
Unverified Commit 88367576 authored by capossele's avatar capossele
Browse files

Merge branch 'feat/prometheus' into prometheus_metrics

parents 769b969b b8331022
Branches
No related tags found
No related merge requests found
......@@ -7,7 +7,6 @@ import (
var (
infoApp *prometheus.GaugeVec
infoTips prometheus.Gauge
)
func init() {
......@@ -18,18 +17,5 @@ func init() {
},
[]string{"name", "version"},
)
infoTips = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "iota_info_tips",
Help: "Number of tips.",
})
infoApp.WithLabelValues(banner.AppName, banner.AppVersion).Set(1)
registry.MustRegister(infoApp)
registry.MustRegister(infoTips)
addCollect(collectInfo)
}
func collectInfo() {
// Tips
infoTips.Set(0)
}
package prometheus
import (
"github.com/iotaledger/goshimmer/dapps/valuetransfers"
"github.com/iotaledger/goshimmer/plugins/messagelayer"
"github.com/iotaledger/goshimmer/plugins/metrics"
"github.com/prometheus/client_golang/prometheus"
)
var (
messagesPerSecond prometheus.Gauge
infoMessageTips prometheus.Gauge
infoValueTips prometheus.Gauge
)
func init() {
messagesPerSecond = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "iota_messages_per_second",
Help: "Number of messages per second.",
})
infoMessageTips = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "iota_info_message_tips",
Help: "Number of message tips.",
})
infoValueTips = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "iota_info_value_tips",
Help: "Number of value tips.",
})
registry.MustRegister(messagesPerSecond)
registry.MustRegister(infoApp)
registry.MustRegister(infoMessageTips)
addCollect(collectMetrics)
}
func collectMetrics() {
// MPS
messagesPerSecond.Set(float64(metrics.ReceivedMessagesPerSecond()))
// Tips
infoMessageTips.Set(float64(messagelayer.TipSelector.TipCount()))
infoValueTips.Set(float64(valuetransfers.TipManager().Size()))
}
......@@ -16,7 +16,7 @@ const (
)
func init() {
flag.String(CfgPrometheusBindAddress, "localhost:9311", "the bind address on which the Prometheus exporter listens on")
flag.String(CfgPrometheusBindAddress, "0.0.0.0:9311", "the bind address on which the Prometheus exporter listens on")
flag.Bool(CfgPrometheusGoMetrics, false, "include go metrics")
flag.Bool(CfgPrometheusProcessMetrics, false, "include process metrics")
flag.Bool(CfgPrometheusPromhttpMetrics, false, "include promhttp metrics")
......
......@@ -71,7 +71,7 @@ services:
image: prom/prometheus:latest
container_name: prometheus
ports:
- "127.0.0.1:9090:9090/tcp"
- 9090:9090
command:
- --config.file=/etc/prometheus/prometheus.yml
volumes:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment