Documentation ¶
Index ¶
- Constants
- Variables
- func FromTreeToDictKey(k string) string
- func IsAppNameRuneAllowed(r rune) bool
- func IsTagKeyReserved(k string) bool
- func IsTagKeyRuneAllowed(r rune) bool
- func ParseTreeKey(k string) (time.Time, int, error)
- func TreeKey(k string, depth int, unixTime int64) string
- func ValidateAppName(n string) error
- func ValidateTagKey(k string) error
- type ByPriority
- type Error
- type Key
- func (k *Key) Add(key, value string)
- func (k *Key) AppName() string
- func (k *Key) Clone() *Key
- func (k *Key) DictKey() string
- func (k *Key) Labels() map[string]string
- func (k *Key) Match(q *Query) bool
- func (k *Key) Normalized() string
- func (k *Key) SegmentKey() string
- func (k *Key) TreeKey(depth int, t time.Time) string
- type Op
- type ParserState
- type Query
- type TagMatcher
Constants ¶
const (
ReservedTagKeyName = "__name__"
)
Variables ¶
var ( ErrInvalidQuerySyntax = errors.New("invalid query syntax") ErrInvalidAppName = errors.New("invalid application name") ErrInvalidMatchersSyntax = errors.New("invalid tag matchers syntax") ErrInvalidTagKey = errors.New("invalid tag key") ErrInvalidTagValueSyntax = errors.New("invalid tag value syntax") ErrAppNameIsRequired = errors.New("application name is required") ErrTagKeyIsRequired = errors.New("tag key is required") ErrTagKeyReserved = errors.New("tag key is reserved") ErrMatchOperatorIsRequired = errors.New("match operator is required") ErrUnknownOp = errors.New("unknown tag match operator") )
Functions ¶
func FromTreeToDictKey ¶
FromTreeToDictKey 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 IsAppNameRuneAllowed ¶
func IsTagKeyReserved ¶
func IsTagKeyRuneAllowed ¶
func ParseTreeKey ¶
ParseTreeKey retrieves tree time and depth level from the given key.
func ValidateAppName ¶
ValidateAppName report an error if the given app name n violates constraints.
func ValidateTagKey ¶
ValidateTagKey report an error if the given key k violates constraints.
The function should be used to validate user input. The function returns ErrTagKeyReserved if the key is valid but reserved for internal use.
Types ¶
type ByPriority ¶
type ByPriority []*TagMatcher
ByPriority is a supplemental type for sorting tag matchers.
func (ByPriority) Len ¶
func (p ByPriority) Len() int
func (ByPriority) Less ¶
func (p ByPriority) Less(i, j int) bool
func (ByPriority) Swap ¶
func (p ByPriority) Swap(i, j int)
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
func (*Key) Normalized ¶
func (*Key) SegmentKey ¶
type Op ¶
type Op int
const ( OpNotEqual Op // != OpNotEqualRegex // !~ OpEqual // = OpEqualRegex // =~ )
func (Op) IsNegation ¶
IsNegation reports whether the operator assumes negation.
type ParserState ¶
type ParserState int
type Query ¶
type Query struct { AppName string Matchers []*TagMatcher // contains filtered or unexported fields }
func ParseQuery ¶
ParseQuery parses a string of $app_name<{<$tag_matchers>}> form.
type TagMatcher ¶
func ParseMatcher ¶
func ParseMatcher(s string) (*TagMatcher, error)
ParseMatcher parses a string of $tag_key$op"$tag_value" form, where $op is one of the supported match operators.
func ParseMatchers ¶
func ParseMatchers(s string) ([]*TagMatcher, error)
ParseMatchers parses a string of $tag_matcher<,$tag_matchers> form.
func (*TagMatcher) Match ¶
func (m *TagMatcher) Match(v string) bool