diff options
author | Vladimir Kobal <vlad@prokk.net> | 2020-11-10 14:47:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-10 14:47:05 +0200 |
commit | 1825ac4c1a03689a866b3d63851c306a8730beef (patch) | |
tree | fc25df8a7ca9476669833c2e99524e7f07ba7a18 | |
parent | 9941c41b28bebcde29998a2aa8a3c1303811ad7b (diff) |
Fix chart filtering (#10218)
-rw-r--r-- | exporting/prometheus/prometheus.c | 2 | ||||
-rw-r--r-- | exporting/prometheus/remote_write/remote_write.c | 24 | ||||
-rw-r--r-- | exporting/send_data.c | 4 |
3 files changed, 13 insertions, 17 deletions
diff --git a/exporting/prometheus/prometheus.c b/exporting/prometheus/prometheus.c index f6854cf179..6b44488808 100644 --- a/exporting/prometheus/prometheus.c +++ b/exporting/prometheus/prometheus.c @@ -8,7 +8,7 @@ // /api/v1/allmetrics?format=prometheus and /api/v1/allmetrics?format=prometheus_all_hosts /** - * Check if a chart can be sent to an external databese + * Check if a chart can be sent to Prometheus * * @param instance an instance data structure. * @param st a chart. diff --git a/exporting/prometheus/remote_write/remote_write.c b/exporting/prometheus/remote_write/remote_write.c index 7f905c116f..a10b75346f 100644 --- a/exporting/prometheus/remote_write/remote_write.c +++ b/exporting/prometheus/remote_write/remote_write.c @@ -191,19 +191,17 @@ int format_chart_prometheus_remote_write(struct instance *instance, RRDSET *st) prometheus_label_copy(family, st->family, PROMETHEUS_ELEMENT_MAX); prometheus_name_copy(context, st->context, PROMETHEUS_ELEMENT_MAX); - if (likely(can_send_rrdset(instance, st))) { - as_collected = (EXPORTING_OPTIONS_DATA_SOURCE(instance->config.options) == EXPORTING_SOURCE_DATA_AS_COLLECTED); - homogeneous = 1; - if (as_collected) { - if (rrdset_flag_check(st, RRDSET_FLAG_HOMOGENEOUS_CHECK)) - rrdset_update_heterogeneous_flag(st); - - if (rrdset_flag_check(st, RRDSET_FLAG_HETEROGENEOUS)) - homogeneous = 0; - } else { - if (EXPORTING_OPTIONS_DATA_SOURCE(instance->config.options) == EXPORTING_SOURCE_DATA_AVERAGE) - prometheus_units_copy(units, st->units, PROMETHEUS_ELEMENT_MAX, 0); - } + as_collected = (EXPORTING_OPTIONS_DATA_SOURCE(instance->config.options) == EXPORTING_SOURCE_DATA_AS_COLLECTED); + homogeneous = 1; + if (as_collected) { + if (rrdset_flag_check(st, RRDSET_FLAG_HOMOGENEOUS_CHECK)) + rrdset_update_heterogeneous_flag(st); + + if (rrdset_flag_check(st, RRDSET_FLAG_HETEROGENEOUS)) + homogeneous = 0; + } else { + if (EXPORTING_OPTIONS_DATA_SOURCE(instance->config.options) == EXPORTING_SOURCE_DATA_AVERAGE) + prometheus_units_copy(units, st->units, PROMETHEUS_ELEMENT_MAX, 0); } return 0; diff --git a/exporting/send_data.c b/exporting/send_data.c index 11c93c5097..38e4c98b13 100644 --- a/exporting/send_data.c +++ b/exporting/send_data.c @@ -64,7 +64,7 @@ void simple_connector_receive_response(int *sock, struct instance *instance) { static BUFFER *response = NULL; if (!response) - response = buffer_create(1); + response = buffer_create(4096); struct stats *stats = &instance->stats; #ifdef ENABLE_HTTPS @@ -79,8 +79,6 @@ void simple_connector_receive_response(int *sock, struct instance *instance) // loop through to collect all data while (*sock != -1 && errno != EWOULDBLOCK) { - buffer_need_bytes(response, 4096); - ssize_t r; #ifdef ENABLE_HTTPS if (exporting_tls_is_enabled(instance->config.type, options) && |