Documentation ¶
Index ¶
- Constants
- func Compare(a, b Labels) int
- func Equal(ls, o Labels) bool
- type Builder
- type Label
- type Labels
- func (ls Labels) Copy() Labels
- func (ls Labels) Get(name string) string
- func (ls Labels) Has(name string) bool
- func (ls Labels) Hash() uint64
- func (ls Labels) HashForLabels(names ...string) uint64
- func (ls Labels) HashWithoutLabels(names ...string) uint64
- func (ls Labels) Len() int
- func (ls Labels) Less(i, j int) bool
- func (ls Labels) Map() map[string]string
- func (ls Labels) MarshalJSON() ([]byte, error)
- func (ls Labels) String() string
- func (ls Labels) Swap(i, j int)
- func (ls *Labels) UnmarshalJSON(b []byte) error
- type MatchType
- type Matcher
Constants ¶
const ( MetricName = "__name__" AlertName = "alertname" BucketLabel = "le" InstanceName = "instance" )
Well-known label names used by Prometheus components.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder allows modifiying Labels.
type Labels ¶
type Labels []Label
Labels is a sorted set of labels. Order has to be guaranteed upon instantiation.
func FromStrings ¶
FromStrings creates new labels from pairs of strings.
func New ¶
New returns a sorted Labels from the given labels. The caller has to guarantee that all label names are unique.
func (Labels) Get ¶
Get returns the value for the label with the given name. Returns an empty string if the label doesn't exist.
func (Labels) HashForLabels ¶
HashForLabels returns a hash value for the labels matching the provided names.
func (Labels) HashWithoutLabels ¶
HashWithoutLabels returns a hash value for all labels except those matching the provided names.
func (Labels) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*Labels) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type Matcher ¶
type Matcher struct { Type MatchType Name string Value string // contains filtered or unexported fields }
Matcher models the matching of a label.
func NewMatcher ¶
NewMatcher returns a matcher object.