Unverified Commit 4b4411d2 authored by Guillaume Quintard's avatar Guillaume Quintard Committed by Nils Goroll

[vstat] new json schema

parent ff8caf99
...@@ -114,9 +114,7 @@ do_json_cb(void *priv, const struct VSC_point * const pt) ...@@ -114,9 +114,7 @@ do_json_cb(void *priv, const struct VSC_point * const pt)
else else
printf(",\n"); printf(",\n");
printf(" \""); printf(" \"%s\": {\n", pt->name);
/* build the JSON key name. */
printf("%s\": {\n", pt->name);
printf(" \"description\": \"%s\",\n", pt->sdesc); printf(" \"description\": \"%s\",\n", pt->sdesc);
printf(" \"flag\": \"%c\", ", pt->semantics); printf(" \"flag\": \"%c\", ", pt->semantics);
...@@ -137,9 +135,12 @@ do_json(struct vsm *vsm, struct vsc *vsc) ...@@ -137,9 +135,12 @@ do_json(struct vsm *vsm, struct vsc *vsc)
now = time(NULL); now = time(NULL);
(void)strftime(time_stamp, 20, "%Y-%m-%dT%H:%M:%S", localtime(&now)); (void)strftime(time_stamp, 20, "%Y-%m-%dT%H:%M:%S", localtime(&now));
printf("{\n \"timestamp\": \"%s\",\n", time_stamp); printf("{\n"
" \"version\": 1,\n"
" \"timestamp\": \"%s\",\n"
" \"counters\": {\n", time_stamp);
(void)VSC_Iter(vsc, vsm, do_json_cb, &jp); (void)VSC_Iter(vsc, vsm, do_json_cb, &jp);
printf("\n}\n"); printf("\n }\n}\n");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment