Documentation
¶
Index ¶
Constants ¶
const NOT_INITIALIZED = -1
const NS_IN_SEC = float64(time.Second)
nanoseconds in a second represented in float64
Variables ¶
var PERCENTILES = []float64{50, 75, 95, 99, 99.9, 99.99, 99.999}
default percentiles to compute when serializing statstimer type to stdout/json
var TICKS int64
Functions ¶
This section is empty.
Types ¶
type BasicCounter ¶
type BasicCounter uint64
func NewBasicCounter ¶
func NewBasicCounter() *BasicCounter
func (*BasicCounter) MarshalJSON ¶
func (c *BasicCounter) MarshalJSON() ([]byte, error)
MarshalJSON returns a byte slice of JSON representation of basiccounter
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counters
func NewCounter ¶
func NewCounter() *Counter
Counters differ from BasicCounter by having additional fields for computing rate. Operations on counter hold a mutex. use BasicCounter if you need lock-free counters
func (*Counter) ComputeRate ¶
func (*Counter) MarshalJSON ¶
MarshalJSON returns a byte slice of JSON representation of counter
type Gauge ¶
type Gauge struct {
// contains filtered or unexported fields
}
Gauges
func (*Gauge) MarshalJSON ¶
MarshalJSON returns a byte slice of JSON representation of Gauge
type Int64Slice ¶
type Int64Slice []int64
func (Int64Slice) Len ¶
func (a Int64Slice) Len() int
func (Int64Slice) Less ¶
func (a Int64Slice) Less(i, j int) bool
func (Int64Slice) Swap ¶
func (a Int64Slice) Swap(i, j int)
type MetricContext ¶
type MetricContext struct { Counters map[string]*Counter Gauges map[string]*Gauge BasicCounters map[string]*BasicCounter StatsTimers map[string]*StatsTimer OutputFilter OutputFilterFunc // contains filtered or unexported fields }
func NewMetricContext ¶
func NewMetricContext(namespace string) *MetricContext
func (*MetricContext) EncodeJSON ¶
func (m *MetricContext) EncodeJSON(w io.Writer) error
EncodeJSON is a streaming encoder that writes all metrics passing filter to writer w as JSON
func (*MetricContext) HttpJsonHandler ¶
func (m *MetricContext) HttpJsonHandler(w http.ResponseWriter, r *http.Request)
HttpJsonHandler setups a handler for exposing metrics via JSON over HTTP
func (*MetricContext) Register ¶
func (m *MetricContext) Register(v interface{}, name string)
Register(v Metric) registers a metric with metric context
func (*MetricContext) Unregister ¶
func (m *MetricContext) Unregister(v interface{}, name string)
Unregister(v Metric) unregisters a metric with metric context
type MetricJSON ¶
MetricJSON is a type for serializing any metric type
type OutputFilterFunc ¶
type StatsTimer ¶
type StatsTimer struct {
// contains filtered or unexported fields
}
func NewStatsTimer ¶
func NewStatsTimer(timeUnit time.Duration, nsamples int) *StatsTimer
func (*StatsTimer) MarshalJSON ¶
func (s *StatsTimer) MarshalJSON() ([]byte, error)
MarshalJSON returns a byte slice containing representation of StatsTimer
func (*StatsTimer) Percentile ¶
func (s *StatsTimer) Percentile(percentile float64) (float64, error)
func (*StatsTimer) Reset ¶
func (s *StatsTimer) Reset()
func (*StatsTimer) Start ¶
func (s *StatsTimer) Start() *Timer
func (*StatsTimer) Stop ¶
func (s *StatsTimer) Stop(t *Timer) float64