summaryrefslogtreecommitdiffstats
path: root/conf.d/project/lua.d/xds-supervisor.lua
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2018-06-14 22:02:35 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2018-07-10 23:59:54 +0200
commit5d0e551a25edeba7df7f64b1370bad7558b9b2f1 (patch)
tree61b52a784c21cb81836e1475c185f9b0574002f3 /conf.d/project/lua.d/xds-supervisor.lua
parent75eb2161c641f85dded64a99cb862abfab64eff7 (diff)
Update trace event name and add grafana config
Change-Id: Id369702240b10c756ffa743309e574b2e0ed28ec Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'conf.d/project/lua.d/xds-supervisor.lua')
-rw-r--r--conf.d/project/lua.d/xds-supervisor.lua19
1 files changed, 11 insertions, 8 deletions
diff --git a/conf.d/project/lua.d/xds-supervisor.lua b/conf.d/project/lua.d/xds-supervisor.lua
index 747d33d..1058b59 100644
--- a/conf.d/project/lua.d/xds-supervisor.lua
+++ b/conf.d/project/lua.d/xds-supervisor.lua
@@ -17,7 +17,6 @@
NOTE: strict mode: every global variables should be prefixed by '_'
--]]
-
-- return serialised version of printable table
function ToJson(o)
if type(o) == "table" then
@@ -60,10 +59,10 @@ function _trace_events_(source, args, event)
["port"] = 8086,
["metric"] = {
{
- ["name"] = "supervisor/trace",
+ ["name"] = "xds/supervisor/trace",
["metadata"] = {
- ["identity"] = "xds supervisor",
- ["tag"] = event["tag"],
+ ["identity"] = "xds_supervisor",
+ ["tag"] = event["tag"]
},
["values"] = {
["id"] = event["id"]
@@ -81,25 +80,29 @@ function _trace_events_(source, args, event)
-- return
-- end
AFB:notice(source, ">>> PROCESS request %s", request)
+ query.metric[1].metadata.type = "request"
query.metric[1].metadata.api = request.api
query.metric[1].metadata.verb = request.verb
query.metric[1].metadata.action = request.action
query.metric[1].metadata.session = request.session
query.metric[1].metadata.req_index = tostring(request.index)
if event.data then
- query.metric[1].values.data = ToJson(event.data)
+ local dd = ToJson(event.data)
+ query.metric[1].values.data = dd
+ query.metric[1].values.data_bytes = string.len(dd)
end
-
elseif event.event then
local evt = event.event
AFB:notice(source, ">>> PROCESS event %s", evt)
+ query.metric[1].metadata.type = "event"
query.metric[1].metadata.id = evt.id
query.metric[1].metadata.name = evt.name
query.metric[1].metadata.action = evt.action
if event.data then
- query.metric[1].values.data = ToJson(event.data)
+ local dd = ToJson(event.data)
+ query.metric[1].values.data = dd
+ query.metric[1].values.data_bytes = string.len(dd)
end
-
else
AFB:warning(source, "--InLua-- UNKNOWN _trace_events_ event type: %s\n", Dump_Table(event))
return