mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00

for i in github.com/BurntSushi/toml github.com/coreos/go-etcd/etcd github.com/coreos/go-log/log github.com/gorilla/context github.com/rcrowley/go-metrics bitbucket.org/kardianos/osext github.com/coreos/go-systemd/journal github.com/coreos/raft code.google.com/p/goprotobuf/proto ; do goven -copy -rewrite $i; done
43 lines
1.2 KiB
Go
43 lines
1.2 KiB
Go
// Package metrics provides both a means of generating metrics and the ability
|
|
// to send metric data to a graphite endpoint.
|
|
// The usage of this package without providing a graphite_addr when calling
|
|
// NewBucket results in NOP metric objects. No data will be collected.
|
|
package metrics
|
|
|
|
import (
|
|
"io"
|
|
|
|
gometrics "github.com/coreos/etcd/third_party/github.com/rcrowley/go-metrics"
|
|
)
|
|
|
|
type Timer gometrics.Timer
|
|
type Gauge gometrics.Gauge
|
|
|
|
type Bucket interface {
|
|
// If a timer exists in this Bucket, return it. Otherwise, create
|
|
// a new timer with the given name and store it in this Bucket.
|
|
// The returned object will fulfull the Timer interface.
|
|
Timer(name string) Timer
|
|
|
|
// This acts similarly to Timer, but with objects that fufill the
|
|
// Gauge interface.
|
|
Gauge(name string) Gauge
|
|
|
|
// Write the current state of all Metrics in a human-readable format
|
|
// to the provide io.Writer.
|
|
Dump(io.Writer)
|
|
|
|
// Instruct the Bucket to periodically push all metric data to the
|
|
// provided graphite endpoint.
|
|
Publish(string) error
|
|
}
|
|
|
|
// Create a new Bucket object that periodically
|
|
func NewBucket(name string) Bucket {
|
|
if name == "" {
|
|
return nilBucket{}
|
|
}
|
|
|
|
return newStandardBucket(name)
|
|
}
|