Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Expression ¶
type Expression struct { Tag Operator ExpressionOperator RequiresNonEmptyValue bool UsesRegex bool Regex *regexp.Regexp }
func ParseExpression ¶
func ParseExpression(expression string) (Expression, error)
ParseQueryExpression takes a tag query expression as a string and validates it
func (*Expression) IsEqualTo ¶
func (e *Expression) IsEqualTo(other Expression) bool
func (*Expression) StringIntoBuilder ¶
func (e *Expression) StringIntoBuilder(builder *strings.Builder)
type ExpressionOperator ¶
type ExpressionOperator uint16
const ( EQUAL ExpressionOperator = iota // = NOT_EQUAL // != MATCH // =~ regular expression MATCH_TAG // __tag=~ relies on special key __tag. non-standard, required for `/metrics/tags` requests with "filter" NOT_MATCH // !=~ PREFIX // ^= exact prefix, not regex. non-standard, required for auto complete of tag values PREFIX_TAG // __tag^= exact prefix with tag. non-standard, required for auto complete of tag keys )
func (ExpressionOperator) StringIntoBuilder ¶
func (o ExpressionOperator) StringIntoBuilder(builder *strings.Builder)
type Expressions ¶
type Expressions []Expression
func ParseExpressions ¶
func ParseExpressions(expressions []string) (Expressions, error)
func (Expressions) Sort ¶
func (e Expressions) Sort()
Sort sorts all the expressions first by key, then by value, then by operator
func (Expressions) Strings ¶
func (e Expressions) Strings() []string
type MetaTagRecord ¶
type MetaTagRecord struct { MetaTags Tags Queries Expressions }
func ParseMetaTagRecord ¶
func ParseMetaTagRecord(metaTags []string, queries []string) (MetaTagRecord, error)
func (*MetaTagRecord) HasMetaTags ¶
func (m *MetaTagRecord) HasMetaTags() bool
HasMetaTags returns true if the meta tag record has one or more meta tags, otherwise it returns false
func (*MetaTagRecord) MatchesQueries ¶
func (m *MetaTagRecord) MatchesQueries(other MetaTagRecord) bool
MatchesQueries compares another tag record's queries to this one's queries. Returns true if they are equal, otherwise false. It is assumed that all the queries are already sorted
type Query ¶
type Query struct { // clause that operates on LastUpdate field From int64 // clauses that operate on values. from expressions like tag<operator>value Expressions map[ExpressionOperator]Expressions // clause that operate on tags (keys) // we only need to support 1 condition for now: a prefix or match TagClause ExpressionOperator // to know the clause type. either PREFIX_TAG or MATCH_TAG (or 0 if unset) TagMatch Expression // only used for /metrics/tags with regex in filter param TagPrefix string // only used for auto complete of tags to match exact prefix StartWith ExpressionOperator // choses the first clause to generate the initial result set (one of EQUAL PREFIX MATCH MATCH_TAG PREFIX_TAG) }
type Tag ¶
func (*Tag) StringIntoBuilder ¶
Click to show internal directories.
Click to hide internal directories.