Documentation ¶
Index ¶
- func IncrementCount(metricName string)
- func IncrementCountBy(metricName string, amount int)
- func MeasureSince(metricName string, since time.Time)
- func SetGauge(metricName string, val float32)
- func SetMetricsGlobal(recorder MetricsRecorder)
- func SetPrefix(prefix string)
- type DatadogStatsdRecorder
- func (dd *DatadogStatsdRecorder) GetTags() []metrics.Label
- func (dd *DatadogStatsdRecorder) IncrementCount(metricName string)
- func (dd *DatadogStatsdRecorder) IncrementCountBy(metricName string, amount int)
- func (dd *DatadogStatsdRecorder) MeasureDurationMS(metricName string, durationMS float32)
- func (dd *DatadogStatsdRecorder) MeasureSince(metricName string, since time.Time)
- func (dd *DatadogStatsdRecorder) SetGauge(metricName string, val float32)
- func (dd *DatadogStatsdRecorder) WithTag(key, value string) MetricsRecorder
- type MetricsRecorder
- type NoopRecorder
- func (*NoopRecorder) IncrementCount(string)
- func (*NoopRecorder) IncrementCountBy(string, int)
- func (*NoopRecorder) MeasureDurationMS(string, float32)
- func (*NoopRecorder) MeasureSince(string, time.Time)
- func (*NoopRecorder) SetGauge(string, float32)
- func (*NoopRecorder) SetPrefix(string)
- func (n *NoopRecorder) WithTag(key, value string) MetricsRecorder
- type StatsdRecorder
- func (m *StatsdRecorder) IncrementCount(metricName string)
- func (m *StatsdRecorder) IncrementCountBy(metricName string, amount int)
- func (m *StatsdRecorder) MeasureDurationMS(metricName string, durationMS float32)
- func (m *StatsdRecorder) MeasureSince(metricName string, since time.Time)
- func (m *StatsdRecorder) SetGauge(metricName string, val float32)
- func (m *StatsdRecorder) SetPrefix(prefix string)
- func (m *StatsdRecorder) WithTag(key, value string) MetricsRecorder
- type TeedMetricsRecorder
- func (t *TeedMetricsRecorder) GetMetrics() []MetricsRecorder
- func (t *TeedMetricsRecorder) IncrementCount(metricName string)
- func (t *TeedMetricsRecorder) IncrementCountBy(metricName string, amount int)
- func (t *TeedMetricsRecorder) MeasureDurationMS(metricName string, durationMS float32)
- func (t *TeedMetricsRecorder) MeasureSince(metricName string, since time.Time)
- func (t *TeedMetricsRecorder) SetGauge(metricName string, val float32)
- func (t *TeedMetricsRecorder) SetPrefix(prefix string)
- func (t *TeedMetricsRecorder) WithTag(key, value string) MetricsRecorder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IncrementCount ¶
func IncrementCount(metricName string)
Increment Count by 1 for Metric by name
func IncrementCountBy ¶
Increment Count by amount for Metric by name
func MeasureSince ¶
Measure Time since given for Metric by name
func SetMetricsGlobal ¶
func SetMetricsGlobal(recorder MetricsRecorder)
Public initialization function to initialize the Metrics global. If you're using metrics, this should be called before any goroutines using them are started.
(If you don't care about metrics, you don't need to call this function; nothing will break, since a no-op metrics sink is used by default.)
Types ¶
type DatadogStatsdRecorder ¶
type DatadogStatsdRecorder struct { *StatsdRecorder // contains filtered or unexported fields }
DatadogStatsdRecorder wraps a StatsdRecorder and allows tagging of metrics
func NewDatadogStatsdRecorder ¶
func NewDatadogStatsdRecorder(statsiteEndpoint, namespace, hostname string) (*DatadogStatsdRecorder, error)
func (*DatadogStatsdRecorder) GetTags ¶
func (dd *DatadogStatsdRecorder) GetTags() []metrics.Label
func (*DatadogStatsdRecorder) IncrementCount ¶
func (dd *DatadogStatsdRecorder) IncrementCount(metricName string)
func (*DatadogStatsdRecorder) IncrementCountBy ¶
func (dd *DatadogStatsdRecorder) IncrementCountBy(metricName string, amount int)
func (*DatadogStatsdRecorder) MeasureDurationMS ¶
func (dd *DatadogStatsdRecorder) MeasureDurationMS(metricName string, durationMS float32)
func (*DatadogStatsdRecorder) MeasureSince ¶
func (dd *DatadogStatsdRecorder) MeasureSince(metricName string, since time.Time)
func (*DatadogStatsdRecorder) SetGauge ¶
func (dd *DatadogStatsdRecorder) SetGauge(metricName string, val float32)
func (*DatadogStatsdRecorder) WithTag ¶
func (dd *DatadogStatsdRecorder) WithTag(key, value string) MetricsRecorder
WithTag returns a new DatadogStatsdRecorder that has the tags added to it.
type MetricsRecorder ¶
type MetricsRecorder interface { IncrementCount(metricName string) IncrementCountBy(metricName string, amount int) MeasureSince(metricName string, since time.Time) MeasureDurationMS(metricName string, durationMS float32) SetGauge(metricName string, val float32) SetPrefix(prefix string) WithTag(key, value string) MetricsRecorder }
Public interface for recording metrics.
func WithTag ¶
func WithTag(key, value string) MetricsRecorder
WithTag returns a new MetricsRecorder that has the tags added to it.
type NoopRecorder ¶
type NoopRecorder struct{}
A nop-op MetricsRecorder implementation. For use when real metrics systems are unavailable.
func (*NoopRecorder) IncrementCount ¶
func (*NoopRecorder) IncrementCount(string)
func (*NoopRecorder) IncrementCountBy ¶
func (*NoopRecorder) IncrementCountBy(string, int)
func (*NoopRecorder) MeasureDurationMS ¶
func (*NoopRecorder) MeasureDurationMS(string, float32)
func (*NoopRecorder) MeasureSince ¶
func (*NoopRecorder) MeasureSince(string, time.Time)
func (*NoopRecorder) SetGauge ¶
func (*NoopRecorder) SetGauge(string, float32)
func (*NoopRecorder) SetPrefix ¶
func (*NoopRecorder) SetPrefix(string)
func (*NoopRecorder) WithTag ¶
func (n *NoopRecorder) WithTag(key, value string) MetricsRecorder
type StatsdRecorder ¶
type StatsdRecorder struct { *metrics.Metrics // contains filtered or unexported fields }
A MetricsRecorder implementation which is just a wrapper around the go-metrics library, to record to Statsd.
func NewStatsdRecorder ¶
func NewStatsdRecorder(statsiteEndpoint, namespace string) (*StatsdRecorder, error)
Takes a host:port string of the statsite endpoint to write to.
func (*StatsdRecorder) IncrementCount ¶
func (m *StatsdRecorder) IncrementCount(metricName string)
func (*StatsdRecorder) IncrementCountBy ¶
func (m *StatsdRecorder) IncrementCountBy(metricName string, amount int)
func (*StatsdRecorder) MeasureDurationMS ¶
func (m *StatsdRecorder) MeasureDurationMS(metricName string, durationMS float32)
func (*StatsdRecorder) MeasureSince ¶
func (m *StatsdRecorder) MeasureSince(metricName string, since time.Time)
func (*StatsdRecorder) SetGauge ¶
func (m *StatsdRecorder) SetGauge(metricName string, val float32)
func (*StatsdRecorder) SetPrefix ¶
func (m *StatsdRecorder) SetPrefix(prefix string)
func (*StatsdRecorder) WithTag ¶
func (m *StatsdRecorder) WithTag(key, value string) MetricsRecorder
type TeedMetricsRecorder ¶
type TeedMetricsRecorder struct {
// contains filtered or unexported fields
}
func NewTeedMetricsRecorder ¶
func NewTeedMetricsRecorder(metrics ...MetricsRecorder) *TeedMetricsRecorder
func (*TeedMetricsRecorder) GetMetrics ¶
func (t *TeedMetricsRecorder) GetMetrics() []MetricsRecorder
func (*TeedMetricsRecorder) IncrementCount ¶
func (t *TeedMetricsRecorder) IncrementCount(metricName string)
func (*TeedMetricsRecorder) IncrementCountBy ¶
func (t *TeedMetricsRecorder) IncrementCountBy(metricName string, amount int)
func (*TeedMetricsRecorder) MeasureDurationMS ¶
func (t *TeedMetricsRecorder) MeasureDurationMS(metricName string, durationMS float32)
func (*TeedMetricsRecorder) MeasureSince ¶
func (t *TeedMetricsRecorder) MeasureSince(metricName string, since time.Time)
func (*TeedMetricsRecorder) SetGauge ¶
func (t *TeedMetricsRecorder) SetGauge(metricName string, val float32)
func (*TeedMetricsRecorder) SetPrefix ¶
func (t *TeedMetricsRecorder) SetPrefix(prefix string)
func (*TeedMetricsRecorder) WithTag ¶
func (t *TeedMetricsRecorder) WithTag(key, value string) MetricsRecorder