summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@netdata.cloud>2022-07-15 17:52:49 +0300
committerCosta Tsaousis <costa@netdata.cloud>2022-07-15 17:52:49 +0300
commit4342123a596660d32bf036e03b8a9f132d2b32ca (patch)
treea8f53f23d57022747ab5df4c0a978236928a80a6
parenta3a2be4444f3e45028795882c3fb700fc5849cbd (diff)
lock the context while rendering json
m---------aclk/aclk-schemas0
-rw-r--r--database/rrdcontext.c4
2 files changed, 4 insertions, 0 deletions
diff --git a/aclk/aclk-schemas b/aclk/aclk-schemas
-Subproject 3252118bd547640251356629f0df05eaf952ac3
+Subproject 944fa9a4aa77129c2c429e1e59c3485c888ce76
diff --git a/database/rrdcontext.c b/database/rrdcontext.c
index c90b8ba004..bf9731e75b 100644
--- a/database/rrdcontext.c
+++ b/database/rrdcontext.c
@@ -2006,6 +2006,8 @@ static inline int rrdcontext_to_json_callback(const char *id, void *value, void
else
buffer_sprintf(wb, "\t\t\"%s\": {", id);
+ rrdcontext_lock(rc);
+
buffer_sprintf(wb,
"\n\t\t\t\"version\":%lu"
",\n\t\t\t\"hub_version\":%lu"
@@ -2052,6 +2054,8 @@ static inline int rrdcontext_to_json_callback(const char *id, void *value, void
);
}
+ rrdcontext_unlock(rc);
+
if(options & (RRDCONTEXT_OPTION_SHOW_INSTANCES|RRDCONTEXT_OPTION_SHOW_METRICS)) {
buffer_sprintf(wb, ",\n\t\t\t\"charts\": {");
struct rrdcontext_to_json tt = {