Documentation ¶
Index ¶
- func ReverseLabelledPath(path string) (name string, tagNames, tagValues []string)
- type CloudWatchConfig
- type Config
- type DudStat
- type DudType
- func (d DudType) Close() error
- func (d DudType) GetCounter(path string) StatCounter
- func (d DudType) GetCounterVec(path string, n ...string) StatCounterVec
- func (d DudType) GetGauge(path string) StatGauge
- func (d DudType) GetGaugeVec(path string, n ...string) StatGaugeVec
- func (d DudType) GetTimer(path string) StatTimer
- func (d DudType) GetTimerVec(path string, n ...string) StatTimerVec
- func (d DudType) HandlerFunc() http.HandlerFunc
- type InfluxDBConfig
- type InfluxDBInclude
- type JSONAPIConfig
- type Local
- func (l *Local) Close() error
- func (l *Local) FlushCounters() map[string]int64
- func (l *Local) FlushTimings() map[string]metrics.Timer
- func (l *Local) GetCounter(path string) StatCounter
- func (l *Local) GetCounterVec(path string, k ...string) StatCounterVec
- func (l *Local) GetCounters() map[string]int64
- func (l *Local) GetGauge(path string) StatGauge
- func (l *Local) GetGaugeVec(path string, k ...string) StatGaugeVec
- func (l *Local) GetTimer(path string) StatTimer
- func (l *Local) GetTimerVec(path string, k ...string) StatTimerVec
- func (l *Local) GetTimings() map[string]metrics.Timer
- func (l *Local) HandlerFunc() http.HandlerFunc
- type LocalStat
- type LocalTiming
- type LoggerConfig
- type Mapping
- type Namespaced
- func (n *Namespaced) Child() Type
- func (n *Namespaced) Close() error
- func (n *Namespaced) GetCounter(path string) StatCounter
- func (n *Namespaced) GetCounterVec(path string, labelNames ...string) StatCounterVec
- func (n *Namespaced) GetGauge(path string) StatGauge
- func (n *Namespaced) GetGaugeVec(path string, labelNames ...string) StatGaugeVec
- func (n *Namespaced) GetTimer(path string) StatTimer
- func (n *Namespaced) GetTimerVec(path string, labelNames ...string) StatTimerVec
- func (n *Namespaced) HandlerFunc() http.HandlerFunc
- func (n *Namespaced) WithLabels(labels ...string) *Namespaced
- func (n *Namespaced) WithMapping(m *Mapping) *Namespaced
- func (n *Namespaced) WithStats(s Type) *Namespaced
- type PrometheusConfig
- type PrometheusPushBasicAuthConfig
- type StatCounter
- type StatCounterVec
- type StatGauge
- type StatGaugeVec
- type StatTimer
- type StatTimerVec
- type StatsdConfig
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReverseLabelledPath ¶
ReverseLabelledPath extracts a name, tag names and tag values from a labelled metric name.
Types ¶
type CloudWatchConfig ¶
type CloudWatchConfig struct { session.Config `json:",inline" yaml:",inline"` Namespace string `json:"namespace" yaml:"namespace"` FlushPeriod string `json:"flush_period" yaml:"flush_period"` }
CloudWatchConfig contains config fields for the CloudWatch metrics type.
func NewCloudWatchConfig ¶
func NewCloudWatchConfig() CloudWatchConfig
NewCloudWatchConfig creates an CloudWatchConfig struct with default values.
type Config ¶
type Config struct { Type string `json:"type" yaml:"type"` Mapping string `json:"mapping" yaml:"mapping"` AWSCloudWatch CloudWatchConfig `json:"aws_cloudwatch" yaml:"aws_cloudwatch"` JSONAPI JSONAPIConfig `json:"json_api" yaml:"json_api"` InfluxDB InfluxDBConfig `json:"influxdb" yaml:"influxdb"` None struct{} `json:"none" yaml:"none"` Prometheus PrometheusConfig `json:"prometheus" yaml:"prometheus"` Statsd StatsdConfig `json:"statsd" yaml:"statsd"` Logger LoggerConfig `json:"logger" yaml:"logger"` }
Config is the all encompassing configuration struct for all metric output types.
func NewConfig ¶
func NewConfig() Config
NewConfig returns a configuration struct fully populated with default values.
func (*Config) UnmarshalYAML ¶
UnmarshalYAML ensures that when parsing configs that are in a map or slice the default values are still applied.
type DudStat ¶
type DudStat struct{}
DudStat implements the Stat interface but doesn't actual do anything.
type DudType ¶
type DudType struct {
ID int
}
DudType implements the Type interface but doesn't actual do anything.
func (DudType) GetCounter ¶
func (d DudType) GetCounter(path string) StatCounter
GetCounter returns a DudStat.
func (DudType) GetCounterVec ¶
func (d DudType) GetCounterVec(path string, n ...string) StatCounterVec
GetCounterVec returns a DudStat.
func (DudType) GetGaugeVec ¶
func (d DudType) GetGaugeVec(path string, n ...string) StatGaugeVec
GetGaugeVec returns a DudStat.
func (DudType) GetTimerVec ¶
func (d DudType) GetTimerVec(path string, n ...string) StatTimerVec
GetTimerVec returns a DudStat.
func (DudType) HandlerFunc ¶
func (d DudType) HandlerFunc() http.HandlerFunc
HandlerFunc returns nil.
type InfluxDBConfig ¶
type InfluxDBConfig struct { URL string `json:"url" yaml:"url"` DB string `json:"db" yaml:"db"` TLS btls.Config `json:"tls" yaml:"tls"` Interval string `json:"interval" yaml:"interval"` Password string `json:"password" yaml:"password"` PingInterval string `json:"ping_interval" yaml:"ping_interval"` Precision string `json:"precision" yaml:"precision"` Timeout string `json:"timeout" yaml:"timeout"` Username string `json:"username" yaml:"username"` RetentionPolicy string `json:"retention_policy" yaml:"retention_policy"` WriteConsistency string `json:"write_consistency" yaml:"write_consistency"` Include InfluxDBInclude `json:"include" yaml:"include"` Tags map[string]string `json:"tags" yaml:"tags"` }
InfluxDBConfig is config for the influx metrics type.
func NewInfluxDBConfig ¶
func NewInfluxDBConfig() InfluxDBConfig
NewInfluxDBConfig creates an InfluxDBConfig struct with default values.
type InfluxDBInclude ¶
type InfluxDBInclude struct { Runtime string `json:"runtime" yaml:"runtime"` DebugGC string `json:"debug_gc" yaml:"debug_gc"` }
InfluxDBInclude contains configuration parameters for optional metrics to include.
type JSONAPIConfig ¶
type JSONAPIConfig struct{}
JSONAPIConfig contains configuration parameters for the JSON API metrics aggregator.
func NewJSONAPIConfig ¶
func NewJSONAPIConfig() JSONAPIConfig
NewJSONAPIConfig returns a new JSONAPIConfig with default values.
type Local ¶
type Local struct {
// contains filtered or unexported fields
}
Local is a metrics aggregator that stores metrics locally.
func (*Local) Close ¶
Close stops the Local object from aggregating metrics and cleans up resources.
func (*Local) FlushCounters ¶
FlushCounters returns a map of the current state of the metrics paths to counters and then resets the counters to 0
func (*Local) FlushTimings ¶
FlushTimings returns a map of the current state of the metrics paths to counters and then resets the counters to 0
func (*Local) GetCounter ¶
func (l *Local) GetCounter(path string) StatCounter
GetCounter returns a stat counter object for a path.
func (*Local) GetCounterVec ¶
func (l *Local) GetCounterVec(path string, k ...string) StatCounterVec
GetCounterVec returns a stat counter object for a path and records the labels and values.
func (*Local) GetCounters ¶
GetCounters returns a map of metric paths to counters.
func (*Local) GetGaugeVec ¶
func (l *Local) GetGaugeVec(path string, k ...string) StatGaugeVec
GetGaugeVec returns a stat timer object for a path with the labels discarded.
func (*Local) GetTimerVec ¶
func (l *Local) GetTimerVec(path string, k ...string) StatTimerVec
GetTimerVec returns a stat timer object for a path with the labels and values.
func (*Local) GetTimings ¶
GetTimings returns a map of metric paths to timers.
type LocalStat ¶
type LocalStat struct {
Value *int64
}
LocalStat is a representation of a single metric stat. Interactions with this stat are thread safe.
type LocalTiming ¶
type LocalTiming struct {
// contains filtered or unexported fields
}
LocalTiming is a representation of a single metric timing.
type LoggerConfig ¶
type LoggerConfig struct { PushInterval string `json:"push_interval" yaml:"push_interval"` FlushMetrics bool `json:"flush_metrics" yaml:"flush_metrics"` }
LoggerConfig contains configuration parameters for the Stdout metrics aggregator.
func NewLoggerConfig ¶
func NewLoggerConfig() LoggerConfig
NewLoggerConfig returns a new StdoutConfig with default values.
type Mapping ¶
type Mapping struct {
// contains filtered or unexported fields
}
Mapping is a compiled Bloblang mapping used to rewrite metrics.
type Namespaced ¶
type Namespaced struct {
// contains filtered or unexported fields
}
Namespaced wraps a child metrics exporter and exposes a Type API that adds namespacing labels and name prefixes to new
func NewNamespaced ¶
func NewNamespaced(child Type) *Namespaced
NewNamespaced wraps a metrics exporter and adds prefixes and custom labels.
func (*Namespaced) Child ¶
func (n *Namespaced) Child() Type
Child returns the underlying metrics type.
func (*Namespaced) Close ¶
func (n *Namespaced) Close() error
Close stops aggregating stats and cleans up resources.
func (*Namespaced) GetCounter ¶
func (n *Namespaced) GetCounter(path string) StatCounter
GetCounter returns an editable counter stat for a given path.
func (*Namespaced) GetCounterVec ¶
func (n *Namespaced) GetCounterVec(path string, labelNames ...string) StatCounterVec
GetCounterVec returns an editable counter stat for a given path with labels, these labels must be consistent with any other metrics registered on the same path.
func (*Namespaced) GetGauge ¶
func (n *Namespaced) GetGauge(path string) StatGauge
GetGauge returns an editable gauge stat for a given path.
func (*Namespaced) GetGaugeVec ¶
func (n *Namespaced) GetGaugeVec(path string, labelNames ...string) StatGaugeVec
GetGaugeVec returns an editable gauge stat for a given path with labels, these labels must be consistent with any other metrics registered on the same path.
func (*Namespaced) GetTimer ¶
func (n *Namespaced) GetTimer(path string) StatTimer
GetTimer returns an editable timer stat for a given path.
func (*Namespaced) GetTimerVec ¶
func (n *Namespaced) GetTimerVec(path string, labelNames ...string) StatTimerVec
GetTimerVec returns an editable timer stat for a given path with labels, these labels must be consistent with any other metrics registered on the same path.
func (*Namespaced) HandlerFunc ¶
func (n *Namespaced) HandlerFunc() http.HandlerFunc
HandlerFunc returns the http handler of the child.
func (*Namespaced) WithLabels ¶
func (n *Namespaced) WithLabels(labels ...string) *Namespaced
WithLabels returns a namespaced metrics exporter with a new set of labels, which are added to any prior labels.
func (*Namespaced) WithMapping ¶
func (n *Namespaced) WithMapping(m *Mapping) *Namespaced
WithMapping returns a namespaced metrics exporter with a new mapping. Mappings are applied _before_ the prefix and static labels are applied. Mappings already added are executed after this new mapping.
func (*Namespaced) WithStats ¶
func (n *Namespaced) WithStats(s Type) *Namespaced
WithStats returns a namespaced metrics exporter with a different stats implementation.
type PrometheusConfig ¶
type PrometheusConfig struct { UseHistogramTiming bool `json:"use_histogram_timing" yaml:"use_histogram_timing"` HistogramBuckets []float64 `json:"histogram_buckets" yaml:"histogram_buckets"` AddProcessMetrics bool `json:"add_process_metrics" yaml:"add_process_metrics"` AddGoMetrics bool `json:"add_go_metrics" yaml:"add_go_metrics"` PushURL string `json:"push_url" yaml:"push_url"` PushBasicAuth PrometheusPushBasicAuthConfig `json:"push_basic_auth" yaml:"push_basic_auth"` PushInterval string `json:"push_interval" yaml:"push_interval"` PushJobName string `json:"push_job_name" yaml:"push_job_name"` FileOutputPath string `json:"file_output_path" yaml:"file_output_path"` }
PrometheusConfig is config for the Prometheus metrics type.
func NewPrometheusConfig ¶
func NewPrometheusConfig() PrometheusConfig
NewPrometheusConfig creates an PrometheusConfig struct with default values.
type PrometheusPushBasicAuthConfig ¶
type PrometheusPushBasicAuthConfig struct { Username string `json:"username" yaml:"username"` Password string `json:"password" yaml:"password"` }
PrometheusPushBasicAuthConfig contains parameters for establishing basic authentication against a push service.
func NewPrometheusPushBasicAuthConfig ¶
func NewPrometheusPushBasicAuthConfig() PrometheusPushBasicAuthConfig
NewPrometheusPushBasicAuthConfig creates a new NewPrometheusPushBasicAuthConfig with default values.
type StatCounter ¶
type StatCounter interface { // Incr increments a counter by an amount. Incr(count int64) }
StatCounter is a representation of a single counter metric stat. Interactions with this stat are thread safe.
type StatCounterVec ¶
type StatCounterVec interface { // With returns a StatCounter with a set of label values. With(labelValues ...string) StatCounter }
StatCounterVec creates StatCounters with dynamic labels.
func FakeCounterVec ¶
func FakeCounterVec(f func(...string) StatCounter) StatCounterVec
FakeCounterVec returns a counter vec implementation that ignores labels.
type StatGauge ¶
type StatGauge interface { // Set sets the value of a gauge metric. Set(value int64) // Incr increments a gauge by an amount. Incr(count int64) // Decr decrements a gauge by an amount. Decr(count int64) }
StatGauge is a representation of a single gauge metric stat. Interactions with this stat are thread safe.
type StatGaugeVec ¶
type StatGaugeVec interface { // With returns a StatGauge with a set of label values. With(labelValues ...string) StatGauge }
StatGaugeVec creates StatGauges with dynamic labels.
func FakeGaugeVec ¶
func FakeGaugeVec(f func(...string) StatGauge) StatGaugeVec
FakeGaugeVec returns a gauge vec implementation that ignores labels.
type StatTimer ¶
type StatTimer interface { // Timing sets a timing metric. Timing(delta int64) }
StatTimer is a representation of a single timer metric stat, timing values should be presented in nanoseconds for consistency. Interactions with this stat are thread safe.
type StatTimerVec ¶
type StatTimerVec interface { // With returns a StatTimer with a set of label values. With(labelValues ...string) StatTimer }
StatTimerVec creates StatTimers with dynamic labels.
func FakeTimerVec ¶
func FakeTimerVec(f func(...string) StatTimer) StatTimerVec
FakeTimerVec returns a timer vec implementation that ignores labels.
type StatsdConfig ¶
type StatsdConfig struct { Address string `json:"address" yaml:"address"` FlushPeriod string `json:"flush_period" yaml:"flush_period"` TagFormat string `json:"tag_format" yaml:"tag_format"` }
StatsdConfig is config for the Statsd metrics type.
func NewStatsdConfig ¶
func NewStatsdConfig() StatsdConfig
NewStatsdConfig creates an StatsdConfig struct with default values.
type Type ¶
type Type interface { // GetCounter returns an editable counter stat for a given path. GetCounter(path string) StatCounter // GetCounterVec returns an editable counter stat for a given path with labels, // these labels must be consistent with any other metrics registered on the // same path. GetCounterVec(path string, labelNames ...string) StatCounterVec // GetTimer returns an editable timer stat for a given path. GetTimer(path string) StatTimer // GetTimerVec returns an editable timer stat for a given path with labels, // these labels must be consistent with any other metrics registered on the // same path. GetTimerVec(path string, labelNames ...string) StatTimerVec // GetGauge returns an editable gauge stat for a given path. GetGauge(path string) StatGauge // GetGaugeVec returns an editable gauge stat for a given path with labels, // these labels must be consistent with any other metrics registered on the // same path. GetGaugeVec(path string, labelNames ...string) StatGaugeVec // HandlerFunc returns an optional HTTP request handler that exposes metrics // from the implementation. If nil is returned then no endpoint will be // registered. HandlerFunc() http.HandlerFunc // Close stops aggregating stats and cleans up resources. Close() error }
Type is an interface for metrics aggregation.