X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=src%2Fapp-framework-binder.git;a=blobdiff_plain;f=memo-supervisor.txt;h=f38c05d8792c8ec41afd61e160342a8422971808;hp=6d901003dada95d799f30b0a5dee545365e1898a;hb=ca0f859d96599c8ae295c85f825030c891969de1;hpb=6e11db3cd27b40bdfbf2f1b032cd912a1eb8f156 diff --git a/memo-supervisor.txt b/memo-supervisor.txt index 6d901003..f38c05d8 100644 --- a/memo-supervisor.txt +++ b/memo-supervisor.txt @@ -2,29 +2,16 @@ Run the supervisor on the target for the public IP: --------------------------------------------------- - # ip address show + # afs-supervisor --port 1619 --token HELLO - 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 - link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 - inet 127.0.0.1/8 scope host lo - valid_lft forever preferred_lft forever - 2: eth0: mtu 1500 qdisc mq state UP group default qlen 1000 - link/ether ee:85:bb:23:a2:26 brd ff:ff:ff:ff:ff:ff - inet 192.168.0.34/24 brd 192.168.0.255 scope global eth0 - valid_lft forever preferred_lft forever +Run the client +-------------- - # afs-supervisor 192.168.0.34:5555/supervisor + # afb-client-demo -H host:1619/api?token=HELLO -Run the direct client ---------------------- - # afb-client-demo -H -d 192.168.0.34:5555/ - -It is an issue that supervisor provides a direct client. -This may change in some future to include HTTP websocket negociation and token exchange. - -Commands that can be run: -------------------------- +verbs that can be run, all are of the API 'supervisor': +------------------------------------------------------- - discover @@ -62,1041 +49,247 @@ Commands that can be run: execute the API/VERB(ARGS) for the daemon of pid X - usefull for (s/g)etting monitor info. ex: monitor/get({"apis":true}) + useful for (s/g)etting monitor info. ex: monitor/get({"apis":true}) bound to the current client session (to be checked: usurpation of session?) - trace {"pid":X, ...} - like monitor/trace but not bound to session (in the future monitor/trace + like monitor/trace but not bound to session (in the future monitor/trace will be bound to sessions) allows to trace specific session or any session - actually events generated by tracing are named with the prefix - "$/" (that is the internal prefix of supervision in binders) - could change in future - the pid isn't returned in the event (not sure to want it but open...) - use "name" and "tag" feature of "trace" to discrimate events on the client side. + use "name" and "tag" feature of "trace" to discriminate events on the client side. Examples of dialog: ------------------- -discover -ON-REPLY-SUCCESS 1:discover: -null - - -list -ON-REPLY-SUCCESS 2:list: +supervisor discover +ON-REPLY 1:supervisor/discover: OK { - "4123":{ - "pid":4123, - "uid":0, - "gid":0, - "id":"nfc-binding", - "label":"User::App::nfc-binding", - "user":"0" - }, - "4120":{ - "pid":4120, - "uid":0, - "gid":0, - "id":"homescreen-service-2017", - "label":"User::App::homescreen-service-2017", - "user":"0" - }, - "4119":{ - "pid":4119, - "uid":0, - "gid":0, - "id":"homescreen-2017", - "label":"User::App::homescreen-2017", - "user":"0" - }, - "4118":{ - "pid":4118, - "uid":0, - "gid":0, - "id":"agl-service-wifi", - "label":"User::App::agl-service-wifi", - "user":"0" - }, - "4117":{ - "pid":4117, - "uid":0, - "gid":0, - "id":"windowmanager-service-2017", - "label":"User::App::windowmanager-service-2017", - "user":"0" - }, - "4116":{ - "pid":4116, - "uid":0, - "gid":0, - "id":"agl-service-geoclue", - "label":"User::App::agl-service-geoclue", - "user":"0" - }, - "4115":{ - "pid":4115, - "uid":0, - "gid":0, - "id":"persistence-binding", - "label":"User::App::persistence-binding", - "user":"0" - }, - "4113":{ - "pid":4113, - "uid":0, - "gid":0, - "id":"agl-service-bluetooth", - "label":"User::App::agl-service-bluetooth", - "user":"0" - }, - "4114":{ - "pid":4114, - "uid":0, - "gid":0, - "id":"agl-identity-service", - "label":"User::App::agl-identity-service", - "user":"0" - }, - "4112":{ - "pid":4112, - "uid":0, - "gid":0, - "id":"agl-service-unicens", - "label":"User::App::agl-service-unicens", - "user":"0" - }, - "3734":{ - "pid":3734, - "uid":0, - "gid":0, - "id":"System", - "label":"System", - "user":"0" + "jtype":"afb-reply", + "request":{ + "status":"success", + "uuid":"22563ce6-e07f-4284-91f8-e7eb7ec4ef21" } } -config {"pid":4117} -ON-REPLY-SUCCESS 4:config: +supervisor list +ON-REPLY 2:supervisor/list: OK { - "console":".\/AFB-console.out", - "rootdir":"\/var\/local\/lib\/afm\/applications\/windowmanager-service-2017\/0.1", - "roothttp":".", - "rootbase":"\/opa", - "rootapi":"\/api", - "workdir":"\/home\/0\/app-data\/windowmanager-service-2017", - "uploaddir":".", - "token":"HELLO", - "name":"afbd-windowmanager-service-2017@0.1", - "aliases":[ - "\/monitoring" - ], - "dbus_clients":[ - ], - "dbus_servers":[ - ], - "ws_clients":[ - ], - "ws_servers":[ - "sd:windowmanager" - ], - "so_bindings":[ - "\/var\/local\/lib\/afm\/applications\/windowmanager-service-2017\/0.1\/lib\/windowmanager-service.so" - ], - "ldpaths":[ - "\/usr\/lib\/afb" - ], - "weak_ldpaths":[ - ], - "calls":[ - ], - "exec":[ - ], - "httpdPort":1039, - "cacheTimeout":100000, - "apiTimeout":20, - "cntxTimeout":32000000, - "nbSessionMax":10, - "mode":"local", - "tracereq":"no", - "traceditf":"no", - "tracesvc":"no", - "traceevt":"no", - "no_ldpaths":false, - "noHttpd":false, - "background":false, - "monitoring":true, - "random_token":false + "response":{ + "7054":{ + "pid":7054, + "uid":1001, + "gid":1001, + "id":"NoLabel", + "label":"NoLabel", + "user":"1001" + } + }, + "jtype":"afb-reply", + "request":{ + "status":"success" + } } -sessions {"pid":4117} -ON-REPLY-SUCCESS 5:sessions: + +supervisor config {"pid":7054} +ON-REPLY 3:supervisor/config: OK { - "afb-client-demo":{ - "token":"HELLO" + "response":{ + "console":".\/AFB-console.out", + "rootdir":".", + "roothttp":"..\/test", + "rootbase":"\/opa", + "rootapi":"\/api", + "workdir":".", + "uploaddir":".", + "token":"", + "name":null, + "aliases":[ + "\/monitoring" + ], + "dbus_clients":[ + ], + "dbus_servers":[ + ], + "ws_clients":[ + ], + "ws_servers":[ + ], + "so_bindings":[ + ], + "ldpaths":[ + "\/opt\/jobol\/lib64\/afb" + ], + "weak_ldpaths":[ + ], + "calls":[ + ], + "exec":[ + ], + "httpdPort":5555, + "cacheTimeout":100000, + "apiTimeout":20, + "cntxTimeout":32000000, + "nbSessionMax":10, + "mode":"local", + "tracereq":"no", + "traceditf":"no", + "tracesvc":"no", + "traceevt":"no", + "traceses":"no", + "no_ldpaths":false, + "noHttpd":false, + "background":false, + "monitoring":true, + "random_token":false }, - "fa050ca1-80b4-41af-bf72-4a1a8e7ee5b6":{ - "token":"HELLO" + "jtype":"afb-reply", + "request":{ + "status":"success" } } -do {"pid":4117,"api":"monitor","verb":"get","args":{"apis":true}} -ON-REPLY-SUCCESS 6:do: + + + +supervisor sessions {"pid":7054} +ON-REPLY 4:supervisor/sessions: OK { - "apis":{ - "monitor":{ - "openapi":"3.0.0", - "info":{ - "description":"monitoring of bindings and internals", - "title":"monitor", - "version":"1.0", - "x-binding-c-generator":{ - "api":"monitor", - "version":2, - "prefix":"f_", - "postfix":"", - "preinit":null, - "init":null, - "onevent":null, - "scope":"static", - "private":true - } - }, - "servers":[ - { - "url":"ws:\/\/{host}:{port}\/api\/monitor", - "description":"The API server.", - "variables":{ - "host":{ - "default":"localhost" - }, - "port":{ - "default":"1234" - } - }, - "x-afb-events":[ - { - "$ref":"#\/components\/schemas\/afb-event" - } - ] - } - ], - "components":{ - "schemas":{ - "afb-reply":{ - "$ref":"#\/components\/schemas\/afb-reply-v1" - }, - "afb-event":{ - "$ref":"#\/components\/schemas\/afb-event-v1" - }, - "afb-reply-v1":{ - "title":"Generic response.", - "type":"object", - "required":[ - "jtype", - "request" - ], - "properties":{ - "jtype":{ - "type":"string", - "const":"afb-reply" - }, - "request":{ - "type":"object", - "required":[ - "status" - ], - "properties":{ - "status":{ - "type":"string" - }, - "info":{ - "type":"string" - }, - "token":{ - "type":"string" - }, - "uuid":{ - "type":"string" - }, - "reqid":{ - "type":"string" - } - } - }, - "response":{ - "type":"object" - } - } - }, - "afb-event-v1":{ - "type":"object", - "required":[ - "jtype", - "event" - ], - "properties":{ - "jtype":{ - "type":"string", - "const":"afb-event" - }, - "event":{ - "type":"string" - }, - "data":{ - "type":"object" - } - } - }, - "set-verbosity":{ - "anyOf":[ - { - "$ref":"#\/components\/schemas\/verbosity-map" - }, - { - "$ref":"#\/components\/schemas\/verbosity-level" - } - ] - }, - "get-request":{ - "type":"object", - "properties":{ - "verbosity":{ - "$ref":"#\/components\/schemas\/get-verbosity" - }, - "apis":{ - "$ref":"#\/components\/schemas\/get-apis" - } - } - }, - "get-response":{ - "type":"object", - "properties":{ - "verbosity":{ - "$ref":"#\/components\/schemas\/verbosity-map" - }, - "apis":{ - "type":"object" - } - } - }, - "get-verbosity":{ - "anyOf":[ - { - "type":"boolean" - }, - { - "type":"array", - "items":{ - "type":"string" - } - }, - { - "type":"object" - } - ] - }, - "get-apis":{ - "anyOf":[ - { - "type":"boolean" - }, - { - "type":"array", - "items":{ - "type":"string" - } - }, - { - "type":"object" - } - ] - }, - "verbosity-map":{ - "type":"object", - "patternProperties":{ - "^.*$":{ - "$ref":"#\/components\/schemas\/verbosity-level" - } - } - }, - "verbosity-level":{ - "enum":[ - "debug", - 3, - "info", - 2, - "notice", - "warning", - 1, - "error", - 0 - ] - }, - "trace-add":{ - "anyOf":[ - { - "type":"array", - "items":{ - "$ref":"#\/components\/schemas\/trace-add-object" - } - }, - { - "$ref":"#\/components\/schemas\/trace-add-any" - } - ] - }, - "trace-add-any":{ - "anyOf":[ - { - "$ref":"#\/components\/schemas\/trace-add-request" - }, - { - "$ref":"#\/components\/schemas\/trace-add-object" - } - ] - }, - "trace-add-object":{ - "type":"object", - "properties":{ - "name":{ - "type":"string", - "description":"name of the generated event", - "default":"trace" - }, - "tag":{ - "type":"string", - "description":"tag for grouping traces", - "default":"trace" - }, - "api":{ - "type":"string", - "description":"api for requests, daemons and services" - }, - "verb":{ - "type":"string", - "description":"verb for requests" - }, - "uuid":{ - "type":"string", - "description":"uuid of session for requests" - }, - "pattern":{ - "type":"string", - "description":"pattern for events" - }, - "request":{ - "$ref":"#\/components\/schemas\/trace-add-request" - }, - "daemon":{ - "$ref":"#\/components\/schemas\/trace-add-daemon" - }, - "service":{ - "$ref":"#\/components\/schemas\/trace-add-service" - }, - "event":{ - "$ref":"#\/components\/schemas\/trace-add-event" - }, - "session":{ - "$ref":"#\/components\/schemas\/trace-add-session" - }, - "for":{ - "$ref":"#\/components\/schemas\/trace-add" - } - }, - "examples":[ - { - "tag":"1", - "for":[ - "common", - { - "api":"xxx", - "request":"*", - "daemon":"*", - "service":"*" - } - ] - } - ] - }, - "trace-add-request":{ - "anyOf":[ - { - "type":"array", - "items":{ - "$ref":"#\/components\/schemas\/trace-request-names" - } - }, - { - "$ref":"#\/components\/schemas\/trace-request-names" - } - ] - }, - "trace-request-names":{ - "title":"name of traceable items of requests", - "enum":[ - "*", - "addref", - "all", - "args", - "begin", - "common", - "context", - "context_get", - "context_set", - "end", - "event", - "extra", - "fail", - "get", - "json", - "life", - "ref", - "result", - "session", - "session_close", - "session_set_LOA", - "simple", - "store", - "stores", - "subcall", - "subcall_result", - "subcalls", - "subcallsync", - "subcallsync_result", - "subscribe", - "success", - "unref", - "unstore", - "unsubscribe", - "vverbose" - ] - }, - "trace-add-daemon":{ - "anyOf":[ - { - "type":"array", - "items":{ - "$ref":"#\/components\/schemas\/trace-daemon-names" - } - }, - { - "$ref":"#\/components\/schemas\/trace-daemon-names" - } - ] - }, - "trace-daemon-names":{ - "title":"name of traceable items of daemons", - "enum":[ - "*", - "all", - "common", - "event_broadcast_after", - "event_broadcast_before", - "event_make", - "extra", - "get_event_loop", - "get_system_bus", - "get_user_bus", - "queue_job", - "require_api", - "require_api_result", - "rootdir_get_fd", - "rootdir_open_locale", - "unstore_req", - "vverbose" - ] - }, - "trace-add-service":{ - "anyOf":[ - { - "type":"array", - "items":{ - "$ref":"#\/components\/schemas\/trace-service-names" - } - }, - { - "$ref":"#\/components\/schemas\/trace-service-names" - } - ] - }, - "trace-service-names":{ - "title":"name of traceable items of services", - "enum":[ - "*", - "all", - "call", - "call_result", - "callsync", - "callsync_result", - "on_event_after", - "on_event_before", - "start_after", - "start_before" - ] - }, - "trace-add-event":{ - "anyOf":[ - { - "type":"array", - "items":{ - "$ref":"#\/components\/schemas\/trace-event-names" - } - }, - { - "$ref":"#\/components\/schemas\/trace-event-names" - } - ] - }, - "trace-event-names":{ - "title":"name of traceable items of events", - "enum":[ - "*", - "all", - "broadcast_after", - "broadcast_before", - "common", - "create", - "drop", - "extra", - "name", - "push_after", - "push_before" - ] - }, - "trace-add-session":{ - "anyOf":[ - { - "type":"array", - "items":{ - "$ref":"#\/components\/schemas\/trace-session-names" - } - }, - { - "$ref":"#\/components\/schemas\/trace-session-names" - } - ] - }, - "trace-session-names":{ - "title":"name of traceable items for sessions", - "enum":[ - "*", - "addref", - "all", - "close", - "common", - "create", - "destroy", - "renew", - "unref" - ] - }, - "trace-drop":{ - "anyOf":[ - { - "type":"boolean" - }, - { - "type":"object", - "properties":{ - "event":{ - "anyOf":[ - { - "type":"string" - }, - { - "type":"array", - "items":"string" - } - ] - }, - "tag":{ - "anyOf":[ - { - "type":"string" - }, - { - "type":"array", - "items":"string" - } - ] - }, - "uuid":{ - "anyOf":[ - { - "type":"string" - }, - { - "type":"array", - "items":"string" - } - ] - } - } - } - ] - } - } - }, - "paths":{ - "\/get":{ - "description":"Get monitoring data.", - "get":{ - "x-permissions":{ - "session":"check" - }, - "parameters":[ - { - "in":"query", - "name":"verbosity", - "required":false, - "schema":{ - "$ref":"#\/components\/schemas\/get-verbosity" - } - }, - { - "in":"query", - "name":"apis", - "required":false, - "schema":{ - "$ref":"#\/components\/schemas\/get-apis" - } - } - ], - "responses":{ - "200":{ - "description":"A complex object array response", - "content":{ - "application\/json":{ - "schema":{ - "$ref":"#\/components\/schemas\/afb-reply" - } - } - } - } - } - } - }, - "\/set":{ - "description":"Set monitoring actions.", - "get":{ - "x-permissions":{ - "session":"check" - }, - "parameters":[ - { - "in":"query", - "name":"verbosity", - "required":false, - "schema":{ - "$ref":"#\/components\/schemas\/set-verbosity" - } - } - ], - "responses":{ - "200":{ - "description":"A complex object array response", - "content":{ - "application\/json":{ - "schema":{ - "$ref":"#\/components\/schemas\/afb-reply" - } - } - } - } - } - } - }, - "\/trace":{ - "description":"Set monitoring actions.", - "get":{ - "x-permissions":{ - "session":"check" - }, - "parameters":[ - { - "in":"query", - "name":"add", - "required":false, - "schema":{ - "$ref":"#\/components\/schemas\/trace-add" - } - }, - { - "in":"query", - "name":"drop", - "required":false, - "schema":{ - "$ref":"#\/components\/schemas\/trace-drop" - } - } - ], - "responses":{ - "200":{ - "description":"A complex object array response", - "content":{ - "application\/json":{ - "schema":{ - "$ref":"#\/components\/schemas\/afb-reply" - } - } - } - } - } - } - }, - "\/session":{ - "description":"describes the session.", - "get":{ - "x-permissions":{ - "session":"check" - }, - "parameters":[ - { - "in":"query", - "name":"refresh-token", - "required":false, - "schema":{ - "type":"boolean" - } - } - ], - "responses":{ - "200":{ - "description":"A complex object array response", - "content":{ - "application\/json":{ - "schema":{ - "$ref":"#\/components\/schemas\/afb-reply" - } - } - } - } - } - } - } - } + "response":{ + "2273ff8d-ee46-4059-959b-0f90fa90f25e":{ + "token":"" }, - "windowmanager":{ - "openapi":"3.0.0", - "info":{ - "title":"windowmanager", - "version":"0.0.0", - "description":"windowmanager" - }, - "paths":{ - "\/requestsurface":{ - "get":{ - "responses":{ - "200":{ - "description":"requestsurface" - } - } - } - }, - "\/requestsurfacexdg":{ - "get":{ - "responses":{ - "200":{ - "description":"requestsurfacexdg" - } - } - } - }, - "\/activatesurface":{ - "get":{ - "responses":{ - "200":{ - "description":"activatesurface" - } - } - } - }, - "\/deactivatesurface":{ - "get":{ - "responses":{ - "200":{ - "description":"deactivatesurface" - } - } - } - }, - "\/enddraw":{ - "get":{ - "responses":{ - "200":{ - "description":"enddraw" - } - } - } - }, - "\/getdisplayinfo":{ - "get":{ - "responses":{ - "200":{ - "description":"getdisplayinfo" - } - } - } - }, - "\/getareainfo":{ - "get":{ - "responses":{ - "200":{ - "description":"getareainfo" - } - } - } - }, - "\/wm_subscribe":{ - "get":{ - "responses":{ - "200":{ - "description":"wm_subscribe" - } - } - } - }, - "\/list_drawing_names":{ - "get":{ - "responses":{ - "200":{ - "description":"list_drawing_names" - } - } - } - }, - "\/ping":{ - "get":{ - "responses":{ - "200":{ - "description":"ping" - } - } - } - }, - "\/debug_status":{ - "get":{ - "responses":{ - "200":{ - "description":"debug_status" - } - } - } - }, - "\/debug_layers":{ - "get":{ - "responses":{ - "200":{ - "description":"debug_layers" - } - } - } - }, - "\/debug_surfaces":{ - "get":{ - "responses":{ - "200":{ - "description":"debug_surfaces" - } - } - } - }, - "\/debug_terminate":{ - "get":{ - "responses":{ - "200":{ - "description":"debug_terminate" - } - } - } - } - } + "22563ce6-e07f-4284-91f8-e7eb7ec4ef21":{ + "token":"" } + }, + "jtype":"afb-reply", + "request":{ + "status":"success" } } -trace { "pid": 4117, "add": { "request": "common" } } -ON-EVENT-CREATE: [4:$/trace] -ON-EVENT-SUBSCRIBE 15:trace: [4:$/trace] -ON-REPLY-SUCCESS 15:trace: -null -ON-EVENT-PUSH: [4:$/trace] + +supervisor do {"pid":7054,"api":"monitor","verb":"get","args":{"apis":true}} +.....VERY LONG RESPONSE..... + + + + +supervisor trace { "pid": 7054, "add": { "request": "common" } } +ON-REPLY 6:supervisor/trace: OK { - "time":"30862.255651", - "tag":"trace", - "type":"request", - "id":51, + "jtype":"afb-reply", "request":{ - "index":5, - "api":"hello", - "verb":"ping", - "action":"begin", - "session":"fa050ca1-80b4-41af-bf72-4a1a8e7ee5b6" + "status":"success" } } -ON-EVENT-PUSH: [4:$/trace] + + + + + +ON-EVENT supervisor/trace: { - "time":"30862.255788", - "tag":"trace", - "type":"request", - "id":52, - "request":{ - "index":5, - "api":"hello", - "verb":"ping", - "action":"json", - "session":"fa050ca1-80b4-41af-bf72-4a1a8e7ee5b6" - }, + "event":"supervisor\/trace", "data":{ - "result":{ - "toto":"1" + "time":"34353.598120", + "tag":"trace", + "type":"request", + "id":34, + "request":{ + "index":1, + "api":"ave", + "verb":"ping", + "action":"begin", + "session":"be67cfb8-a346-47c1-ac63-65aaff3599bf" } - } + }, + "jtype":"afb-event" } -ON-EVENT-PUSH: [4:$/trace] +ON-EVENT supervisor/trace: { - "time":"30862.255871", - "tag":"trace", - "type":"request", - "id":53, - "request":{ - "index":5, - "api":"hello", - "verb":"ping", - "action":"success", - "session":"fa050ca1-80b4-41af-bf72-4a1a8e7ee5b6" + "event":"supervisor\/trace", + "data":{ + "time":"34353.598182", + "tag":"trace", + "type":"request", + "id":35, + "request":{ + "index":1, + "api":"ave", + "verb":"ping", + "action":"json", + "session":"be67cfb8-a346-47c1-ac63-65aaff3599bf" + }, + "data":{ + "result":"true" + } }, + "jtype":"afb-event" +} +ON-EVENT supervisor/trace: +{ + "event":"supervisor\/trace", "data":{ - "result":"Some String", - "info":"Ping Binder Daemon tag=pingSample count=1 query={ \"toto\": \"1\" }" - } + "time":"34353.598214", + "tag":"trace", + "type":"request", + "id":36, + "request":{ + "index":1, + "api":"ave", + "verb":"ping", + "action":"success", + "session":"be67cfb8-a346-47c1-ac63-65aaff3599bf" + }, + "data":{ + "result":"Some String", + "info":"Ping Binder Daemon tag=pingSample count=1 query=\"true\"" + } + }, + "jtype":"afb-event" } -ON-EVENT-PUSH: [4:$/trace] +ON-EVENT supervisor/trace: { - "time":"30862.255980", - "tag":"trace", - "type":"request", - "id":54, - "request":{ - "index":5, - "api":"hello", - "verb":"ping", - "action":"end", - "session":"fa050ca1-80b4-41af-bf72-4a1a8e7ee5b6" - } + "event":"supervisor\/trace", + "data":{ + "time":"34353.598292", + "tag":"trace", + "type":"request", + "id":37, + "request":{ + "index":1, + "api":"ave", + "verb":"ping", + "action":"end", + "session":"be67cfb8-a346-47c1-ac63-65aaff3599bf" + } + }, + "jtype":"afb-event" } +Usefull commands: +----------------- + + TARGET=... + + afb-client-demo -H ws://$TARGET:1619/api?token=HELLO\&uuid=HELLO supervisor list + + afb-client-demo -H ws://$TARGET:1619/api?token=HELLO\&uuid=HELLO config '{"pid":XXXX}' + + +