aboutsummaryrefslogtreecommitdiffstats
path: root/metrics
diff options
context:
space:
mode:
authorMartin Holst Swende <martin@swende.se>2016-11-01 20:46:11 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-11-01 20:46:11 +0800
commit36956da4d2a9e5d9099179f9ce8690b2775b560a (patch)
treecf8b61ea0633f31dbc06031fa7c6adc75158e29a /metrics
parentf4d878f3d83187d27411c0ea5ebd55a82b27e35e (diff)
downloadgo-tangerine-36956da4d2a9e5d9099179f9ce8690b2775b560a.tar
go-tangerine-36956da4d2a9e5d9099179f9ce8690b2775b560a.tar.gz
go-tangerine-36956da4d2a9e5d9099179f9ce8690b2775b560a.tar.bz2
go-tangerine-36956da4d2a9e5d9099179f9ce8690b2775b560a.tar.lz
go-tangerine-36956da4d2a9e5d9099179f9ce8690b2775b560a.tar.xz
go-tangerine-36956da4d2a9e5d9099179f9ce8690b2775b560a.tar.zst
go-tangerine-36956da4d2a9e5d9099179f9ce8690b2775b560a.zip
core: metrics collection for transaction events (#3157)
* core: Add metrics collection for transaction events; replace/discard for pending and future queues, as well as invalid transactions * core: change namespace for txpool metrics * core: define more metrics (not yet used) * core: implement more tx metrics for when transactions are dropped * core: minor formatting tweeks (will squash later) * core: remove superfluous meter, fix missing pending nofunds * core, metrics: switch txpool meters to counters
Diffstat (limited to 'metrics')
-rw-r--r--metrics/metrics.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/metrics/metrics.go b/metrics/metrics.go
index 7f647cd00..d756894f3 100644
--- a/metrics/metrics.go
+++ b/metrics/metrics.go
@@ -48,6 +48,15 @@ func init() {
exp.Exp(metrics.DefaultRegistry)
}
+// NewCounter create a new metrics Counter, either a real one of a NOP stub depending
+// on the metrics flag.
+func NewCounter(name string) metrics.Counter {
+ if !Enabled {
+ return new(metrics.NilCounter)
+ }
+ return metrics.GetOrRegisterCounter(name, metrics.DefaultRegistry)
+}
+
// NewMeter create a new metrics Meter, either a real one of a NOP stub depending
// on the metrics flag.
func NewMeter(name string) metrics.Meter {