Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Initialize ¶
Initialize replaces the global Metrics instance with one that matches Thelma's configuration. It should be called once during Thelma's initialization by the Thelma builder, and nowhere else.
func Push ¶
func Push() error
Push pushes all metrics recorded by the root aggregator to the Thelma metrics gateway. This should ONLY be called once per Thelma run, by the Thelma root command.
func TaskCompletion ¶
TaskCompletion is a convenience function that records the completion of as task as both a counter (indicating the task completed) and a gauge (representing how long the task took to complete): <name>_counter <name>_duration_seconds Both metrics will include an "ok" label that will be "true" if err is nil, "false" otherwise
Types ¶
type CounterMetric ¶
type CounterMetric interface { // Inc increments the counter Inc() // Add adds to the counter Add(float64) }
CounterMetric represents a Counter metric
func Counter ¶
func Counter(opts Options) CounterMetric
Counter returns a new Counter metric. Counters should be used for values that accumulate over time (for example, number of times a task is executed)
type GaugeMetric ¶
type GaugeMetric interface { // Set sets the gauge to the given value Set(float64) }
GaugeMetric represents a Gauge metric
func Gauge ¶
func Gauge(opts Options) GaugeMetric
Gauge returns a new Gauge metric. Gauges should be used for values that fluctuate over time (for example, duration of a task)
type Metrics ¶
type Metrics interface { // Gauge returns a new Gauge metric. Gauges should be used for values that fluctuate over time (for example, duration of a task) Gauge(opts Options) GaugeMetric // Counter returns a new Counter metric. Counters should be used for values that accumulate over time (for example, number of times a task is executed) Counter(opts Options) CounterMetric // TaskCompletion is a convenience function that records the completion of as task as both a counter // (indicating the task completed) and a gauge (representing how long the task took to complete): // <name>_counter // <name>_duration_seconds // Both metrics will include an "ok" label that will be "true" if err is nil, "false" otherwise TaskCompletion(opts Options, duration time.Duration, err error) // WithLabels returns a copy of this Metrics instance with an additional set of configured labels WithLabels(map[string]string) Metrics // contains filtered or unexported methods }
Metrics is for aggregating metrics
func Noop ¶
func Noop() Metrics
Noop returns a metrics instance that won't actually push metrics anywhere
func WithLabels ¶
WithLabels returns a copy of the root Metrics instance with an additional set of configured labels
Directories ¶
Path | Synopsis |
---|---|
Package labels contains utility functions for generating a standard set of labels for terra.State objects Note that you cannot record two metrics with the same name and a different set of labels; if you do, the prometheus client library will panic.
|
Package labels contains utility functions for generating a standard set of labels for terra.State objects Note that you cannot record two metrics with the same name and a different set of labels; if you do, the prometheus client library will panic. |