aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.vscode/launch.json4
-rw-r--r--README.md71
-rw-r--r--conf.d/project/lua.d/xds-supervisor.lua19
-rw-r--r--grafana_xds_dashboard.json919
-rw-r--r--src/plugins/supervisor.c10
5 files changed, 996 insertions, 27 deletions
diff --git a/.vscode/launch.json b/.vscode/launch.json
index a2162c2..18adaff 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -26,9 +26,7 @@
"cwd": "${workspaceRoot}/build/package",
"environment": [
],
- "windows": {
- "externalConsole": false
- },
+ "externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
diff --git a/README.md b/README.md
index bef961d..8e3613a 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@ cd agl-server-xds
## Build for AGL
```bash
-#setup your build environement
+#setup your build environment
. /xdt/sdk/environment-setup-aarch64-agl-linux
#build your application
./conf.d/autobuild/agl/autobuild package
@@ -33,24 +33,75 @@ You can also use binary package from OBS: [opensuse.org/LinuxAutomotive][opensus
### Native setup
-Here are commands used to setup some bindings in order to test on `xds-service` natively on a Linux host:
+Here are commands used to build and setup some AGL services/bindings in order to test on `xds` service natively on a Linux host.
+
+#### Build
```bash
-afs-supervisor --port 1712 --token HELLO --ws-server=unix:/tmp/supervisor -vv
+cd $ROOT_DIR/agl-service-xds
+./conf.d/autobuild/linux/autobuild build
+```
-cd $ROOT_DIR/app-framework-binder
-afb-daemon -t '' -p 5555 -M --roothttp test --ws-server unix:ave --name test_server -vv
-afb-daemon -t '' -p 4444 -M --roothttp test --no-ldpaths --ws-client unix:ave --name test_client -vv
+#### Run services/bindings
+```bash
+# Setup supervisor to supervise AGL system
+afs-supervisor --port 1712 --token HELLO --ws-server=unix:/tmp/supervisor -vv
+
+# Start harverster to save data in a TSDB
cd $ROOT_DIR/agl-service-harvester
-afb-daemon --port=1234 --workdir=./build/package --ldpaths=lib --roothttp=htdocs --token= --tracereq=common -vv --ws-server unix:/tmp/harvester
+afb-daemon --port=1234 --name=afb-harvester --workdir=./build/package --ldpaths=lib --roothttp=htdocs --token= --tracereq=common --ws-server unix:/tmp/harvester -vv
+# Start XDS collector to control supervisor
cd $ROOT_DIR/agl-service-xds
-./conf.d/autobuild/linux/autobuild build
-afb-daemon --port=5678 --name=afb-xds --workdir=./build/package --ldpaths=lib --roothttp=htdocs --token=1977 --ws-client=unix:/tmp/supervisor --ws-client=unix:/tmp/harvester -vv
+afb-daemon --port=5678 --name=afb-xds --workdir=./build/package --ldpaths=lib --roothttp=htdocs --token= --ws-client=unix:/tmp/supervisor --ws-client=unix:/tmp/harvester -vvv
+```
+
+**Example 1** : Demo based on simple helloworld AGL service
+
+``` bash
+cd $ROOT_DIR/app-framework-binder
+afb-daemon -t '' -p 5555 -M --roothttp test --ws-server unix:ave --name test_server -vvv
+afb-daemon -t '' -p 4444 -M --roothttp test --no-ldpaths --ws-client unix:ave --name test_client -vvv
+
+# Get bindings list
+afb-client-demo --raw 'localhost:5678/api?token=1977&uuid=magic' xds list | jq .response[].pid
+
+# Request monitoring of socket "unix:ave"
+afb-client-demo 'localhost:5678/api?token=HELLO&uuid=c' xds trace '{"ws":"unix:ave"}'
+
+# Call ping verb of hello api (should be spy by supervision/monitoring)
+afb-client-demo 'localhost:5555/api?token=toto&uuid=magic' hello ping
+
+# Same call some other verbs of hello api
+afb-client-demo 'localhost:5555/api?token=toto&uuid=magic' hello eventadd '{"tag":"x","name":"event"}'
+afb-client-demo 'localhost:5555/api?token=toto&uuid=magic' hello eventsub '{"tag":"x"}'
+afb-client-demo 'localhost:5555/api?token=toto&uuid=magic' hello eventpush '{"tag":"x","data":true}'
+
+# Dump data from TSDB
+influx -database 'agl-garner' -execute 'show series'
+influx -database 'agl-garner' -execute 'select * from "xds/supervisor/trace"'
```
-afb-client-demo -H 'localhost:5678/api?token=1977&uuid=magic' xds list
+**Example 2**: Demo based on AGL mockup services
+
+```bash
+# Monitor AGL mockup services
+cd $ROOT_DIR/agl-services-mockup && start_agl_mockup.sh 1
+# ... at this point script stop and wait user...
+
+# In another shell, execute following commands to request monitoring of can_emul and gps_emul sockets
+afb-client-demo 'localhost:5678/api?token=HELLO&uuid=c' xds trace '{"ws":"can_emul"}'
+afb-client-demo 'localhost:5678/api?token=HELLO&uuid=c' xds trace '{"ws":"gps_emul"}'
+
+# Press any key in 1 shell to continue start_agl_mockup.sh script
+
+# Dump data from TSDB
+influx -database 'agl-garner' -execute 'select * from "xds/supervisor/trace"'
+
+# Drop data
+# influx -database 'agl-garner' -execute 'drop measurement "xds/supervisor/trace"'
+```
## Deploy
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
diff --git a/grafana_xds_dashboard.json b/grafana_xds_dashboard.json
new file mode 100644
index 0000000..36642c2
--- /dev/null
+++ b/grafana_xds_dashboard.json
@@ -0,0 +1,919 @@
+{
+ "annotations": {
+ "list": [
+ {
+ "builtIn": 1,
+ "datasource": "-- Grafana --",
+ "enable": true,
+ "hide": true,
+ "iconColor": "rgba(0, 211, 255, 1)",
+ "name": "Annotations & Alerts",
+ "type": "dashboard"
+ }
+ ]
+ },
+ "editable": true,
+ "gnetId": null,
+ "graphTooltip": 0,
+ "id": 1,
+ "links": [],
+ "panels": [
+ {
+ "cacheTimeout": null,
+ "colorBackground": false,
+ "colorValue": false,
+ "colors": [
+ "#299c46",
+ "rgba(237, 129, 40, 0.89)",
+ "#d44a3a"
+ ],
+ "datasource": "influxdb seb-laptop",
+ "format": "none",
+ "gauge": {
+ "maxValue": 100,
+ "minValue": 0,
+ "show": true,
+ "thresholdLabels": false,
+ "thresholdMarkers": true
+ },
+ "gridPos": {
+ "h": 3,
+ "w": 2,
+ "x": 0,
+ "y": 0
+ },
+ "id": 9,
+ "interval": null,
+ "links": [],
+ "mappingType": 1,
+ "mappingTypes": [
+ {
+ "name": "value to text",
+ "value": 1
+ },
+ {
+ "name": "range to text",
+ "value": 2
+ }
+ ],
+ "maxDataPoints": 100,
+ "nullPointMode": "connected",
+ "nullText": null,
+ "postfix": "",
+ "postfixFontSize": "50%",
+ "prefix": "",
+ "prefixFontSize": "50%",
+ "rangeMaps": [
+ {
+ "from": "null",
+ "text": "N/A",
+ "to": "null"
+ }
+ ],
+ "sparkline": {
+ "fillColor": "rgba(31, 118, 189, 0.18)",
+ "full": false,
+ "lineColor": "rgb(31, 120, 193)",
+ "show": false
+ },
+ "tableColumn": "id",
+ "targets": [
+ {
+ "groupBy": [],
+ "measurement": "xds/supervisor/trace",
+ "orderByTime": "ASC",
+ "policy": "default",
+ "refId": "A",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "id"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "count"
+ }
+ ]
+ ],
+ "tags": []
+ }
+ ],
+ "thresholds": "",
+ "title": "Number of Traces",
+ "type": "singlestat",
+ "valueFontSize": "80%",
+ "valueMaps": [
+ {
+ "op": "=",
+ "text": "N/A",
+ "value": "null"
+ }
+ ],
+ "valueName": "current"
+ },
+ {
+ "aliasColors": {},
+ "bars": true,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": "influxdb seb-laptop",
+ "fill": 1,
+ "gridPos": {
+ "h": 9,
+ "w": 11,
+ "x": 2,
+ "y": 0
+ },
+ "id": 12,
+ "legend": {
+ "alignAsTable": true,
+ "avg": false,
+ "current": false,
+ "hideEmpty": false,
+ "max": true,
+ "min": false,
+ "rightSide": true,
+ "show": true,
+ "total": false,
+ "values": true
+ },
+ "lines": false,
+ "linewidth": 1,
+ "links": [],
+ "nullPointMode": "null",
+ "percentage": false,
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "alias": "Events",
+ "groupBy": [
+ {
+ "params": [
+ "1s"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "hide": false,
+ "measurement": "xds/supervisor/trace",
+ "orderByTime": "ASC",
+ "policy": "default",
+ "query": "SELECT non_negative_derivative(mean(\"value\"), 1s) FROM \"supervisor/trace\" WHERE (\"tag\" = 'xds:*/event') AND time > now() - time($__interval) GROUP BY time(10s)",
+ "rawQuery": false,
+ "refId": "A",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "id"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "count"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "type",
+ "operator": "=",
+ "value": "event"
+ }
+ ]
+ },
+ {
+ "alias": "Requests",
+ "groupBy": [
+ {
+ "params": [
+ "1s"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "hide": false,
+ "measurement": "xds/supervisor/trace",
+ "orderByTime": "ASC",
+ "policy": "default",
+ "query": "SELECT non_negative_derivative(mean(\"value\"), 1s) FROM \"supervisor/trace\" WHERE (\"tag\" = 'xds:*/event') AND time > now() - time($__interval) GROUP BY time(10s)",
+ "rawQuery": false,
+ "refId": "B",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "id"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "count"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "type",
+ "operator": "=",
+ "value": "request"
+ }
+ ]
+ }
+ ],
+ "thresholds": [
+ {
+ "colorMode": "critical",
+ "fill": true,
+ "line": true,
+ "op": "gt",
+ "value": 30,
+ "yaxis": "left"
+ }
+ ],
+ "timeFrom": null,
+ "timeShift": null,
+ "title": "Requests & Events per second",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "transparent": false,
+ "type": "graph",
+ "xaxis": {
+ "buckets": null,
+ "mode": "time",
+ "name": null,
+ "show": true,
+ "values": []
+ },
+ "yaxes": [
+ {
+ "decimals": null,
+ "format": "short",
+ "label": null,
+ "logBase": 1,
+ "max": "35",
+ "min": null,
+ "show": true
+ },
+ {
+ "format": "short",
+ "label": null,
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ }
+ ],
+ "yaxis": {
+ "align": false,
+ "alignLevel": null
+ }
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": "influxdb seb-laptop",
+ "fill": 1,
+ "gridPos": {
+ "h": 9,
+ "w": 11,
+ "x": 13,
+ "y": 0
+ },
+ "id": 5,
+ "legend": {
+ "avg": false,
+ "current": false,
+ "max": false,
+ "min": false,
+ "show": true,
+ "total": false,
+ "values": false
+ },
+ "lines": true,
+ "linewidth": 1,
+ "links": [],
+ "nullPointMode": "null",
+ "percentage": false,
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "groupBy": [],
+ "hide": false,
+ "measurement": "xds/supervisor/trace",
+ "orderByTime": "ASC",
+ "policy": "default",
+ "query": "SELECT \"data_bytes\" FROM \"supervisor/trace\" WHERE (\"tag\" = 'xds:*/event') AND $timeFilter",
+ "rawQuery": false,
+ "refId": "A",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "data_bytes"
+ ],
+ "type": "field"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "type",
+ "operator": "=",
+ "value": "event"
+ }
+ ]
+ }
+ ],
+ "thresholds": [],
+ "timeFrom": null,
+ "timeShift": null,
+ "title": "Events Data bytes",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "xaxis": {
+ "buckets": null,
+ "mode": "time",
+ "name": null,
+ "show": true,
+ "values": []
+ },
+ "yaxes": [
+ {
+ "format": "short",
+ "label": null,
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ },
+ {
+ "format": "short",
+ "label": null,
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ }
+ ],
+ "yaxis": {
+ "align": false,
+ "alignLevel": null
+ }
+ },
+ {
+ "cacheTimeout": null,
+ "colorBackground": false,
+ "colorValue": false,
+ "colors": [
+ "#299c46",
+ "rgba(237, 129, 40, 0.89)",
+ "#d44a3a"
+ ],
+ "datasource": "influxdb seb-laptop",
+ "format": "none",
+ "gauge": {
+ "maxValue": 100,
+ "minValue": 0,
+ "show": true,
+ "thresholdLabels": false,
+ "thresholdMarkers": true
+ },
+ "gridPos": {
+ "h": 3,
+ "w": 2,
+ "x": 0,
+ "y": 3
+ },
+ "id": 8,
+ "interval": null,
+ "links": [],
+ "mappingType": 1,
+ "mappingTypes": [
+ {
+ "name": "value to text",
+ "value": 1
+ },
+ {
+ "name": "range to text",
+ "value": 2
+ }
+ ],
+ "maxDataPoints": 100,
+ "nullPointMode": "connected",
+ "nullText": null,
+ "postfix": "",
+ "postfixFontSize": "50%",
+ "prefix": "",
+ "prefixFontSize": "50%",
+ "rangeMaps": [
+ {
+ "from": "null",
+ "text": "N/A",
+ "to": "null"
+ }
+ ],
+ "sparkline": {
+ "fillColor": "rgba(31, 118, 189, 0.18)",
+ "full": false,
+ "lineColor": "rgb(31, 120, 193)",
+ "show": false
+ },
+ "tableColumn": "id",
+ "targets": [
+ {
+ "groupBy": [],
+ "measurement": "xds/supervisor/trace",
+ "orderByTime": "ASC",
+ "policy": "default",
+ "refId": "A",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "id"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "count"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "type",
+ "operator": "=",
+ "value": "request"
+ }
+ ]
+ }
+ ],
+ "thresholds": "",
+ "title": "Nb Requests",
+ "type": "singlestat",
+ "valueFontSize": "80%",
+ "valueMaps": [
+ {
+ "op": "=",
+ "text": "N/A",
+ "value": "null"
+ }
+ ],
+ "valueName": "current"
+ },
+ {
+ "cacheTimeout": null,
+ "colorBackground": false,
+ "colorValue": false,
+ "colors": [
+ "#299c46",
+ "rgba(237, 129, 40, 0.89)",
+ "#d44a3a"
+ ],
+ "datasource": "influxdb seb-laptop",
+ "format": "none",
+ "gauge": {
+ "maxValue": 100,
+ "minValue": 0,
+ "show": true,
+ "thresholdLabels": false,
+ "thresholdMarkers": true
+ },
+ "gridPos": {
+ "h": 3,
+ "w": 2,
+ "x": 0,
+ "y": 6
+ },
+ "id": 13,
+ "interval": null,
+ "links": [],
+ "mappingType": 1,
+ "mappingTypes": [
+ {
+ "name": "value to text",
+ "value": 1
+ },
+ {
+ "name": "range to text",
+ "value": 2
+ }
+ ],
+ "maxDataPoints": 100,
+ "nullPointMode": "connected",
+ "nullText": null,
+ "postfix": "",
+ "postfixFontSize": "50%",
+ "prefix": "",
+ "prefixFontSize": "50%",
+ "rangeMaps": [
+ {
+ "from": "null",
+ "text": "N/A",
+ "to": "null"
+ }
+ ],
+ "sparkline": {
+ "fillColor": "rgba(31, 118, 189, 0.18)",
+ "full": false,
+ "lineColor": "rgb(31, 120, 193)",
+ "show": false
+ },
+ "tableColumn": "id",
+ "targets": [
+ {
+ "groupBy": [],
+ "measurement": "xds/supervisor/trace",
+ "orderByTime": "ASC",
+ "policy": "default",
+ "refId": "A",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "id"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "count"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "type",
+ "operator": "=",
+ "value": "event"
+ }
+ ]
+ }
+ ],
+ "thresholds": "",
+ "title": "Nb Events",
+ "type": "singlestat",
+ "valueFontSize": "80%",
+ "valueMaps": [
+ {
+ "op": "=",
+ "text": "N/A",
+ "value": "null"
+ }
+ ],
+ "valueName": "current"
+ },
+ {
+ "columns": [],
+ "datasource": "influxdb seb-laptop",
+ "fontSize": "100%",
+ "gridPos": {
+ "h": 17,
+ "w": 24,
+ "x": 0,
+ "y": 9
+ },
+ "id": 2,
+ "links": [],
+ "pageSize": null,
+ "scroll": true,
+ "showHeader": true,
+ "sort": {
+ "col": 0,
+ "desc": true
+ },
+ "styles": [
+ {
+ "alias": "Time",
+ "dateFormat": "YYYY-MM-DD HH:mm:ss",
+ "pattern": "Time",
+ "type": "date"
+ },
+ {
+ "alias": "",
+ "colorMode": null,
+ "colors": [
+ "rgba(245, 54, 54, 0.9)",
+ "rgba(237, 129, 40, 0.89)",
+ "rgba(50, 172, 45, 0.97)"
+ ],
+ "decimals": 2,
+ "pattern": "/.*/",
+ "thresholds": [],
+ "type": "number",
+ "unit": "short"
+ }
+ ],
+ "targets": [
+ {
+ "$$hashKey": "object:253",
+ "groupBy": [],
+ "hide": false,
+ "measurement": "xds/supervisor/trace",
+ "orderByTime": "ASC",
+ "policy": "default",
+ "query": "SELECT \"id\", \"req_index\", \"api\", \"verb\", \"name\", \"tag\", \"session\", \"data\", \"data_bytes\", \"index_id\" FROM \"supervisor/trace\" WHERE $timeFilter",
+ "rawQuery": false,
+ "refId": "A",
+ "resultFormat": "table",
+ "select": [
+ [
+ {
+ "params": [
+ "id"
+ ],
+ "type": "field"
+ }
+ ],
+ [
+ {
+ "params": [
+ "req_index"
+ ],
+ "type": "field"
+ }
+ ],
+ [
+ {
+ "params": [
+ "api"
+ ],
+ "type": "field"
+ }
+ ],
+ [
+ {
+ "params": [
+ "verb"
+ ],
+ "type": "field"
+ }
+ ],
+ [
+ {
+ "params": [
+ "action"
+ ],
+ "type": "field"
+ }
+ ],
+ [
+ {
+ "params": [
+ "name"
+ ],
+ "type": "field"
+ }
+ ],
+ [
+ {
+ "params": [
+ "type"
+ ],
+ "type": "field"
+ }
+ ],
+ [
+ {
+ "params": [
+ "session"
+ ],
+ "type": "field"
+ }
+ ],
+ [
+ {
+ "params": [
+ "data"
+ ],
+ "type": "field"
+ }
+ ],
+ [
+ {
+ "params": [
+ "data_bytes"
+ ],
+ "type": "field"
+ }
+ ]
+ ],
+ "tags": []
+ }
+ ],
+ "title": "Supervisor traces table",
+ "transform": "table",
+ "type": "table"
+ },
+ {
+ "columns": [],
+ "datasource": "influxdb seb-laptop",
+ "fontSize": "100%",
+ "gridPos": {
+ "h": 9,
+ "w": 24,
+ "x": 0,
+ "y": 26
+ },
+ "id": 3,
+ "interval": "",
+ "links": [],
+ "pageSize": null,
+ "scroll": true,
+ "showHeader": true,
+ "sort": {
+ "col": 7,
+ "desc": false
+ },
+ "styles": [
+ {
+ "alias": "Time",
+ "dateFormat": "YYYY-MM-DD HH:mm:ss",
+ "pattern": "Time",
+ "type": "date"
+ },
+ {
+ "alias": "",
+ "colorMode": null,
+ "colors": [
+ "rgba(245, 54, 54, 0.9)",
+ "rgba(237, 129, 40, 0.89)",
+ "rgba(50, 172, 45, 0.97)"
+ ],
+ "decimals": 2,
+ "pattern": "/.*/",
+ "thresholds": [],
+ "type": "number",
+ "unit": "short"
+ }
+ ],
+ "targets": [
+ {
+ "groupBy": [],
+ "hide": false,
+ "measurement": "supervisor/trace",
+ "orderByTime": "ASC",
+ "policy": "default",
+ "query": "SELECT \"action\", \"id\", \"api\", \"verb\", \"name\", \"session\", \"req_index\" FROM \"xds/supervisor/trace\" WHERE (\"type\" = 'request') AND $timeFilter",
+ "rawQuery": true,
+ "refId": "A",
+ "resultFormat": "table",
+ "select": [
+ [
+ {
+ "params": [
+ "action"
+ ],
+ "type": "field"
+ }
+ ],
+ [
+ {
+ "params": [
+ "id"
+ ],
+ "type": "field"
+ }
+ ],
+ [
+ {
+ "params": [
+ "api"
+ ],
+ "type": "field"
+ }
+ ],
+ [
+ {
+ "params": [
+ "verb"
+ ],
+ "type": "field"
+ }
+ ],
+ [
+ {
+ "params": [
+ "name"
+ ],
+ "type": "field"
+ }
+ ],
+ [
+ {
+ "params": [
+ "session"
+ ],
+ "type": "field"
+ }
+ ],
+ [
+ {
+ "params": [
+ "req_index"
+ ],
+ "type": "field"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "tag",
+ "operator": "=",
+ "value": "xds:*/request"
+ }
+ ]
+ }
+ ],
+ "title": "Requests",
+ "transform": "table",
+ "type": "table"
+ }
+ ],
+ "refresh": false,
+ "schemaVersion": 16,
+ "style": "dark",
+ "tags": [],
+ "templating": {
+ "list": []
+ },
+ "time": {
+ "from": "2018-06-14T15:03:47.885Z",
+ "to": "2018-06-14T15:04:03.173Z"
+ },
+ "timepicker": {
+ "refresh_intervals": [
+ "5s",
+ "10s",
+ "30s",
+ "1m",
+ "5m",
+ "15m",
+ "30m",
+ "1h",
+ "2h",
+ "1d"
+ ],
+ "time_options": [
+ "5m",
+ "15m",
+ "1h",
+ "6h",
+ "12h",
+ "24h",
+ "2d",
+ "7d",
+ "30d"
+ ]
+ },
+ "timezone": "",
+ "title": "AGL XDS Supervisor",
+ "uid": "Lbpwc6Iiz",
+ "version": 28
+}
diff --git a/src/plugins/supervisor.c b/src/plugins/supervisor.c
index 503609a..e3c71c0 100644
--- a/src/plugins/supervisor.c
+++ b/src/plugins/supervisor.c
@@ -167,8 +167,8 @@ int getDaemons(AFB_ApiT apiHandle, DAEMONS_T** daemons)
return rc;
}
-#define XDS_TAG_REQUEST "xds:*/request"
-#define XDS_TAG_EVENT "xds:*/event"
+#define XDS_TAG_REQUEST "xds:trace/request"
+#define XDS_TAG_EVENT "xds:trace/event"
#define XDS_TRACE_NAME "xds-trace"
int trace_exchange(AFB_ApiT apiHandle, DAEMON_T* svr, DAEMON_T* cli, const char* level)
@@ -181,7 +181,7 @@ int trace_exchange(AFB_ApiT apiHandle, DAEMON_T* svr, DAEMON_T* cli, const char*
}
// First drop previous traces
- // monitor/trace({ "drop": { "tag": "*/request" } })
+ // monitor/trace({ "drop": { "tag": "trace/request" } })
// Note: ignored error (expected 1st time/when no trace exist)
wrap_json_pack(&j_query, "{s:i s:{s:[s s]}}", "pid", svr->pid,
"drop", "tag", XDS_TAG_REQUEST, XDS_TAG_EVENT);
@@ -209,7 +209,7 @@ int trace_exchange(AFB_ApiT apiHandle, DAEMON_T* svr, DAEMON_T* cli, const char*
json_object_get(j_traceevt); // because use 2 times to configure both server and client
// Configure trace for server daemon
- // request: monitor/trace({ "add": { "tag": "xds:*/request", "name": "trace", "request": "all" } })
+ // request: monitor/trace({ "add": { "tag": "xds:trace/request", "name": "trace", "request": "all" } })
wrap_json_pack(&j_query, "{s:i, s: [{s:s s:s s:o}, {s:s s:s s:o}] }",
"pid", svr->pid, "add",
"tag", XDS_TAG_REQUEST, "name", XDS_TRACE_NAME, "request", j_tracereq,
@@ -223,7 +223,6 @@ int trace_exchange(AFB_ApiT apiHandle, DAEMON_T* svr, DAEMON_T* cli, const char*
// Configure trace for client daemon(s)
// request: monitor/trace({ "pid": 1234, "add": { "event": "all" } })
-#if 1 // SEB
wrap_json_pack(&j_query, "{s:i, s: [{s:s s:s s:o}, {s:s s:s s:o}] }",
"pid", cli->pid, "add",
"tag", XDS_TAG_REQUEST, "name", XDS_TRACE_NAME, "request", j_tracereq,
@@ -234,7 +233,6 @@ int trace_exchange(AFB_ApiT apiHandle, DAEMON_T* svr, DAEMON_T* cli, const char*
json_object_to_json_string(j_response));
return rc;
}
-#endif
return 0;
}