aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/lua_selectors/extractors.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lualib/lua_selectors/extractors.lua')
-rw-r--r--lualib/lua_selectors/extractors.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/lualib/lua_selectors/extractors.lua b/lualib/lua_selectors/extractors.lua
index acb13deaa..162f01808 100644
--- a/lualib/lua_selectors/extractors.lua
+++ b/lualib/lua_selectors/extractors.lua
@@ -15,6 +15,7 @@ limitations under the License.
]]--
local fun = require 'fun'
+local meta_functions = require "lua_meta"
local lua_util = require "lua_util"
local common = require "lua_selectors/common"
local ts = require("tableshape").types
@@ -438,6 +439,21 @@ The first argument must be header name.]],
'Returns the result table. See task:get_metric_result()',
['args_schema'] = {ts.string:is_optional()}
},
+ -- Get list of metatokens as strings
+ ['metatokens'] = {
+ ['get_value'] = function(task)
+ local tokens = meta_functions.gen_metatokens(task)
+ if not tokens[1] then
+ return nil
+ end
+ local res = {}
+ for _, t in ipairs(tokens) do
+ table.insert(res, tostring(t))
+ end
+ return res, 'string_list'
+ end,
+ ['description'] = 'Get metatokens for a message as strings',
+ },
}
return extractors