Documentation
¶
Overview ¶
Package labelset implements parsing/normalizing of string representation of the Label Set of a profile.
This is used by the /ingest endpoint, as described in the original Pyroscope API. We keep this mainly for backwards compatability.
Index ¶
- Constants
- Variables
- func FromTreeToDictLabelSet(k string) string
- func IsLabelNameReserved(k string) bool
- func IsLabelNameRuneAllowed(r rune) bool
- func IsServiceNameRuneAllowed(r rune) bool
- func ParseTreeLabelSet(k string) (time.Time, int, error)
- func ServiceNameLabelSet(appName string) string
- func TreeLabelSet(k string, depth int, unixTime int64) string
- func ValidateLabelName(k string) error
- func ValidateLabelSet(k *LabelSet) error
- func ValidateServiceName(n string) error
- type Error
- type LabelSet
- func (k *LabelSet) Add(key, value string)
- func (k *LabelSet) Clone() *LabelSet
- func (k *LabelSet) DictLabelSet() string
- func (k *LabelSet) HasProfileID() bool
- func (k *LabelSet) LabelSet() string
- func (k *LabelSet) Labels() map[string]string
- func (l *LabelSet) Normalized() string
- func (k *LabelSet) ProfileID() (string, bool)
- func (k *LabelSet) ServiceName() string
- func (k *LabelSet) TreeLabelSet(depth int, t time.Time) string
- type ParserState
Constants ¶
const ProfileIDLabelName = "profile_id"
const ReservedLabelNameName = "__name__"
Variables ¶
var ( ErrInvalidServiceName = errors.New("invalid service name") ErrInvalidLabelSet = errors.New("invalid label set") ErrInvalidLabelName = errors.New("invalid label name") ErrServiceNameIsRequired = errors.New("service name is required") ErrLabelNameIsRequired = errors.New("label name is required") ErrLabelNameReserved = errors.New("label name is reserved") )
Functions ¶
func FromTreeToDictLabelSet ¶
FromTreeToDictLabelSet returns app name from tree key k: given tree key "foo{}:0:1234567890", the call returns "foo".
Before tags support, segment key form (i.e. app name + tags: foo{key=value}) has been used to reference a dictionary (trie).
func IsLabelNameReserved ¶
func IsLabelNameRuneAllowed ¶
func ParseTreeLabelSet ¶
ParseTreeLabelSet retrieves tree time and depth level from the given key.
func ServiceNameLabelSet ¶
func ValidateLabelName ¶
ValidateLabelName report an error if the given key k violates constraints.
The function should be used to validate user input. The function returns ErrLabelNameReserved if the key is valid but reserved for internal use.
func ValidateLabelSet ¶
func ValidateServiceName ¶
ValidateServiceName report an error if the given app name n violates constraints.
Types ¶
type Error ¶
type LabelSet ¶
type LabelSet struct {
// contains filtered or unexported fields
}
func (*LabelSet) DictLabelSet ¶
func (*LabelSet) HasProfileID ¶
func (*LabelSet) Normalized ¶
func (*LabelSet) ServiceName ¶
type ParserState ¶
type ParserState int