diff options
author | Péter Szilágyi <peterke@gmail.com> | 2015-07-02 19:13:46 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2015-08-21 15:30:57 +0800 |
commit | c51e153b5c5327f971e7b410e49e7babfc3f0b8e (patch) | |
tree | 3a2f25a668a887fcb1026ae323480ac5fda3548a /metrics/metrics.go | |
parent | d51d0022cee91d6588186455afbe6e54fae2cbf7 (diff) | |
download | dexon-c51e153b5c5327f971e7b410e49e7babfc3f0b8e.tar.gz dexon-c51e153b5c5327f971e7b410e49e7babfc3f0b8e.tar.zst dexon-c51e153b5c5327f971e7b410e49e7babfc3f0b8e.zip |
eth, metrics, p2p: prepare metrics and net packets to eth/62
Diffstat (limited to 'metrics/metrics.go')
-rw-r--r-- | metrics/metrics.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/metrics/metrics.go b/metrics/metrics.go index 6d1a065ed..fcf8b5c32 100644 --- a/metrics/metrics.go +++ b/metrics/metrics.go @@ -31,8 +31,8 @@ import ( // MetricsEnabledFlag is the CLI flag name to use to enable metrics collections. var MetricsEnabledFlag = "metrics" -// enabled is the flag specifying if metrics are enable or not. -var enabled = false +// Enabled is the flag specifying if metrics are enable or not. +var Enabled = false // Init enables or disables the metrics system. Since we need this to run before // any other code gets to create meters and timers, we'll actually do an ugly hack @@ -41,7 +41,7 @@ func init() { for _, arg := range os.Args { if strings.TrimLeft(arg, "-") == MetricsEnabledFlag { glog.V(logger.Info).Infof("Enabling metrics collection") - enabled = true + Enabled = true } } } @@ -49,7 +49,7 @@ func init() { // 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 { - if !enabled { + if !Enabled { return new(metrics.NilMeter) } return metrics.GetOrRegisterMeter(name, metrics.DefaultRegistry) @@ -58,7 +58,7 @@ func NewMeter(name string) metrics.Meter { // NewTimer create a new metrics Timer, either a real one of a NOP stub depending // on the metrics flag. func NewTimer(name string) metrics.Timer { - if !enabled { + if !Enabled { return new(metrics.NilTimer) } return metrics.GetOrRegisterTimer(name, metrics.DefaultRegistry) @@ -68,7 +68,7 @@ func NewTimer(name string) metrics.Timer { // process. func CollectProcessMetrics(refresh time.Duration) { // Short circuit if the metrics system is disabled - if !enabled { + if !Enabled { return } // Create the various data collectors |