From fb678ae817f739d9c7208f9165f6c04b2028af26 Mon Sep 17 00:00:00 2001 From: José Bollo Date: Mon, 12 Feb 2018 15:57:55 +0100 Subject: afb-trace: Add tracing of sessions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ieba4032bed526ca158dc69558177a038df95988b Signed-off-by: José Bollo --- src/afb-trace.c | 120 ++++++++++++++++++--- src/devtools/monitor-api.json | 25 ++++- src/monitor-api.inc | 242 ++++++++++++++++++++++-------------------- 3 files changed, 255 insertions(+), 132 deletions(-) diff --git a/src/afb-trace.c b/src/afb-trace.c index 2b803029..1fa50ebc 100644 --- a/src/afb-trace.c +++ b/src/afb-trace.c @@ -37,6 +37,7 @@ #include "afb-xreq.h" #include "afb-export.h" #include "afb-evt.h" +#include "afb-session.h" #include "afb-trace.h" #include "wrap-json.h" @@ -98,6 +99,7 @@ enum trace_type Trace_Type_Ditf, /* export hooks */ Trace_Type_Svc, /* export hooks */ Trace_Type_Evt, /* evt hooks */ + Trace_Type_Session, /* session hooks */ Trace_Type_Global, /* global hooks */ Trace_Type_Count /* count of types of hooks */ }; @@ -870,6 +872,77 @@ static struct afb_hook_evt_itf hook_evt_itf = { .hook_evt_unref = hook_evt_unref }; +/*******************************************************************************/ +/***** trace the sessions *****/ +/*******************************************************************************/ + +static struct flag session_flags[] = { /* must be sorted by names */ + { "addref", afb_hook_flag_session_addref }, + { "all", afb_hook_flags_session_all }, + { "close", afb_hook_flag_session_close }, + { "common", afb_hook_flags_session_common }, + { "create", afb_hook_flag_session_create }, + { "destroy", afb_hook_flag_session_destroy }, + { "renew", afb_hook_flag_session_renew }, + { "unref", afb_hook_flag_session_unref }, +}; + +/* get the session value for flag of 'name' */ +static int get_session_flag(const char *name) +{ + return get_flag(name, session_flags, (int)(sizeof session_flags / sizeof *session_flags)); +} + +static void hook_session(void *closure, const struct afb_hookid *hookid, struct afb_session *session, const char *action, const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + emit(closure, hookid, "session", "{ss ss}", format, ap, + "uuid", session, + "action", action); + va_end(ap); +} + +static void hook_session_create(void *closure, const struct afb_hookid *hookid, struct afb_session *session) +{ + hook_session(closure, hookid, session, "create", "{ss}", "token", afb_session_token(session)); +} + +static void hook_session_close(void *closure, const struct afb_hookid *hookid, struct afb_session *session) +{ + hook_session(closure, hookid, session, "close", NULL); +} + +static void hook_session_destroy(void *closure, const struct afb_hookid *hookid, struct afb_session *session) +{ + hook_session(closure, hookid, session, "destroy", NULL); +} + +static void hook_session_renew(void *closure, const struct afb_hookid *hookid, struct afb_session *session) +{ + hook_session(closure, hookid, session, "renew", "{ss}", "token", afb_session_token(session)); +} + +static void hook_session_addref(void *closure, const struct afb_hookid *hookid, struct afb_session *session) +{ + hook_session(closure, hookid, session, "addref", NULL); +} + +static void hook_session_unref(void *closure, const struct afb_hookid *hookid, struct afb_session *session) +{ + hook_session(closure, hookid, session, "unref", NULL); +} + +static struct afb_hook_session_itf hook_session_itf = { + .hook_session_create = hook_session_create, + .hook_session_close = hook_session_close, + .hook_session_destroy = hook_session_destroy, + .hook_session_renew = hook_session_renew, + .hook_session_addref = hook_session_addref, + .hook_session_unref = hook_session_unref +}; + /*******************************************************************************/ /***** trace the globals *****/ /*******************************************************************************/ @@ -961,6 +1034,12 @@ abstracting[Trace_Type_Count] = .unref = (void(*)(void*))afb_hook_unref_evt, .get_flag = get_evt_flag }, + [Trace_Type_Session] = + { + .name = "session", + .unref = (void(*)(void*))afb_hook_unref_session, + .get_flag = get_session_flag + }, [Trace_Type_Global] = { .name = "global", @@ -1172,7 +1251,7 @@ struct desc struct context *context; const char *name; const char *tag; - const char *session; + const char *uuid; const char *api; const char *verb; const char *pattern; @@ -1194,7 +1273,7 @@ static void addhook(struct desc *desc, enum trace_type type) ctxt_error(&desc->context->errors, "tracing %s is forbidden", abstracting[type].name); return; } - if (desc->session) { + if (desc->uuid) { ctxt_error(&desc->context->errors, "setting session is forbidden"); return; } @@ -1210,10 +1289,10 @@ static void addhook(struct desc *desc, enum trace_type type) /* create the hook handler */ switch (type) { case Trace_Type_Xreq: - if (!desc->session) + if (!desc->uuid) session = afb_session_addref(bind); else { - session = trace_get_session_by_uuid(trace, desc->session, 1); + session = trace_get_session_by_uuid(trace, desc->uuid, 1); if (!session) { ctxt_error(&desc->context->errors, "allocation of session failed"); free(hook); @@ -1233,6 +1312,9 @@ static void addhook(struct desc *desc, enum trace_type type) case Trace_Type_Evt: hook->handler = afb_hook_create_evt(desc->pattern, desc->flags[type], &hook_evt_itf, hook); break; + case Trace_Type_Session: + hook->handler = afb_hook_create_session(desc->uuid, desc->flags[type], &hook_session_itf, hook); + break; case Trace_Type_Global: hook->handler = afb_hook_create_global(desc->flags[type], &hook_global_itf, hook); break; @@ -1301,6 +1383,11 @@ static void add_evt_flags(void *closure, struct json_object *object) add_flags(closure, object, Trace_Type_Evt); } +static void add_session_flags(void *closure, struct json_object *object) +{ + add_flags(closure, object, Trace_Type_Session); +} + static void add_global_flags(void *closure, struct json_object *object) { add_flags(closure, object, Trace_Type_Global); @@ -1311,7 +1398,7 @@ static void add(void *closure, struct json_object *object) { int rc; struct desc desc; - struct json_object *request, *event, *daemon, *service, *sub, *global; + struct json_object *request, *event, *daemon, *service, *sub, *global, *session; memcpy (&desc, closure, sizeof desc); request = event = daemon = service = sub = global = NULL; @@ -1321,12 +1408,13 @@ static void add(void *closure, struct json_object *object) "tag", &desc.tag, "api", &desc.api, "verb", &desc.verb, - "session", &desc.session, + "uuid", &desc.uuid, "pattern", &desc.pattern, "request", &request, "daemon", &daemon, "service", &service, "event", &event, + "session", &session, "global", &global, "for", &sub); @@ -1338,8 +1426,8 @@ static void add(void *closure, struct json_object *object) if (desc.verb && desc.verb[0] == '*' && !desc.verb[1]) desc.verb = NULL; - if (desc.session && desc.session[0] == '*' && !desc.session[1]) - desc.session = NULL; + if (desc.uuid && desc.uuid[0] == '*' && !desc.uuid[1]) + desc.uuid = NULL; /* get what is expected */ if (request) @@ -1354,6 +1442,9 @@ static void add(void *closure, struct json_object *object) if (event) wrap_json_optarray_for_all(event, add_evt_flags, &desc); + if (session) + wrap_json_optarray_for_all(event, add_session_flags, &desc); + if (global) wrap_json_optarray_for_all(global, add_global_flags, &desc); @@ -1500,7 +1591,7 @@ extern int afb_trace_drop(struct afb_req req, struct json_object *args, struct a { int rc; struct context context; - struct json_object *tags, *events, *sessions; + struct json_object *tags, *events, *uuids; memset(&context, 0, sizeof context); context.trace = trace; @@ -1517,13 +1608,13 @@ extern int afb_trace_drop(struct afb_req req, struct json_object *args, struct a return 0; } - tags = events = sessions = NULL; + tags = events = uuids = NULL; rc = wrap_json_unpack(args, "{s?o s?o s?o}", "event", &events, "tag", &tags, - "session", &sessions); + "uuid", &uuids); - if (rc < 0 || !(events || tags || sessions)) { + if (rc < 0 || !(events || tags || uuids)) { afb_req_fail(req, "error-detected", "bad drop arguments"); return -1; } @@ -1536,8 +1627,8 @@ extern int afb_trace_drop(struct afb_req req, struct json_object *args, struct a if (events) wrap_json_optarray_for_all(events, drop_event, &context); - if (sessions) - wrap_json_optarray_for_all(sessions, drop_session, &context); + if (uuids) + wrap_json_optarray_for_all(uuids, drop_session, &context); trace_cleanup(trace); @@ -1550,4 +1641,3 @@ extern int afb_trace_drop(struct afb_req req, struct json_object *args, struct a free(context.errors); return -1; } - diff --git a/src/devtools/monitor-api.json b/src/devtools/monitor-api.json index 8361d572..81d1028a 100644 --- a/src/devtools/monitor-api.json +++ b/src/devtools/monitor-api.json @@ -138,12 +138,13 @@ "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" }, - "session": { "type": "string", "description": "session 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": [ @@ -267,6 +268,26 @@ "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" }, @@ -275,7 +296,7 @@ "properties": { "event": { "anyOf": [ { "type": "string" }, { "type": "array", "items": "string" } ] }, "tag": { "anyOf": [ { "type": "string" }, { "type": "array", "items": "string" } ] }, - "session": { "anyOf": [ { "type": "string" }, { "type": "array", "items": "string" } ] } + "uuid": { "anyOf": [ { "type": "string" }, { "type": "array", "items": "string" } ] } } } ] diff --git a/src/monitor-api.inc b/src/monitor-api.inc index 531bb557..8daaafa5 100644 --- a/src/monitor-api.inc +++ b/src/monitor-api.inc @@ -1,115 +1,121 @@ static const char _afb_description_v2_monitor[] = - "{\"openapi\":\"3.0.0\",\"info\":{\"description\":\"\",\"title\":\"monito" - "r\",\"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 AP" - "I server.\",\"variables\":{\"host\":{\"default\":\"localhost\"},\"port\"" - ":{\"default\":\"1234\"}},\"x-afb-events\":[{\"$ref\":\"#/components/sche" - "mas/afb-event\"}]}],\"components\":{\"schemas\":{\"afb-reply\":{\"$ref\"" - ":\"#/components/schemas/afb-reply-v1\"},\"afb-event\":{\"$ref\":\"#/comp" - "onents/schemas/afb-event-v1\"},\"afb-reply-v1\":{\"title\":\"Generic res" - "ponse.\",\"type\":\"object\",\"required\":[\"jtype\",\"request\"],\"prop" - "erties\":{\"jtype\":{\"type\":\"string\",\"const\":\"afb-reply\"},\"requ" - "est\":{\"type\":\"object\",\"required\":[\"status\"],\"properties\":{\"s" - "tatus\":{\"type\":\"string\"},\"info\":{\"type\":\"string\"},\"token\":{" - "\"type\":\"string\"},\"uuid\":{\"type\":\"string\"},\"reqid\":{\"type\":" - "\"string\"}}},\"response\":{\"type\":\"object\"}}},\"afb-event-v1\":{\"t" - "ype\":\"object\",\"required\":[\"jtype\",\"event\"],\"properties\":{\"jt" - "ype\":{\"type\":\"string\",\"const\":\"afb-event\"},\"event\":{\"type\":" - "\"string\"},\"data\":{\"type\":\"object\"}}},\"set-verbosity\":{\"anyOf\"" - ":[{\"$ref\":\"#/components/schemas/verbosity-map\"},{\"$ref\":\"#/compon" - "ents/schemas/verbosity-level\"}]},\"get-request\":{\"type\":\"object\",\"" - "properties\":{\"verbosity\":{\"$ref\":\"#/components/schemas/get-verbosi" - "ty\"},\"apis\":{\"$ref\":\"#/components/schemas/get-apis\"}}},\"get-resp" - "onse\":{\"type\":\"object\",\"properties\":{\"verbosity\":{\"$ref\":\"#/" - "components/schemas/verbosity-map\"},\"apis\":{\"type\":\"object\"}}},\"g" - "et-verbosity\":{\"anyOf\":[{\"type\":\"boolean\"},{\"type\":\"array\",\"" - "items\":{\"type\":\"string\"}},{\"type\":\"object\"}]},\"get-apis\":{\"a" - "nyOf\":[{\"type\":\"boolean\"},{\"type\":\"array\",\"items\":{\"type\":\"" - "string\"}},{\"type\":\"object\"}]},\"verbosity-map\":{\"type\":\"object\"" - ",\"patternProperties\":{\"^.*$\":{\"$ref\":\"#/components/schemas/verbos" - "ity-level\"}}},\"verbosity-level\":{\"enum\":[\"debug\",3,\"info\",2,\"n" - "otice\",\"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\"},{\"$re" - "f\":\"#/components/schemas/trace-add-object\"}]},\"trace-add-object\":{\"" - "type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\",\"descri" - "ption\":\"name of the generated event\",\"default\":\"trace\"},\"tag\":{" - "\"type\":\"string\",\"description\":\"tag for grouping traces\",\"defaul" - "t\":\"trace\"},\"api\":{\"type\":\"string\",\"description\":\"api for re" - "quests, daemons and services\"},\"verb\":{\"type\":\"string\",\"descript" - "ion\":\"verb for requests\"},\"session\":{\"type\":\"string\",\"descript" - "ion\":\"session for requests\"},\"pattern\":{\"type\":\"string\",\"descr" - "iption\":\"pattern for events\"},\"request\":{\"$ref\":\"#/components/sc" - "hemas/trace-add-request\"},\"daemon\":{\"$ref\":\"#/components/schemas/t" - "race-add-daemon\"},\"service\":{\"$ref\":\"#/components/schemas/trace-ad" - "d-service\"},\"event\":{\"$ref\":\"#/components/schemas/trace-add-event\"" - "},\"for\":{\"$ref\":\"#/components/schemas/trace-add\"}},\"examples\":[{" - "\"tag\":\"1\",\"for\":[\"common\",{\"api\":\"xxx\",\"request\":\"*\",\"d" - "aemon\":\"*\",\"service\":\"*\"}]}]},\"trace-add-request\":{\"anyOf\":[{" - "\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/trace-requ" - "est-names\"}},{\"$ref\":\"#/components/schemas/trace-request-names\"}]}," - "\"trace-request-names\":{\"title\":\"name of traceable items of requests" - "\",\"enum\":[\"*\",\"addref\",\"all\",\"args\",\"begin\",\"common\",\"co" - "ntext\",\"context_get\",\"context_set\",\"end\",\"event\",\"extra\",\"fa" - "il\",\"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\":\"#/compon" - "ents/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\",\"ex" - "tra\",\"get_event_loop\",\"get_system_bus\",\"get_user_bus\",\"queue_job" - "\",\"require_api\",\"require_api_result\",\"rootdir_get_fd\",\"rootdir_o" - "pen_locale\",\"unstore_req\",\"vverbose\"]},\"trace-add-service\":{\"any" - "Of\":[{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/tra" - "ce-service-names\"}},{\"$ref\":\"#/components/schemas/trace-service-name" - "s\"}]},\"trace-service-names\":{\"title\":\"name of traceable items of s" - "ervices\",\"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\"}},{\"$re" - "f\":\"#/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-drop\":{\"a" - "nyOf\":[{\"type\":\"boolean\"},{\"type\":\"object\",\"properties\":{\"ev" - "ent\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"array\",\"items\":\"" - "string\"}]},\"tag\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"array\"" - ",\"items\":\"string\"}]},\"session\":{\"anyOf\":[{\"type\":\"string\"},{" - "\"type\":\"array\",\"items\":\"string\"}]}}}]}},\"x-permissions\":{\"tra" - "ce\":{\"permission\":\"urn:AGL:permission:monitor:public:trace\"},\"set\"" - ":{\"permission\":\"urn:AGL:permission:monitor:public:set\"},\"get\":{\"p" - "ermission\":\"urn:AGL:permission:monitor:public:get\"},\"get-or-set\":{\"" - "anyOf\":[{\"$ref\":\"#/components/x-permissions/get\"},{\"$ref\":\"#/com" - "ponents/x-permissions/set\"}]}}},\"paths\":{\"/get\":{\"description\":\"" - "Get monitoring data.\",\"get\":{\"x-permissions\":{\"$ref\":\"#/componen" - "ts/x-permissions/get-or-set\"},\"parameters\":[{\"in\":\"query\",\"name\"" - ":\"verbosity\",\"required\":false,\"schema\":{\"$ref\":\"#/components/sc" - "hemas/get-verbosity\"}},{\"in\":\"query\",\"name\":\"apis\",\"required\"" - ":false,\"schema\":{\"$ref\":\"#/components/schemas/get-apis\"}}],\"respo" - "nses\":{\"200\":{\"description\":\"A complex object array response\",\"c" - "ontent\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/sche" - "mas/afb-reply\"}}}}}}},\"/set\":{\"description\":\"Set monitoring action" - "s.\",\"get\":{\"x-permissions\":{\"$ref\":\"#/components/x-permissions/s" - "et\"},\"parameters\":[{\"in\":\"query\",\"name\":\"verbosity\",\"require" - "d\":false,\"schema\":{\"$ref\":\"#/components/schemas/set-verbosity\"}}]" - ",\"responses\":{\"200\":{\"description\":\"A complex object array respon" - "se\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/compone" - "nts/schemas/afb-reply\"}}}}}}},\"/trace\":{\"description\":\"Set monitor" - "ing actions.\",\"get\":{\"x-permissions\":{\"$ref\":\"#/components/x-per" - "missions/trace\"},\"parameters\":[{\"in\":\"query\",\"name\":\"add\",\"r" - "equired\":false,\"schema\":{\"$ref\":\"#/components/schemas/trace-add\"}" - "},{\"in\":\"query\",\"name\":\"drop\",\"required\":false,\"schema\":{\"$" - "ref\":\"#/components/schemas/trace-drop\"}}],\"responses\":{\"200\":{\"d" - "escription\":\"A complex object array response\",\"content\":{\"applicat" - "ion/json\":{\"schema\":{\"$ref\":\"#/components/schemas/afb-reply\"}}}}}" - "}}}}" + "{\"openapi\":\"3.0.0\",\"info\":{\"description\":\"monitoring of binding" + "s and internals\",\"title\":\"monitor\",\"version\":\"1.0\",\"x-binding-" + "c-generator\":{\"api\":\"monitor\",\"version\":2,\"prefix\":\"f_\",\"pos" + "tfix\":\"\",\"preinit\":null,\"init\":null,\"onevent\":null,\"scope\":\"" + "static\",\"private\":true}},\"servers\":[{\"url\":\"ws://{host}:{port}/a" + "pi/monitor\",\"description\":\"The API server.\",\"variables\":{\"host\"" + ":{\"default\":\"localhost\"},\"port\":{\"default\":\"1234\"}},\"x-afb-ev" + "ents\":[{\"$ref\":\"#/components/schemas/afb-event\"}]}],\"components\":" + "{\"schemas\":{\"afb-reply\":{\"$ref\":\"#/components/schemas/afb-reply-v" + "1\"},\"afb-event\":{\"$ref\":\"#/components/schemas/afb-event-v1\"},\"af" + "b-reply-v1\":{\"title\":\"Generic response.\",\"type\":\"object\",\"requ" + "ired\":[\"jtype\",\"request\"],\"properties\":{\"jtype\":{\"type\":\"str" + "ing\",\"const\":\"afb-reply\"},\"request\":{\"type\":\"object\",\"requir" + "ed\":[\"status\"],\"properties\":{\"status\":{\"type\":\"string\"},\"inf" + "o\":{\"type\":\"string\"},\"token\":{\"type\":\"string\"},\"uuid\":{\"ty" + "pe\":\"string\"},\"reqid\":{\"type\":\"string\"}}},\"response\":{\"type\"" + ":\"object\"}}},\"afb-event-v1\":{\"type\":\"object\",\"required\":[\"jty" + "pe\",\"event\"],\"properties\":{\"jtype\":{\"type\":\"string\",\"const\"" + ":\"afb-event\"},\"event\":{\"type\":\"string\"},\"data\":{\"type\":\"obj" + "ect\"}}},\"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\":\"#/compon" + "ents/schemas/get-apis\"}}},\"get-response\":{\"type\":\"object\",\"prope" + "rties\":{\"verbosity\":{\"$ref\":\"#/components/schemas/verbosity-map\"}" + ",\"apis\":{\"type\":\"object\"}}},\"get-verbosity\":{\"anyOf\":[{\"type\"" + ":\"boolean\"},{\"type\":\"array\",\"items\":{\"type\":\"string\"}},{\"ty" + "pe\":\"object\"}]},\"get-apis\":{\"anyOf\":[{\"type\":\"boolean\"},{\"ty" + "pe\":\"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\":\"#/componen" + "ts/schemas/trace-add-request\"},{\"$ref\":\"#/components/schemas/trace-a" + "dd-object\"}]},\"trace-add-object\":{\"type\":\"object\",\"properties\":" + "{\"name\":{\"type\":\"string\",\"description\":\"name of the generated e" + "vent\",\"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\"},\"uui" + "d\":{\"type\":\"string\",\"description\":\"uuid of session for requests\"" + "},\"pattern\":{\"type\":\"string\",\"description\":\"pattern for events\"" + "},\"request\":{\"$ref\":\"#/components/schemas/trace-add-request\"},\"da" + "emon\":{\"$ref\":\"#/components/schemas/trace-add-daemon\"},\"service\":" + "{\"$ref\":\"#/components/schemas/trace-add-service\"},\"event\":{\"$ref\"" + ":\"#/components/schemas/trace-add-event\"},\"session\":{\"$ref\":\"#/com" + "ponents/schemas/trace-add-session\"},\"for\":{\"$ref\":\"#/components/sc" + "hemas/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\":\"n" + "ame 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\",\"subca" + "llsync\",\"subcallsync_result\",\"subscribe\",\"success\",\"unref\",\"un" + "store\",\"unsubscribe\",\"vverbose\"]},\"trace-add-daemon\":{\"anyOf\":[" + "{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/trace-dae" + "mon-names\"}},{\"$ref\":\"#/components/schemas/trace-daemon-names\"}]},\"" + "trace-daemon-names\":{\"title\":\"name of traceable items of daemons\",\"" + "enum\":[\"*\",\"all\",\"common\",\"event_broadcast_after\",\"event_broad" + "cast_before\",\"event_make\",\"extra\",\"get_event_loop\",\"get_system_b" + "us\",\"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\":\"#/comp" + "onents/schemas/trace-service-names\"}]},\"trace-service-names\":{\"title" + "\":\"name of traceable items of services\",\"enum\":[\"*\",\"all\",\"cal" + "l\",\"call_result\",\"callsync\",\"callsync_result\",\"on_event_after\"," + "\"on_event_before\",\"start_after\",\"start_before\"]},\"trace-add-event" + "\":{\"anyOf\":[{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/sc" + "hemas/trace-event-names\"}},{\"$ref\":\"#/components/schemas/trace-event" + "-names\"}]},\"trace-event-names\":{\"title\":\"name of traceable items o" + "f events\",\"enum\":[\"*\",\"all\",\"broadcast_after\",\"broadcast_befor" + "e\",\"common\",\"create\",\"drop\",\"extra\",\"name\",\"push_after\",\"p" + "ush_before\"]},\"trace-add-session\":{\"anyOf\":[{\"type\":\"array\",\"i" + "tems\":{\"$ref\":\"#/components/schemas/trace-session-names\"}},{\"$ref\"" + ":\"#/components/schemas/trace-session-names\"}]},\"trace-session-names\"" + ":{\"title\":\"name of traceable items for sessions\",\"enum\":[\"*\",\"a" + "ddref\",\"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\"}]}}}]}}" + ",\"x-permissions\":{\"trace\":{\"permission\":\"urn:AGL:permission:monit" + "or:public:trace\"},\"set\":{\"permission\":\"urn:AGL:permission:monitor:" + "public:set\"},\"get\":{\"permission\":\"urn:AGL:permission:monitor:publi" + "c:get\"},\"get-or-set\":{\"anyOf\":[{\"$ref\":\"#/components/x-permissio" + "ns/get\"},{\"$ref\":\"#/components/x-permissions/set\"}]}}},\"paths\":{\"" + "/get\":{\"description\":\"Get monitoring data.\",\"get\":{\"x-permission" + "s\":{\"$ref\":\"#/components/x-permissions/get-or-set\"},\"parameters\":" + "[{\"in\":\"query\",\"name\":\"verbosity\",\"required\":false,\"schema\":" + "{\"$ref\":\"#/components/schemas/get-verbosity\"}},{\"in\":\"query\",\"n" + "ame\":\"apis\",\"required\":false,\"schema\":{\"$ref\":\"#/components/sc" + "hemas/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\":{\"$ref\":\"#/" + "components/x-permissions/set\"},\"parameters\":[{\"in\":\"query\",\"name" + "\":\"verbosity\",\"required\":false,\"schema\":{\"$ref\":\"#/components/" + "schemas/set-verbosity\"}}],\"responses\":{\"200\":{\"description\":\"A c" + "omplex object array response\",\"content\":{\"application/json\":{\"sche" + "ma\":{\"$ref\":\"#/components/schemas/afb-reply\"}}}}}}},\"/trace\":{\"d" + "escription\":\"Set monitoring actions.\",\"get\":{\"x-permissions\":{\"$" + "ref\":\"#/components/x-permissions/trace\"},\"parameters\":[{\"in\":\"qu" + "ery\",\"name\":\"add\",\"required\":false,\"schema\":{\"$ref\":\"#/compo" + "nents/schemas/trace-add\"}},{\"in\":\"query\",\"name\":\"drop\",\"requir" + "ed\":false,\"schema\":{\"$ref\":\"#/components/schemas/trace-drop\"}}],\"" + "responses\":{\"200\":{\"description\":\"A complex object array response\"" + ",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/" + "schemas/afb-reply\"}}}}}}}}}" ; static const struct afb_auth _afb_auths_v2_monitor[] = { @@ -128,30 +134,36 @@ static const struct afb_verb_v2 _afb_verbs_v2_monitor[] = { .verb = "get", .callback = f_get, .auth = &_afb_auths_v2_monitor[2], - .info = NULL, + .info = "Get monitoring data.", .session = AFB_SESSION_NONE_V2 }, { .verb = "set", .callback = f_set, .auth = &_afb_auths_v2_monitor[0], - .info = NULL, + .info = "Set monitoring actions.", .session = AFB_SESSION_NONE_V2 }, { .verb = "trace", .callback = f_trace, .auth = &_afb_auths_v2_monitor[3], - .info = NULL, + .info = "Set monitoring actions.", .session = AFB_SESSION_NONE_V2 }, - { .verb = NULL } + { + .verb = NULL, + .callback = NULL, + .auth = NULL, + .info = NULL, + .session = 0 + } }; static const struct afb_binding_v2 _afb_binding_v2_monitor = { .api = "monitor", .specification = _afb_description_v2_monitor, - .info = NULL, + .info = "monitoring of bindings and internals", .verbs = _afb_verbs_v2_monitor, .preinit = NULL, .init = NULL, -- cgit 1.2.3-korg