The meta
library provides information about the running ruleset. The following functions are available (notice that these are values, not functions):
rid() - returns the ruleset ID of the current running ruleset.meta:
meta:version()
returns the version of the currently running ruleset.-
meta:callingRID()
returns the RID of the calling ruleset if running in a module, or the current ruleset ID otherwise.-
meta:callingVersion()
returns the version of the calling ruleset if running in a module, or the current ruleset version otherwise.-
meta:moduleRID()
returns the RID of the module if running in a module, or the current ruleset ID otherwise.-
meta:moduleVersion()
returns the version of the module if running in a module, or the current ruleset version otherwise.-
meta:inModule()
returns a Boolean value indicating whether the current code is running in a module.-
meta:host()
- returns the hostname of the rules engine evaluating the ruleset. Note: this is the public name, not the individual machine name.meta:rulesetName()
- returns the name from the meta sections of the current rulesetmeta:rulesetAuthor()
- returns the author from the meta sections of the current rulesetmeta:rulesetDescription()
- returns the description from the meta sections of the current rulesetmeta:ruleName()
- returns the names of the rule being evaluated.meta:eci()
- returns the event channel identifier on which the current event was raisedeci
- the event channel identifier on which the current event was raisedmeta:host
- the public DNS name of the machine running the engine, including port number. Does not include the trailing "/". ex. http://localhost:8080 You may configure this value when starting your pico engine. See the developer tips page to see why and how.meta:inEvent
- Boolean valuetrue
if the engine is evaluating an event for this pico,false
otherwisemeta:inQuery
- Boolean valuetrue
if the engine is evaluating a query for this pico,false
otherwisemeta:picoId
- the ID of the currently running picometa:rid -
the ruleset ID of the currently running rulesetmeta:ruleName
- the name of the rule currently being evaluatedmeta:rulesetURI
- the URL from which the currently running ruleset was registered/installedmeta:txnId
- the transaction ID for the current evaluation. This is mostly useful for debugging or as a correlation identifiermeta:rulesetConfig
- the configuration Map given when the ruleset was installed in the pico
Wrangler and Meta
Some of the data in the meta block is also available through Wrangler:
wrangler:rulesetMeta(meta:rid){"author"}
- the author from the meta section of the current ruleset
wrangler:rulesetMeta(
meta:rid){"description"} - the description
from the meta section of the current ruleset
wrangler:rulesetMeta(
meta:rid){"name"} - the name
from the meta section of the current ruleset
Note |
---|
Not Supported |
meta:callingRID()
- returns the RID of the calling ruleset if running in a module, or the current ruleset ID otherwise.meta:callingVersion()
- returns the version of the calling ruleset if running in a module, or the current ruleset version otherwise.meta:errorCount()
- returns the number of errors for current rule execution. Reset to 0 for each new rule execution.meta:inModule()
- returns a Boolean value indicating whether the current code is running in a module.
txnIdmeta:
- return the transaction ID for the current evaluation. This is mostly useful for debugging.moduleRID()
- returns the RID of the module if running in a module, or the current ruleset ID otherwise.
meta:moduleVersion()
- returns the version of the module if running in a module, or the current ruleset version otherwise.meta:version()
- returns the version of the currently running ruleset.
Note, in the case of meta:moduleRID()
, meta:moduleVersion()
, and meta:inModule()
, care has been taken to preserve static behavior. So, for example, if you do the following, you should get the result you expect based on static function semantics:
Code Block | ||||
---|---|---|---|---|
| ||||
ruleset my_module { ... global { myRid = function() { meta:moduleRID()rid } } } ruleset use_my_module { meta { use module my_module } global { x = my_module:myRid(); // x = my_module, not use_my_module } } |
...