Documentation
¶
Overview ¶
Package metrics provides Go applications a simple way to report statistics.
Applications will start by creating a Registry and typically just one of those. One or more Measurement's will be created/obtained from the Registry each Measurement best aligns with a subsystem of the application since a measurement in turn contains one or more fields.
The fields of the measurement, counters and gauges, are what the application code will directly use to increment and provide values representing the activity of the application.
Reporters, which may be a subsystem of the application, will periodically utilize the Registry's Walk function to gather a snapshot of all registered metrics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FloatValueProvider ¶
type FloatValueProvider func() float64
type IntValueProvider ¶
type IntValueProvider func() int64
type Measurement ¶
type Measurement interface { IntGauge(field string, valueProvider IntValueProvider) FloatGauge(field string, valueProvider FloatValueProvider) Counter(field string) Counter CumulativeCounter(field string) Counter }
type Registry ¶
type Registry interface { Measurement(name string, tags ...Tag) Measurement Walk(timestamp time.Time, consumer SnappedMeasurementConsumer) }
func NewRegistry ¶
type SnappedMeasurement ¶
type SnappedMeasurementConsumer ¶
type SnappedMeasurementConsumer func(m *SnappedMeasurement)
type Tag ¶
type Tag struct {
Key, Value string
}
Tag represents a single tag (or dimension) of a measurement-series. It is recommended that you use the abbreviated struct literal form to construct tag entries, such as:
Tag{"stack","prod"}
but you can always specify the field names for clarity:
Tag{Key:"stack", Value:"prod"}