summaryrefslogtreecommitdiffstats
path: root/exporting
diff options
context:
space:
mode:
authorVladimir Kobal <vlad@prokk.net>2020-02-01 00:05:45 +0200
committerGitHub <noreply@github.com>2020-02-01 00:05:45 +0200
commit177af26ea878e673166ebbeb4518539f624a81f0 (patch)
tree9f874527a1e6e25c85a05d62b3623e6d8b5f79fd /exporting
parent43bc627b1dc2e667ad2e6e8a0c2ff1e0b512dcdf (diff)
Parse host tags (#7702)
* Fix memory leaks * Check for configuration options * Parse simple tags * Parse JSON tags * Remove an unnecessary check * Parse a JSON object * Parse a JSON array * Update the documentation * Fix host locks
Diffstat (limited to 'exporting')
-rw-r--r--exporting/graphite/graphite.c1
-rw-r--r--exporting/json/json.c1
-rw-r--r--exporting/opentsdb/opentsdb.c2
3 files changed, 4 insertions, 0 deletions
diff --git a/exporting/graphite/graphite.c b/exporting/graphite/graphite.c
index 71f833a018..d0589910ef 100644
--- a/exporting/graphite/graphite.c
+++ b/exporting/graphite/graphite.c
@@ -87,6 +87,7 @@ int format_host_labels_graphite_plaintext(struct instance *instance, RRDHOST *ho
if (unlikely(!sending_labels_configured(instance)))
return 0;
+ rrdhost_check_rdlock(host);
netdata_rwlock_rdlock(&host->labels_rwlock);
for (struct label *label = host->labels; label; label = label->next) {
if (!should_send_label(instance, label))
diff --git a/exporting/json/json.c b/exporting/json/json.c
index 6499218df9..9a2937b02e 100644
--- a/exporting/json/json.c
+++ b/exporting/json/json.c
@@ -69,6 +69,7 @@ int format_host_labels_json_plaintext(struct instance *instance, RRDHOST *host)
buffer_strcat(instance->labels, "\"labels\":{");
int count = 0;
+ rrdhost_check_rdlock(host);
netdata_rwlock_rdlock(&host->labels_rwlock);
for (struct label *label = host->labels; label; label = label->next) {
if (!should_send_label(instance, label))
diff --git a/exporting/opentsdb/opentsdb.c b/exporting/opentsdb/opentsdb.c
index a1e810de93..75ecaa7a43 100644
--- a/exporting/opentsdb/opentsdb.c
+++ b/exporting/opentsdb/opentsdb.c
@@ -119,6 +119,7 @@ int format_host_labels_opentsdb_telnet(struct instance *instance, RRDHOST *host)
if (unlikely(!sending_labels_configured(instance)))
return 0;
+ rrdhost_check_rdlock(localhost);
netdata_rwlock_rdlock(&host->labels_rwlock);
for (struct label *label = host->labels; label; label = label->next) {
if (!should_send_label(instance, label))
@@ -261,6 +262,7 @@ int format_host_labels_opentsdb_http(struct instance *instance, RRDHOST *host)
if (unlikely(!sending_labels_configured(instance)))
return 0;
+ rrdhost_check_rdlock(host);
netdata_rwlock_rdlock(&host->labels_rwlock);
for (struct label *label = host->labels; label; label = label->next) {
if (!should_send_label(instance, label))