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(b []byte, names ...string) (uint64, []byte)
- func (ls Labels) HashWithoutLabels(b []byte, names ...string) (uint64, []byte)
- 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) MarshalYAML() (interface{}, error)
- func (ls Labels) MatchLabels(on bool, names ...string) Labels
- func (ls Labels) String() string
- func (ls Labels) Swap(i, j int)
- func (ls *Labels) UnmarshalJSON(b []byte) error
- func (ls *Labels) UnmarshalYAML(unmarshal func(interface{}) error) 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 modifying Labels.
func (*Builder) Labels ¶
Labels returns the labels from the builder. If no modifications were made, the original labels are returned.
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. 'names' have to be sorted in ascending order.
func (Labels) HashWithoutLabels ¶
HashWithoutLabels returns a hash value for all labels except those matching the provided names. 'names' have to be sorted in ascending order.
func (Labels) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Labels) MarshalYAML ¶
MarshalYAML implements yaml.Marshaler.
func (Labels) MatchLabels ¶
MatchLabels returns a subset of Labels that matches/does not match with the provided label names based on the 'on' boolean. If on is set to true, it returns the subset of labels that match with the provided label names and its inverse when 'on' is set to false.
func (*Labels) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Labels) UnmarshalYAML ¶
UnmarshalYAML implements yaml.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.