Liking cljdoc? Tell your friends :D

riemann.query

The query parser. Parses strings into ASTs, and converts ASTs to functions which match events.

The query parser. Parses strings into ASTs, and converts ASTs to functions
which match events.
raw docstring

antlr->astclj

(antlr->ast [node-type & terms])

Converts a parse tree to an intermediate AST which is a little easier to analyze and work with. This is the AST we use for optimization and which is passed to various query compilers. Turns literals into their equivalent JVM types, and eliminates some unnecessary parser structure.

Converts a parse tree to an intermediate AST which is a little easier to
analyze and work with. This is the AST we use for optimization and which is
passed to various query compilers. Turns literals into their equivalent JVM
types, and eliminates some unnecessary parser structure.
sourceraw docstring

antlr-parserclj

source

astclj

(ast string)

Takes a string to a general AST.

Takes a string to a general AST.
sourceraw docstring

ast-predicateclj

(ast-predicate terms)

Rewrites predicates with and/or/not to normal Clojure forms.

Rewrites predicates with and/or/not to normal Clojure forms.
sourceraw docstring

ast-prefixclj

(ast-prefix sym [t1 _ t2])

Rewrites binary expressions from infix to prefix. Takes a symbol (e.g. '=) and a 3-element seq like (1 "=" 2) and emits (= 1 2), ignoring the middle term and transforming t1 and t2.

Rewrites binary expressions from infix to prefix. Takes a symbol `(e.g. '=)`
and a 3-element seq like `(1 "=" 2)` and emits `(= 1 2)`, ignoring the
middle term and transforming t1 and t2.
sourceraw docstring

ast-regexclj

(ast-regex type [string _ pattern])

Takes a type of match (:like or :regex), a list of three string terms: an AST resolving to a string, the literal =~ (ignored), and a pattern. Returns (:regex pattern string-ast).

For :regex matches, emits a regular expression pattern. For :like matches, emits a string pattern.

Takes a type of match (:like or :regex), a list of three string terms: an
AST resolving to a string, the literal =~ (ignored), and a pattern. Returns
`(:regex pattern string-ast)`.

For :regex matches, emits a regular expression pattern.
For :like matches, emits a string pattern.
sourceraw docstring

clj-astclj

(clj-ast ast)

Rewrites an AST to eval-able Clojure forms.

Rewrites an AST to eval-able Clojure forms.
sourceraw docstring

clj-ast-fieldclj

(clj-ast-field field)

Takes a keyword field name and emits an expression to extract that field from an 'event map, e.g. (:fieldname event).

Takes a keyword field name and emits an expression to extract that field
from an 'event map, e.g. `(:fieldname event)`.
sourceraw docstring

clj-ast-guarded-prefixclj

(clj-ast-guarded-prefix f check [a b])

Like prefix, but inserts a predicate check around both terms.

Like prefix, but inserts a predicate check around both terms.
sourceraw docstring

clj-ast-regex-matchclj

(clj-ast-regex-match pattern-transformer [pattern field])

Takes a pattern transformer, and a list of [pattern string-ast], and emits code to match the string-ast's results with a regex match, compiling pattern with pattern-transformer.

Takes a pattern transformer, and a list of [pattern string-ast], and emits
code to match the string-ast's results with a regex match, compiling pattern
with pattern-transformer.
sourceraw docstring

clj-ast-taggedclj

(clj-ast-tagged tag)

Takes a tag and emits an expression to match that tag in an event.

Takes a tag and emits an expression to match that tag in an event.
sourceraw docstring

funclj

(fun ast)

Transforms an AST into a fn [event] which returns true if the query matches that event. Example:

(def q (fun (ast "metric > 2")))
(q {:metric 1}) => false
(q {:metric 3}) => true
Transforms an AST into a fn [event] which returns true if the query matches
that event. Example:

```clojure
(def q (fun (ast "metric > 2")))
(q {:metric 1}) => false
(q {:metric 3}) => true
```
sourceraw docstring

fun-cacheclj

Speeds up the compilation of queries by caching map of ASTs to corresponding functions.

Speeds up the compilation of queries by caching map of ASTs to corresponding
functions.
sourceraw docstring

make-regexclj

(make-regex string)

Convert a string like "foo%" into /^foo.*$/

Convert a string like "foo%" into /^foo.*$/
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close