diff options
author | Ilya Mashchenko <ilya@netdata.cloud> | 2020-12-14 17:27:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-14 17:27:55 +0300 |
commit | 0f8175dd3060691394e263cdab01c8f940b1b5d3 (patch) | |
tree | 4b14cd6b7e6ba7797eeec4c74b4c4c35cdad4494 /exporting | |
parent | 7bfa8c8eba72a109d940b1fa5c7acaed9cd7a52c (diff) |
Kubernetes labels (#10107)
Co-authored-by: Markos Fountoulakis <markos.fountoulakis.senior@gmail.com>
Co-authored-by: Vladimir Kobal <vlad@prokk.net>
Diffstat (limited to 'exporting')
-rw-r--r-- | exporting/graphite/graphite.c | 6 | ||||
-rw-r--r-- | exporting/json/json.c | 6 | ||||
-rw-r--r-- | exporting/opentsdb/opentsdb.c | 12 | ||||
-rw-r--r-- | exporting/prometheus/prometheus.c | 6 | ||||
-rw-r--r-- | exporting/prometheus/remote_write/remote_write.c | 6 | ||||
-rw-r--r-- | exporting/tests/exporting_fixtures.c | 16 |
6 files changed, 26 insertions, 26 deletions
diff --git a/exporting/graphite/graphite.c b/exporting/graphite/graphite.c index dac1d7682e..9c09631f19 100644 --- a/exporting/graphite/graphite.c +++ b/exporting/graphite/graphite.c @@ -100,8 +100,8 @@ int format_host_labels_graphite_plaintext(struct instance *instance, RRDHOST *ho return 0; rrdhost_check_rdlock(host); - netdata_rwlock_rdlock(&host->labels_rwlock); - for (struct label *label = host->labels; label; label = label->next) { + netdata_rwlock_rdlock(&host->labels.labels_rwlock); + for (struct label *label = host->labels.head; label; label = label->next) { if (!should_send_label(instance, label)) continue; @@ -113,7 +113,7 @@ int format_host_labels_graphite_plaintext(struct instance *instance, RRDHOST *ho buffer_sprintf(instance->labels, "%s=%s", label->key, value); } } - netdata_rwlock_unlock(&host->labels_rwlock); + netdata_rwlock_unlock(&host->labels.labels_rwlock); return 0; } diff --git a/exporting/json/json.c b/exporting/json/json.c index e746d64ae0..f2396bafa1 100644 --- a/exporting/json/json.c +++ b/exporting/json/json.c @@ -125,8 +125,8 @@ int format_host_labels_json_plaintext(struct instance *instance, RRDHOST *host) int count = 0; rrdhost_check_rdlock(host); - netdata_rwlock_rdlock(&host->labels_rwlock); - for (struct label *label = host->labels; label; label = label->next) { + netdata_rwlock_rdlock(&host->labels.labels_rwlock); + for (struct label *label = host->labels.head; label; label = label->next) { if (!should_send_label(instance, label)) continue; @@ -138,7 +138,7 @@ int format_host_labels_json_plaintext(struct instance *instance, RRDHOST *host) count++; } - netdata_rwlock_unlock(&host->labels_rwlock); + netdata_rwlock_unlock(&host->labels.labels_rwlock); buffer_strcat(instance->labels, "},"); diff --git a/exporting/opentsdb/opentsdb.c b/exporting/opentsdb/opentsdb.c index 4d00f893e3..9f65926641 100644 --- a/exporting/opentsdb/opentsdb.c +++ b/exporting/opentsdb/opentsdb.c @@ -153,8 +153,8 @@ int format_host_labels_opentsdb_telnet(struct instance *instance, RRDHOST *host) return 0; rrdhost_check_rdlock(localhost); - netdata_rwlock_rdlock(&host->labels_rwlock); - for (struct label *label = host->labels; label; label = label->next) { + netdata_rwlock_rdlock(&host->labels.labels_rwlock); + for (struct label *label = host->labels.head; label; label = label->next) { if (!should_send_label(instance, label)) continue; @@ -164,7 +164,7 @@ int format_host_labels_opentsdb_telnet(struct instance *instance, RRDHOST *host) if (*value) buffer_sprintf(instance->labels, " %s=%s", label->key, value); } - netdata_rwlock_unlock(&host->labels_rwlock); + netdata_rwlock_unlock(&host->labels.labels_rwlock); return 0; } @@ -294,8 +294,8 @@ int format_host_labels_opentsdb_http(struct instance *instance, RRDHOST *host) return 0; rrdhost_check_rdlock(host); - netdata_rwlock_rdlock(&host->labels_rwlock); - for (struct label *label = host->labels; label; label = label->next) { + netdata_rwlock_rdlock(&host->labels.labels_rwlock); + for (struct label *label = host->labels.head; label; label = label->next) { if (!should_send_label(instance, label)) continue; @@ -310,7 +310,7 @@ int format_host_labels_opentsdb_http(struct instance *instance, RRDHOST *host) buffer_sprintf(instance->labels, "\"%s\":\"%s\"", label->key, value); } } - netdata_rwlock_unlock(&host->labels_rwlock); + netdata_rwlock_unlock(&host->labels.labels_rwlock); return 0; } diff --git a/exporting/prometheus/prometheus.c b/exporting/prometheus/prometheus.c index 6b44488808..81a397aa34 100644 --- a/exporting/prometheus/prometheus.c +++ b/exporting/prometheus/prometheus.c @@ -283,8 +283,8 @@ void format_host_labels_prometheus(struct instance *instance, RRDHOST *host) int count = 0; rrdhost_check_rdlock(host); - netdata_rwlock_rdlock(&host->labels_rwlock); - for (struct label *label = host->labels; label; label = label->next) { + netdata_rwlock_rdlock(&host->labels.labels_rwlock); + for (struct label *label = host->labels.head; label; label = label->next) { if (!should_send_label(instance, label)) continue; @@ -301,7 +301,7 @@ void format_host_labels_prometheus(struct instance *instance, RRDHOST *host) count++; } } - netdata_rwlock_unlock(&host->labels_rwlock); + netdata_rwlock_unlock(&host->labels.labels_rwlock); } struct host_variables_callback_options { diff --git a/exporting/prometheus/remote_write/remote_write.c b/exporting/prometheus/remote_write/remote_write.c index bd7ff48f20..8f757fc223 100644 --- a/exporting/prometheus/remote_write/remote_write.c +++ b/exporting/prometheus/remote_write/remote_write.c @@ -156,8 +156,8 @@ int format_host_prometheus_remote_write(struct instance *instance, RRDHOST *host if (unlikely(sending_labels_configured(instance))) { rrdhost_check_rdlock(host); - netdata_rwlock_rdlock(&host->labels_rwlock); - for (struct label *label = host->labels; label; label = label->next) { + netdata_rwlock_rdlock(&host->labels.labels_rwlock); + for (struct label *label = host->labels.head; label; label = label->next) { if (!should_send_label(instance, label)) continue; @@ -169,7 +169,7 @@ int format_host_prometheus_remote_write(struct instance *instance, RRDHOST *host add_label(connector_specific_data->write_request, key, value); } - netdata_rwlock_unlock(&host->labels_rwlock); + netdata_rwlock_unlock(&host->labels.labels_rwlock); } return 0; diff --git a/exporting/tests/exporting_fixtures.c b/exporting/tests/exporting_fixtures.c index 42a8e5a749..00bb0ed0f2 100644 --- a/exporting/tests/exporting_fixtures.c +++ b/exporting/tests/exporting_fixtures.c @@ -43,13 +43,13 @@ int setup_rrdhost() label->key = strdupz("key1"); label->value = strdupz("value1"); label->label_source = LABEL_SOURCE_NETDATA_CONF; - localhost->labels = label; + localhost->labels.head = label; label = calloc(1, sizeof(struct label)); label->key = strdupz("key2"); label->value = strdupz("value2"); label->label_source = LABEL_SOURCE_AUTO; - localhost->labels->next = label; + localhost->labels.head->next = label; localhost->rrdset_root = calloc(1, sizeof(RRDSET)); RRDSET *st = localhost->rrdset_root; @@ -93,12 +93,12 @@ int teardown_rrdhost() free((void *)st->name); free(st); - free(localhost->labels->next->key); - free(localhost->labels->next->value); - free(localhost->labels->next); - free(localhost->labels->key); - free(localhost->labels->value); - free(localhost->labels); + free(localhost->labels.head->next->key); + free(localhost->labels.head->next->value); + free(localhost->labels.head->next); + free(localhost->labels.head->key); + free(localhost->labels.head->value); + free(localhost->labels.head); free((void *)localhost->tags); free(localhost); |