Documentation
¶
Overview ¶
Package ddqp aims to provide a parser for DataDog queries so that queries can be programatically generated and parsed within Go applications/utilities.
Index ¶
- type Bool
- type ExprValue
- type Factor
- type FilterKey
- type FilterSeparator
- type FilterValue
- type FilterValueSeparator
- type Function
- type GroupedFilter
- type MetricExpression
- type MetricExpressionFormula
- type MetricExpressionParser
- type MetricFilter
- type MetricMonitor
- type MetricMonitorParser
- type MetricQuery
- type MetricQueryParser
- type OpFactor
- type OpTerm
- type Operator
- type Param
- type Query
- type SimpleFilter
- type Term
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExprValue ¶
type ExprValue struct { Subexpression *MetricExpression ` "(" @@ ")"` MetricQuery *MetricQuery `| @@` Number *float64 `| @Ident` }
func (*ExprValue) GetQueries ¶
type FilterSeparator ¶
type FilterSeparator struct { Colon bool `@":"` In bool `| @("IN" | "in") ` NotIn bool `| @("NOT" "IN" | "not" "in")` AndNot bool `| @("AND" "NOT" | "and" "not")` }
func (*FilterSeparator) String ¶
func (fs *FilterSeparator) String() string
type FilterValue ¶
func (*FilterValue) String ¶
func (fv *FilterValue) String() string
type FilterValueSeparator ¶
type FilterValueSeparator struct { Comma bool ` @","` AndNot bool `| @("AND" "NOT" | "and" "not")` And bool `| @("AND" | "and")` Or bool `| @("OR" | "or")` In bool `| @("IN" | "in")` }
func (*FilterValueSeparator) String ¶
func (fvs *FilterValueSeparator) String() string
type GroupedFilter ¶
type GroupedFilter struct {
Parameters []*Param `( @@* | "*" )?`
}
func (*GroupedFilter) String ¶
func (gf *GroupedFilter) String() string
type MetricExpression ¶
func (*MetricExpression) GetQueries ¶
func (me *MetricExpression) GetQueries() map[string]string
func (*MetricExpression) String ¶
func (me *MetricExpression) String() string
type MetricExpressionFormula ¶
MetricExpressionFormula breaks down a query into its formulaic parts
func NewMetricExpressionFormula ¶
func NewMetricExpressionFormula(expr *MetricExpression) *MetricExpressionFormula
type MetricExpressionParser ¶
type MetricExpressionParser struct {
// contains filtered or unexported fields
}
MetricExpressionParser is parser returned when calling NewMetricExpressionParser.
func NewMetricExpressionParser ¶
func NewMetricExpressionParser() *MetricExpressionParser
NewMetricExpressionParser returns a Parser which is capable of interpretting a metric expression.
func (*MetricExpressionParser) Parse ¶
func (mep *MetricExpressionParser) Parse(expr string) (*MetricExpression, error)
Parse sanitizes the query string and returns the AST and any error.
type MetricFilter ¶
type MetricFilter struct { Pos lexer.Position Left *Param `(@@ | "*" )` Parameters []*Param `( @@* )` }
func (*MetricFilter) String ¶
func (mf *MetricFilter) String() string
type MetricMonitor ¶
type MetricMonitor struct { Pos lexer.Position Aggregation string `@Ident` EvaluationWindow string `"(" @Ident ")" ":"` MetricQuery *MetricQuery `@@` Comparator string `@( ">" | ">" "=" | "<" | "<" "=" )` Threshold float64 `@(Ident)` }
func (*MetricMonitor) String ¶
func (mm *MetricMonitor) String() string
String returns the string representation of the metric monitor.
type MetricMonitorParser ¶
type MetricMonitorParser struct {
// contains filtered or unexported fields
}
MetricMonitorParser is parser returned when calling NewMetricMonitorParser.
func NewMetricMonitorParser ¶
func NewMetricMonitorParser() *MetricMonitorParser
NewMetricMonitorParser returns a Parser which is capable of interpretting a metric query.
func (*MetricMonitorParser) Parse ¶
func (mmp *MetricMonitorParser) Parse(query string) (*MetricMonitor, error)
Parse sanitizes the query string and returns the AST and any error.
type MetricQuery ¶
func (*MetricQuery) String ¶
func (mq *MetricQuery) String() string
type MetricQueryParser ¶
type MetricQueryParser struct {
// contains filtered or unexported fields
}
MetricQueryParser is parser returned when calling NewMetricQueryParser.
func NewMetricQueryParser ¶
func NewMetricQueryParser() *MetricQueryParser
NewMetricQueryParser returns a Parser which is capable of interpretting a metric query.
func (*MetricQueryParser) Parse ¶
func (mqp *MetricQueryParser) Parse(query string) (*MetricQuery, error)
Parse sanitizes the query string and returns the AST and any error.
type Param ¶
type Param struct { GroupedFilter *GroupedFilter ` "(" @@ ")"` Separator *FilterValueSeparator `| @@` SimpleFilter *SimpleFilter `| @@` Asterisk bool `| @"*"` }
type Query ¶
type Query struct { Pos lexer.Position Aggregator string `parser:"@Ident"` SpaceAggregationCondition string `parser:"( '(' @SpaceAggregatorCondition ')' )?"` Separator string `parser:"':'"` MetricName string `parser:"@Ident( @'.' @Ident)*"` Filters *MetricFilter `parser:"'{' @@ '}'"` By string `parser:"Ident?"` Grouping []string `parser:"'{'? ( @Ident ( ',' @Ident )* )? '}'?"` Function []*Function `parser:"( @@ ( '.' @@ )* )?"` }
type SimpleFilter ¶
type SimpleFilter struct { Negative bool `@"!"?` FilterKey string `@Ident` FilterSeparator *FilterSeparator `@@` FilterValue *FilterValue `@@` }
func (*SimpleFilter) String ¶
func (sf *SimpleFilter) String() string