diff --git a/plugins/prometheus/metrics.go b/plugins/prometheus/metrics.go deleted file mode 100644 index 5aa8a7d1a5ec5f368ecad502392e2397cd61f922..0000000000000000000000000000000000000000 --- a/plugins/prometheus/metrics.go +++ /dev/null @@ -1,22 +0,0 @@ -package prometheus - -import ( - "github.com/iotaledger/goshimmer/plugins/config" - "github.com/iotaledger/goshimmer/plugins/metrics" -) - -func init() { - if config.Node.GetBool(metrics.CfgMetricsLocal) { - registerAutopeeringMetrics() - registerDataMetrics() - registerFPCMetrics() - registerInfoMetrics() - registerNetworkMetrics() - registerProcessMetrics() - registerTangleMetrics() - } - - if config.Node.GetBool(metrics.CfgMetricsGlobal) { - registerClientsMetrics() - } -} diff --git a/plugins/prometheus/plugin.go b/plugins/prometheus/plugin.go index 893e4c902aee53d5a0f78b35e1d6f724ca766e77..8e14c1132c6aae2629168b1faaaa6d340346ac95 100644 --- a/plugins/prometheus/plugin.go +++ b/plugins/prometheus/plugin.go @@ -8,6 +8,7 @@ import ( "github.com/gin-gonic/gin" "github.com/iotaledger/goshimmer/packages/shutdown" "github.com/iotaledger/goshimmer/plugins/config" + "github.com/iotaledger/goshimmer/plugins/metrics" "github.com/iotaledger/hive.go/daemon" "github.com/iotaledger/hive.go/logger" "github.com/iotaledger/hive.go/node" @@ -34,6 +35,20 @@ func configure(plugin *node.Plugin) { if config.Node.GetBool(CfgPrometheusProcessMetrics) { registry.MustRegister(prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{})) } + + if config.Node.GetBool(metrics.CfgMetricsLocal) { + registerAutopeeringMetrics() + registerDataMetrics() + registerFPCMetrics() + registerInfoMetrics() + registerNetworkMetrics() + registerProcessMetrics() + registerTangleMetrics() + } + + if config.Node.GetBool(metrics.CfgMetricsGlobal) { + registerClientsMetrics() + } } func addCollect(collect func()) { diff --git a/tools/docker-network/docker-compose.yml b/tools/docker-network/docker-compose.yml index 6763e418290636db94f0ea3f7fa046d688729969..6c71a3a658848e6caf6cb797d65ce8ee9aeed717 100644 --- a/tools/docker-network/docker-compose.yml +++ b/tools/docker-network/docker-compose.yml @@ -22,16 +22,18 @@ services: --autopeering.entryNodes= --analysis.server.bindAddress=0.0.0.0:1888 --analysis.dashboard.bindAddress=0.0.0.0:9000 - --node.enablePlugins=analysis-server,analysis-dashboard + --node.enablePlugins=analysis-server,analysis-dashboard,prometheus --analysis.dashboard.dev=false --metrics.local=false --metrics.global=true + --prometheus.bindAddress=0.0.0.0:9312 --node.disablePlugins=portcheck,dashboard,analysis-client,gossip,drng,issuer,sync,messagelayer,valuetransfers,webapi,webapibroadcastdataendpoint,webapifindtransactionhashesendpoint,webapigetneighborsendpoint,webapigettransactionobjectsbyhashendpoint,webapigettransactiontrytesbyhashendpoint volumes: - ./config.docker.json:/tmp/config.json:ro - goshimmer-cache:/go ports: - "127.0.0.1:9000:9000/tcp" # analysis dashboard + - "127.0.0.1:9312:9312/tcp" # prometheus expose: - "1888/tcp" # analysis server (within Docker network) diff --git a/tools/docker-network/prometheus.yml b/tools/docker-network/prometheus.yml index f6fa09fdb6fcc69b0f4caa0686ee5fcd09e30992..3185565acdaaa4afbb39321577cd1fa098dabc78 100644 --- a/tools/docker-network/prometheus.yml +++ b/tools/docker-network/prometheus.yml @@ -3,4 +3,5 @@ scrape_configs: scrape_interval: 5s static_configs: - targets: - - peer_master:9311 \ No newline at end of file + - peer_master:9311 + - entry_node:9312 \ No newline at end of file