Documentation
¶
Index ¶
- Constants
- type Family
- type Opt
- func WithCounter(total float64, labels ...any) Opt
- func WithFloat(name string, value float64, labels ...any) Opt
- func WithGauge(value float64, labels ...any) Opt
- func WithHelp(help string) Opt
- func WithInfo(labels ...any) Opt
- func WithInt(name string, value int64, labels ...any) Opt
- func WithState(value bool, labels ...any) Opt
- func WithType(v string) Opt
- func WithUnit(unit string) Opt
- type Sample
- func NewCounter(total float64, labels ...any) (*Sample, error)
- func NewFloat(name string, value float64, labels ...any) (*Sample, error)
- func NewGauge(value float64, labels ...any) (*Sample, error)
- func NewInfo(labels ...any) (*Sample, error)
- func NewInt(name string, value int64, labels ...any) (*Sample, error)
- func NewState(value bool, labels ...any) (*Sample, error)
Constants ¶
View Source
const (
// https://github.com/prometheus/OpenMetrics/blob/main/specification/OpenMetrics.md
ContentTypeMetrics = "application/openmetrics-text; version=1.0.0; charset=utf-8"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Family ¶
type Family struct {
// Name of the family
Name string `json:"name,omitempty"`
// Help text
Help string `json:"help,omitempty"`
// Valid values are "gauge", "counter", "stateset", "info", "histogram", "gaugehistogram", and "summary".
// If not set, "unknown" is assumed.
Type string `json:"type"`
// Unit of measurement, ie "seconds". This is optional.
Unit string `json:"unit,omitempty"`
// Samples
Samples []*Sample `json:"samples,omitempty"`
}
func NewMetricFamily ¶
NewMetricFamily returns a new, empty metric family
type Opt ¶
type Opt func(*opt) error
func WithCounter ¶
Counter type provides a steadily increasing value
type Sample ¶
type Sample struct {
// Name of the sample
Name string `json:"suffix,omitempty"`
// Labels are key-value pairs
Labels []string `json:"labels,omitempty"`
// Metric value
Float *float64 `json:"float,omitempty"`
Int *int64 `json:"int,omitempty"`
// Timestamp in seconds since epoch
Timestamp *float64 `json:"timestamp,omitempty"`
}
func NewCounter ¶
Counter type provides a steadily increasing value
Click to show internal directories.
Click to hide internal directories.