aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/rcrowley/go-metrics
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/rcrowley/go-metrics')
-rw-r--r--vendor/github.com/rcrowley/go-metrics/gauge.go4
-rw-r--r--vendor/github.com/rcrowley/go-metrics/registry.go6
-rw-r--r--vendor/github.com/rcrowley/go-metrics/sample.go9
3 files changed, 13 insertions, 6 deletions
diff --git a/vendor/github.com/rcrowley/go-metrics/gauge.go b/vendor/github.com/rcrowley/go-metrics/gauge.go
index d618c4553..cb57a9388 100644
--- a/vendor/github.com/rcrowley/go-metrics/gauge.go
+++ b/vendor/github.com/rcrowley/go-metrics/gauge.go
@@ -44,7 +44,6 @@ func NewFunctionalGauge(f func() int64) Gauge {
return &FunctionalGauge{value: f}
}
-
// NewRegisteredFunctionalGauge constructs and registers a new StandardGauge.
func NewRegisteredFunctionalGauge(name string, r Registry, f func() int64) Gauge {
c := NewFunctionalGauge(f)
@@ -101,6 +100,7 @@ func (g *StandardGauge) Update(v int64) {
func (g *StandardGauge) Value() int64 {
return atomic.LoadInt64(&g.value)
}
+
// FunctionalGauge returns value from given function
type FunctionalGauge struct {
value func() int64
@@ -117,4 +117,4 @@ func (g FunctionalGauge) Snapshot() Gauge { return GaugeSnapshot(g.Value()) }
// Update panics.
func (FunctionalGauge) Update(int64) {
panic("Update called on a FunctionalGauge")
-} \ No newline at end of file
+}
diff --git a/vendor/github.com/rcrowley/go-metrics/registry.go b/vendor/github.com/rcrowley/go-metrics/registry.go
index 9086dcbdd..2bb7a1e7d 100644
--- a/vendor/github.com/rcrowley/go-metrics/registry.go
+++ b/vendor/github.com/rcrowley/go-metrics/registry.go
@@ -167,9 +167,9 @@ func NewPrefixedChildRegistry(parent Registry, prefix string) Registry {
// Call the given function for each registered metric.
func (r *PrefixedRegistry) Each(fn func(string, interface{})) {
- wrappedFn := func (prefix string) func(string, interface{}) {
+ wrappedFn := func(prefix string) func(string, interface{}) {
return func(name string, iface interface{}) {
- if strings.HasPrefix(name,prefix) {
+ if strings.HasPrefix(name, prefix) {
fn(name, iface)
} else {
return
@@ -184,7 +184,7 @@ func (r *PrefixedRegistry) Each(fn func(string, interface{})) {
func findPrefix(registry Registry, prefix string) (Registry, string) {
switch r := registry.(type) {
case *PrefixedRegistry:
- return findPrefix(r.underlying, r.prefix + prefix)
+ return findPrefix(r.underlying, r.prefix+prefix)
case *StandardRegistry:
return r, prefix
}
diff --git a/vendor/github.com/rcrowley/go-metrics/sample.go b/vendor/github.com/rcrowley/go-metrics/sample.go
index 5f6a37788..fecee5ef6 100644
--- a/vendor/github.com/rcrowley/go-metrics/sample.go
+++ b/vendor/github.com/rcrowley/go-metrics/sample.go
@@ -33,7 +33,7 @@ type Sample interface {
// priority reservoir. See Cormode et al's "Forward Decay: A Practical Time
// Decay Model for Streaming Systems".
//
-// <http://www.research.att.com/people/Cormode_Graham/library/publications/CormodeShkapenyukSrivastavaXu09.pdf>
+// <http://dimacs.rutgers.edu/~graham/pubs/papers/fwddecay.pdf>
type ExpDecaySample struct {
alpha float64
count int64
@@ -302,6 +302,13 @@ type SampleSnapshot struct {
values []int64
}
+func NewSampleSnapshot(count int64, values []int64) *SampleSnapshot {
+ return &SampleSnapshot{
+ count: count,
+ values: values,
+ }
+}
+
// Clear panics.
func (*SampleSnapshot) Clear() {
panic("Clear called on a SampleSnapshot")