summaryrefslogtreecommitdiffstats
path: root/database
diff options
context:
space:
mode:
authorTimotej S <6674623+underhood@users.noreply.github.com>2020-08-26 14:50:37 +0200
committerGitHub <noreply@github.com>2020-08-26 14:50:37 +0200
commitab7ff3131f3698710e0bd9fa3c66d31a3a194725 (patch)
treea78efc8cc829c2519b69e73e24d74e713c5105bb /database
parenta11d33bba77043b28cf2b0dac4989cd189c635b2 (diff)
Adds claimed_id streaming (#9804)
* streams claimed_id of child nodes to parents * adds this information into /api/v1/info
Diffstat (limited to 'database')
-rw-r--r--database/rrd.h3
-rw-r--r--database/rrdhost.c4
2 files changed, 7 insertions, 0 deletions
diff --git a/database/rrd.h b/database/rrd.h
index 405dec3b62..039a489672 100644
--- a/database/rrd.h
+++ b/database/rrd.h
@@ -817,6 +817,9 @@ struct rrdhost {
struct netdata_ssl stream_ssl; //Structure used to encrypt the stream
#endif
+ netdata_mutex_t claimed_id_lock;
+ char *claimed_id; // Claimed ID if host has one otherwise NULL
+
struct rrdhost *next;
};
extern RRDHOST *localhost;
diff --git a/database/rrdhost.c b/database/rrdhost.c
index d82a9099b4..08bdb1b3ba 100644
--- a/database/rrdhost.c
+++ b/database/rrdhost.c
@@ -167,6 +167,8 @@ RRDHOST *rrdhost_create(const char *hostname,
netdata_rwlock_init(&host->rrdhost_rwlock);
netdata_rwlock_init(&host->labels_rwlock);
+ netdata_mutex_init(&host->claimed_id_lock);
+
rrdhost_init_hostname(host, hostname);
rrdhost_init_machine_guid(host, guid);
@@ -858,6 +860,8 @@ void rrdhost_free(RRDHOST *host) {
// ------------------------------------------------------------------------
// free it
+ pthread_mutex_destroy(&host->claimed_id_lock);
+ freez(host->claimed_id);
freez((void *)host->tags);
free_host_labels(host->labels);
freez((void *)host->os);