summaryrefslogtreecommitdiffstats
path: root/streaming
diff options
context:
space:
mode:
authorIlya Mashchenko <ilya@netdata.cloud>2020-12-14 17:27:55 +0300
committerGitHub <noreply@github.com>2020-12-14 17:27:55 +0300
commit0f8175dd3060691394e263cdab01c8f940b1b5d3 (patch)
tree4b14cd6b7e6ba7797eeec4c74b4c4c35cdad4494 /streaming
parent7bfa8c8eba72a109d940b1fa5c7acaed9cd7a52c (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 'streaming')
-rw-r--r--streaming/receiver.c2
-rw-r--r--streaming/rrdpush.c20
-rw-r--r--streaming/sender.c8
3 files changed, 15 insertions, 15 deletions
diff --git a/streaming/receiver.c b/streaming/receiver.c
index 495a40c017..3ea15806d8 100644
--- a/streaming/receiver.c
+++ b/streaming/receiver.c
@@ -421,7 +421,7 @@ static int rrdpush_receive(struct receiver_state *rpt)
*/
// rpt->host->connected_senders++;
- rpt->host->labels_flag = (rpt->stream_version > 0)?LABEL_FLAG_UPDATE_STREAM:LABEL_FLAG_STOP_STREAM;
+ rpt->host->labels.labels_flag = (rpt->stream_version > 0)?LABEL_FLAG_UPDATE_STREAM:LABEL_FLAG_STOP_STREAM;
if(health_enabled != CONFIG_BOOLEAN_NO) {
if(alarms_delay > 0) {
diff --git a/streaming/rrdpush.c b/streaming/rrdpush.c
index 3b813e01fe..f54fc609ee 100644
--- a/streaming/rrdpush.c
+++ b/streaming/rrdpush.c
@@ -334,35 +334,35 @@ void rrdset_done_push(RRDSET *st) {
// labels
void rrdpush_send_labels(RRDHOST *host) {
- if (!host->labels || !(host->labels_flag & LABEL_FLAG_UPDATE_STREAM) || (host->labels_flag & LABEL_FLAG_STOP_STREAM))
+ if (!host->labels.head || !(host->labels.labels_flag & LABEL_FLAG_UPDATE_STREAM) || (host->labels.labels_flag & LABEL_FLAG_STOP_STREAM))
return;
sender_start(host->sender);
rrdhost_rdlock(host);
- netdata_rwlock_rdlock(&host->labels_rwlock);
+ netdata_rwlock_rdlock(&host->labels.labels_rwlock);
- struct label *labels = host->labels;
- while(labels) {
+ struct label *label_i = host->labels.head;
+ while(label_i) {
buffer_sprintf(host->sender->build
, "LABEL \"%s\" = %d %s\n"
- , labels->key
- , (int)labels->label_source
- , labels->value);
+ , label_i->key
+ , (int)label_i->label_source
+ , label_i->value);
- labels = labels->next;
+ label_i = label_i->next;
}
buffer_sprintf(host->sender->build
, "OVERWRITE %s\n", "labels");
- netdata_rwlock_unlock(&host->labels_rwlock);
+ netdata_rwlock_unlock(&host->labels.labels_rwlock);
rrdhost_unlock(host);
sender_commit(host->sender);
if(host->rrdpush_sender_pipe[PIPE_WRITE] != -1 && write(host->rrdpush_sender_pipe[PIPE_WRITE], " ", 1) == -1)
error("STREAM %s [send]: cannot write to internal pipe", host->hostname);
- host->labels_flag &= ~LABEL_FLAG_UPDATE_STREAM;
+ host->labels.labels_flag &= ~LABEL_FLAG_UPDATE_STREAM;
}
void rrdpush_claimed_id(RRDHOST *host)
diff --git a/streaming/sender.c b/streaming/sender.c
index a6191b0a84..c112609808 100644
--- a/streaming/sender.c
+++ b/streaming/sender.c
@@ -116,8 +116,8 @@ static inline void rrdpush_sender_thread_data_flush(RRDHOST *host) {
}
static inline void rrdpush_set_flags_to_newest_stream(RRDHOST *host) {
- host->labels_flag |= LABEL_FLAG_UPDATE_STREAM;
- host->labels_flag &= ~LABEL_FLAG_STOP_STREAM;
+ host->labels.labels_flag |= LABEL_FLAG_UPDATE_STREAM;
+ host->labels.labels_flag &= ~LABEL_FLAG_STOP_STREAM;
}
void rrdpush_encode_variable(stream_encoded_t *se, RRDHOST *host)
@@ -354,8 +354,8 @@ static int rrdpush_sender_thread_connect_to_parent(RRDHOST *host, int default_po
answer = memcmp(http, START_STREAMING_PROMPT, strlen(START_STREAMING_PROMPT));
if(!answer) {
version = 0;
- host->labels_flag |= LABEL_FLAG_STOP_STREAM;
- host->labels_flag &= ~LABEL_FLAG_UPDATE_STREAM;
+ host->labels.labels_flag |= LABEL_FLAG_STOP_STREAM;
+ host->labels.labels_flag &= ~LABEL_FLAG_UPDATE_STREAM;
}
}
}