From a615445b563cccdfd9b248644aa9013b6a452866 Mon Sep 17 00:00:00 2001 From: Levente Pap <levente.pap@iota.org> Date: Wed, 17 Jun 2020 09:56:17 +0200 Subject: [PATCH] Fixes after merge --- plugins/metrics/tps.go | 36 --------------------------- plugins/prometheus/local_metrics.go | 2 +- tools/integration-tests/tester/go.mod | 2 +- tools/integration-tests/tester/go.sum | 1 + 4 files changed, 3 insertions(+), 38 deletions(-) delete mode 100644 plugins/metrics/tps.go diff --git a/plugins/metrics/tps.go b/plugins/metrics/tps.go deleted file mode 100644 index a7448fa0..00000000 --- a/plugins/metrics/tps.go +++ /dev/null @@ -1,36 +0,0 @@ -package metrics - -import ( - "go.uber.org/atomic" -) - -// ReceivedMessagesPerSecond retrieves the current messages per second number. -func ReceivedMessagesPerSecond() uint64 { - return measuredReceivedMPS.Load() -} - -// counter for the received MPS -var mpsReceivedSinceLastMeasurement atomic.Uint64 - -// measured value of the received MPS -var measuredReceivedMPS atomic.Uint64 - -// increases the received MPS counter -func increaseReceivedMPSCounter() { - mpsReceivedSinceLastMeasurement.Add(1) -} - -// measures the received MPS value -func measureReceivedMPS() { - // sample the current counter value into a measured MPS value - sampledMPS := mpsReceivedSinceLastMeasurement.Load() - - // store the measured value - measuredReceivedMPS.Store(sampledMPS) - - // reset the counter - mpsReceivedSinceLastMeasurement.Store(0) - - // trigger events for outside listeners - Events.ReceivedMPSUpdated.Trigger(sampledMPS) -} diff --git a/plugins/prometheus/local_metrics.go b/plugins/prometheus/local_metrics.go index d2b4ee0e..16840b96 100644 --- a/plugins/prometheus/local_metrics.go +++ b/plugins/prometheus/local_metrics.go @@ -21,5 +21,5 @@ func init() { } func collectLocalMetrics() { - messagesPerSecond.Set(float64(metrics.ReceivedMessagesPerSecond())) + messagesPerSecond.Set(float64(metrics.MPS())) } diff --git a/tools/integration-tests/tester/go.mod b/tools/integration-tests/tester/go.mod index 81fe8f1d..315bbabd 100644 --- a/tools/integration-tests/tester/go.mod +++ b/tools/integration-tests/tester/go.mod @@ -10,7 +10,7 @@ require ( github.com/docker/go-units v0.4.0 // indirect github.com/drand/drand v0.8.1 github.com/iotaledger/goshimmer v0.1.3 - github.com/iotaledger/hive.go v0.0.0-20200610104211-d603429af242 + github.com/iotaledger/hive.go v0.0.0-20200615181744-3ab0cddc15cf github.com/opencontainers/go-digest v1.0.0-rc1 // indirect github.com/stretchr/testify v1.5.1 ) diff --git a/tools/integration-tests/tester/go.sum b/tools/integration-tests/tester/go.sum index 05f9ae44..77eb420c 100644 --- a/tools/integration-tests/tester/go.sum +++ b/tools/integration-tests/tester/go.sum @@ -148,6 +148,7 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/iotaledger/hive.go v0.0.0-20200610104211-d603429af242 h1:uHMFmfrP6O6lp1lCHT6lpFwHFWYk77V0nUlGbhneQHI= github.com/iotaledger/hive.go v0.0.0-20200610104211-d603429af242/go.mod h1:zwZhaE4ZeglpTrbmbwdnVPMI5XdRu2RmByi3Qn0ztmU= +github.com/iotaledger/hive.go v0.0.0-20200615181744-3ab0cddc15cf/go.mod h1:zwZhaE4ZeglpTrbmbwdnVPMI5XdRu2RmByi3Qn0ztmU= github.com/iotaledger/iota.go v1.0.0-beta.9/go.mod h1:F6WBmYd98mVjAmmPVYhnxg8NNIWCjjH8VWT9qvv3Rc8= github.com/iotaledger/iota.go v1.0.0-beta.14/go.mod h1:F6WBmYd98mVjAmmPVYhnxg8NNIWCjjH8VWT9qvv3Rc8= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= -- GitLab