Run a list of key-value pairs through a list of conditions and return the specified actions for the matching ones.
Filter rules are composed by a list of {Conditions, Actions} tuples.
Processing a span means iterating through this list and when an item
found where all Conditions evaluate to true then the Actions in that
item are collected and at the end of the evaluation returned to the
caller for execution. i.e. the filter library can be applied in different
environments.
The evaluation of the rules can run in 2 modes. The break mode means
that it stops at the first matching item and returns the Actions
specified there. The continue mode runs through all {Conditions, Actions}
items and collects all matching Actions.
The library implements the following conditions :
Check the presence of a Key
{present, Key}
Check whether 2 Keys have the same value
{same, Key1, Key2}
The value of a Key/Value pair can be compared to a value
{value, Key, ValueToCompare}
example: check the name of the span
{value, otter_span_name, "radius request"}
Checking integer values Key/Value pairs with integer values can be checked with the following conditions.
{greater, Key, Integer}
{less, Key, Integer}
{between, Key, Integer1, Integer2}
example: check whether the span duration is greater than 5 seconds
{greater, otter_span_duration, 5000000}
Negate condition check
{negate, Condition}
example: Check if the value of the "final_result" tag is other than "ok"
{negate, {value, "final_result", "ok"}}
One out of
This condition uses a random generated number and in the range of 0 < X =< Integer,
and if the generated value is 1 it returns true.
{one_out_of, Integer}
{one_out_of, 1000}
action() = tuple() | atom()
condition() = tuple()
rules() = [{[condition()], [action()]}]
tags() = [{term(), term()}]
| run/2 | Run the key-value pair data (tags) through the rules with the default
continue mode. |
| run/3 | Run the key-value pair data (tags) through the rules with the specified mode. |
Run the key-value pair data (tags) through the rules with the default
continue mode.
Run the key-value pair data (tags) through the rules with the specified mode.
Generated by EDoc, May 26 2017, 14:22:06.