model

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2023 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelNameProfileType = "__profile_type__"
	LabelNameType        = "__type__"
	LabelNameUnit        = "__unit__"
	LabelNamePeriodType  = "__period_type__"
	LabelNamePeriodUnit  = "__period_unit__"
)

Variables

This section is empty.

Functions

func CloneLabelPairs

func CloneLabelPairs(lbs []*typesv1.LabelPair) []*typesv1.LabelPair

CloneLabelPairs clones the label pairs.

func CompareLabelPairs

func CompareLabelPairs(a []*typesv1.LabelPair, b []*typesv1.LabelPair) int

Compare compares the two label sets. The result will be 0 if a==b, <0 if a < b, and >0 if a > b.

func CompareProfile

func CompareProfile(a, b *ingestv1.Profile) int64

CompareProfile compares the two profiles.

func LabelPairsString

func LabelPairsString(lbs []*typesv1.LabelPair) string

LabelPairsString returns a string representation of the label pairs.

func MergeSeries

func MergeSeries(series ...[]*typesv1.Series) []*typesv1.Series

func ParseProfileTypeSelector

func ParseProfileTypeSelector(id string) (*typesv1.ProfileType, error)

ParseProfileTypeSelector parses the profile selector string.

func SelectorFromProfileType

func SelectorFromProfileType(profileType *typesv1.ProfileType) *labels.Matcher

SelectorFromProfileType builds a *label.Matcher from an profile type struct

func StringToLabelsPairs

func StringToLabelsPairs(s string) ([]*typesv1.LabelPair, error)

StringToLabelsPairs converts a string representation of label pairs to a slice of label pairs.

Types

type Labels

type Labels []*typesv1.LabelPair

Labels is a sorted set of labels. Order has to be guaranteed upon instantiation.

func LabelsFromStrings

func LabelsFromStrings(ss ...string) Labels

LabelsFromStrings creates new labels from pairs of strings.

func (Labels) BytesWithLabels

func (ls Labels) BytesWithLabels(buf []byte, names ...string) []byte

BytesWithLabels is just as Bytes(), but only for labels matching names. 'names' have to be sorted in ascending order. It uses an byte invalid character as a separator and so should not be used for printing.

func (Labels) Clone

func (ls Labels) Clone() Labels

func (Labels) Get

func (ls Labels) Get(name string) string

Get returns the value for the label with the given name. Returns an empty string if the label doesn't exist.

func (Labels) Hash

func (ls Labels) Hash() uint64

Hash returns a hash value for the label set.

func (Labels) HashForLabels

func (ls Labels) HashForLabels(b []byte, names ...string) (uint64, []byte)

HashForLabels returns a hash value for the labels matching the provided names. 'names' have to be sorted in ascending order.

func (Labels) HashWithoutLabels

func (ls Labels) HashWithoutLabels(b []byte, names ...string) (uint64, []byte)

HashWithoutLabels returns a hash value for all labels except those matching the provided names. 'names' have to be sorted in ascending order.

func (Labels) Len

func (ls Labels) Len() int

func (Labels) Less

func (ls Labels) Less(i, j int) bool

func (Labels) Swap

func (ls Labels) Swap(i, j int)

func (Labels) ToPrometheusLabels

func (ls Labels) ToPrometheusLabels() labels.Labels

func (Labels) WithLabels

func (ls Labels) WithLabels(names ...string) Labels

WithLabels returns a subset of Labels that matches match with the provided label names.

func (Labels) WithoutPrivateLabels

func (ls Labels) WithoutPrivateLabels() Labels

type LabelsBuilder

type LabelsBuilder struct {
	// contains filtered or unexported fields
}

LabelsBuilder allows modifying Labels.

func NewLabelsBuilder

func NewLabelsBuilder(base Labels) *LabelsBuilder

NewLabelsBuilder returns a new LabelsBuilder.

func (*LabelsBuilder) Del

func (b *LabelsBuilder) Del(ns ...string) *LabelsBuilder

Del deletes the label of the given name.

func (*LabelsBuilder) Labels

func (b *LabelsBuilder) Labels() Labels

Labels returns the labels from the builder. If no modifications were made, the original labels are returned.

func (*LabelsBuilder) Reset

func (b *LabelsBuilder) Reset(base Labels)

Reset clears all current state for the builder.

func (*LabelsBuilder) Set

func (b *LabelsBuilder) Set(n, v string) *LabelsBuilder

Set the name/value pair as a label.

type StacktracesHasher

type StacktracesHasher struct {
	// contains filtered or unexported fields
}

func (StacktracesHasher) Hashes

func (h StacktracesHasher) Hashes(fnIds []int32) uint64

todo we might want to reuse the results to avoid allocations

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL