aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/metric_exporter.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-03-27 10:01:43 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-03-27 10:01:43 +0100
commitad6158684c8ca07d105f3ffefc8124332a08e67f (patch)
treec982be6f4f70b1f2d47fc77b5f38fa79563a353f /src/plugins/lua/metric_exporter.lua
parent93fd1765f6e00f6a38510d379d1d27507d0be02f (diff)
downloadrspamd-ad6158684c8ca07d105f3ffefc8124332a08e67f.tar.gz
rspamd-ad6158684c8ca07d105f3ffefc8124332a08e67f.zip
[Minor] Use table for strings concatenation
Diffstat (limited to 'src/plugins/lua/metric_exporter.lua')
-rw-r--r--src/plugins/lua/metric_exporter.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/lua/metric_exporter.lua b/src/plugins/lua/metric_exporter.lua
index 2a2ebb597..5da1cf7ec 100644
--- a/src/plugins/lua/metric_exporter.lua
+++ b/src/plugins/lua/metric_exporter.lua
@@ -102,7 +102,7 @@ local function graphite_push(kwargs)
else
stamp = math.floor(util.get_time())
end
- local metrics_str = ''
+ local metrics_str = {}
for _, v in ipairs(settings['metrics']) do
local mvalue
local mname = string.format('%s.%s', settings['metric_prefix'], v:gsub(' ', '_'))
@@ -112,9 +112,11 @@ local function graphite_push(kwargs)
elseif #split == 2 then
mvalue = kwargs['stats'][split[1]][split[2]]
end
- metrics_str = metrics_str .. string.format('%s %s %s\n', mname, mvalue, stamp)
+ metrics_str:insert(string.format('%s %s %s', mname, mvalue, stamp))
end
- metrics_str = metrics_str .. '\n'
+
+ metrics_str = metrics_str:concat('\n')
+
tcp.request({
ev_base = kwargs['ev_base'],
pool = pool,