summaryrefslogtreecommitdiffstats
path: root/streaming/rrdpush.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-01-26 18:05:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-01-26 18:05:10 +0000
commit34a0b66bc2d48223748ed1cf5bc1b305c396bd74 (patch)
treefbd36be86cc6bc4288fe627f2b5beada569848bb /streaming/rrdpush.c
parentAdding upstream version 1.32.1. (diff)
downloadnetdata-34a0b66bc2d48223748ed1cf5bc1b305c396bd74.tar.xz
netdata-34a0b66bc2d48223748ed1cf5bc1b305c396bd74.zip
Adding upstream version 1.33.0.upstream/1.33.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'streaming/rrdpush.c')
-rw-r--r--streaming/rrdpush.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/streaming/rrdpush.c b/streaming/rrdpush.c
index 53a897699..ebd8327f0 100644
--- a/streaming/rrdpush.c
+++ b/streaming/rrdpush.c
@@ -40,6 +40,9 @@ struct config stream_config = {
};
unsigned int default_rrdpush_enabled = 0;
+#ifdef ENABLE_COMPRESSION
+unsigned int default_compression_enabled = 0;
+#endif
char *default_rrdpush_destination = NULL;
char *default_rrdpush_api_key = NULL;
char *default_rrdpush_send_charts_matching = NULL;
@@ -73,7 +76,10 @@ int rrdpush_init() {
default_rrdpush_api_key = appconfig_get(&stream_config, CONFIG_SECTION_STREAM, "api key", "");
default_rrdpush_send_charts_matching = appconfig_get(&stream_config, CONFIG_SECTION_STREAM, "send charts matching", "*");
rrdhost_free_orphan_time = config_get_number(CONFIG_SECTION_GLOBAL, "cleanup orphan hosts after seconds", rrdhost_free_orphan_time);
-
+#ifdef ENABLE_COMPRESSION
+ default_compression_enabled = (unsigned int)appconfig_get_boolean(&stream_config, CONFIG_SECTION_STREAM,
+ "enable compression", default_compression_enabled);
+#endif
if(default_rrdpush_enabled && (!default_rrdpush_destination || !*default_rrdpush_destination || !default_rrdpush_api_key || !*default_rrdpush_api_key)) {
error("STREAM [send]: cannot enable sending thread - information is missing.");
@@ -287,7 +293,7 @@ static inline void rrdpush_send_chart_metrics_nolock(RRDSET *st, struct sender_s
RRDHOST *host = st->rrdhost;
buffer_sprintf(host->sender->build, "BEGIN \"%s\" %llu", st->id, (st->last_collected_time.tv_sec > st->upstream_resync_time)?st->usec_since_last_update:0);
if (s->version >= VERSION_GAP_FILLING)
- buffer_sprintf(host->sender->build, " %ld\n", st->last_collected_time.tv_sec);
+ buffer_sprintf(host->sender->build, " %"PRId64"\n", (int64_t)st->last_collected_time.tv_sec);
else
buffer_strcat(host->sender->build, "\n");
@@ -522,6 +528,10 @@ int rrdpush_receiver_thread_spawn(struct web_client *w, char *url) {
utc_offset = (int32_t)strtol(value, NULL, 0);
else if(!strcmp(name, "hops"))
system_info->hops = (uint16_t) strtoul(value, NULL, 0);
+ else if(!strcmp(name, "ml_capable"))
+ system_info->ml_capable = strtoul(value, NULL, 0);
+ else if(!strcmp(name, "ml_enabled"))
+ system_info->ml_enabled = strtoul(value, NULL, 0);
else if(!strcmp(name, "tags"))
tags = value;
else if(!strcmp(name, "ver"))
@@ -677,7 +687,13 @@ int rrdpush_receiver_thread_spawn(struct web_client *w, char *url) {
host->receiver->shutdown = 1;
shutdown(host->receiver->fd, SHUT_RDWR);
host->receiver = NULL; // Thread holds reference to structure
- info("STREAM %s [receive from [%s]:%s]: multiple connections for same host detected - existing connection is dead (%ld sec), accepting new connection.", host->hostname, w->client_ip, w->client_port, age);
+ info(
+ "STREAM %s [receive from [%s]:%s]: multiple connections for same host detected - "
+ "existing connection is dead (%"PRId64" sec), accepting new connection.",
+ host->hostname,
+ w->client_ip,
+ w->client_port,
+ (int64_t)age);
}
else {
netdata_mutex_unlock(&host->receiver_lock);
@@ -685,7 +701,13 @@ int rrdpush_receiver_thread_spawn(struct web_client *w, char *url) {
rrd_unlock();
log_stream_connection(w->client_ip, w->client_port, key, host->machine_guid, host->hostname,
"REJECTED - ALREADY CONNECTED");
- info("STREAM %s [receive from [%s]:%s]: multiple connections for same host detected - existing connection is active (within last %ld sec), rejecting new connection.", host->hostname, w->client_ip, w->client_port, age);
+ info(
+ "STREAM %s [receive from [%s]:%s]: multiple connections for same host detected - "
+ "existing connection is active (within last %"PRId64" sec), rejecting new connection.",
+ host->hostname,
+ w->client_ip,
+ w->client_port,
+ (int64_t)age);
// Have not set WEB_CLIENT_FLAG_DONT_CLOSE_SOCKET - caller should clean up
buffer_flush(w->response.data);
buffer_strcat(w->response.data, "This GUID is already streaming to this server");
@@ -759,4 +781,4 @@ int rrdpush_receiver_thread_spawn(struct web_client *w, char *url) {
buffer_flush(w->response.data);
return 200;
-}
+} \ No newline at end of file