summaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/metadata_exporter.lua
diff options
context:
space:
mode:
authorAlexander Moisseev <moiseev@mezonplus.ru>2017-06-03 23:21:54 +0300
committerAlexander Moisseev <moiseev@mezonplus.ru>2017-06-03 23:21:54 +0300
commit1dbc7f88efc35e6c9938071bd9b08051731c7425 (patch)
tree146f89ba84d7baac719ff94e17601b091a5b5a88 /src/plugins/lua/metadata_exporter.lua
parentaecbdfe3e81b8a71088a14b473e6e980e261c47e (diff)
downloadrspamd-1dbc7f88efc35e6c9938071bd9b08051731c7425.tar.gz
rspamd-1dbc7f88efc35e6c9938071bd9b08051731c7425.zip
[Minor] Metadata exporter: round scores in flattened metadata
Diffstat (limited to 'src/plugins/lua/metadata_exporter.lua')
-rw-r--r--src/plugins/lua/metadata_exporter.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/lua/metadata_exporter.lua b/src/plugins/lua/metadata_exporter.lua
index 416f03cab..f0b3f175d 100644
--- a/src/plugins/lua/metadata_exporter.lua
+++ b/src/plugins/lua/metadata_exporter.lua
@@ -26,7 +26,6 @@ local rspamd_http = require "rspamd_http"
local rspamd_tcp = require "rspamd_tcp"
local rspamd_util = require "rspamd_util"
local rspamd_logger = require "rspamd_logger"
-local lutil = require "lua_util"
local ucl = require "ucl"
local E = {}
local N = 'metadata_exporter'
@@ -70,7 +69,10 @@ local function get_general_metadata(task, flatten, no_content)
r.user = task:get_user() or 'unknown'
r.qid = task:get_queue_id() or 'unknown'
r.action = task:get_metric_action('default')
- r.score = lutil.round(task:get_metric_score('default')[1], 2)
+
+ local s = task:get_metric_score('default')[1]
+ r.score = flatten and string.format('%.2f', s) or s
+
local rcpt = task:get_recipients('smtp')
if rcpt then
local l = {}
@@ -98,9 +100,9 @@ local function get_general_metadata(task, flatten, no_content)
local txt
if sym.options then
local topt = table.concat(sym.options, ', ')
- txt = sym.name .. '(' .. sym.score .. ')' .. ' [' .. topt .. ']'
+ txt = sym.name .. '(' .. string.format('%.2f', sym.score) .. ')' .. ' [' .. topt .. ']'
else
- txt = sym.name .. '(' .. sym.score .. ')'
+ txt = sym.name .. '(' .. string.format('%.2f', sym.score) .. ')'
end
table.insert(l, txt)
end