summaryrefslogtreecommitdiffstats
path: root/exporting/send_data.c
diff options
context:
space:
mode:
authorVladimir Kobal <vlad@prokk.net>2020-03-12 13:28:43 +0200
committerGitHub <noreply@github.com>2020-03-12 13:28:43 +0200
commitbc0ca9b1b3cbdd6d1a76d2150080dff79e116e24 (patch)
tree2d2c59e6f32e831612a257c73e81bfdf5f65c361 /exporting/send_data.c
parentbec7b83e19944a7e844c6c7777f92ccba6d504e3 (diff)
Add a Prometheus Remote Write connector to the exporting engine (#8292)
* Copy files from the Prometheus remote write backend * Update the documentation * Rename backend -> exporting * Add the connector to the Netdata build * Separate files for the remote write connector * Add an initializer and formatters * Read a connector specific configuration option * Add a separate function for header sending * Use labels instead of tags * Separate write request for every instance * Add unit tests
Diffstat (limited to 'exporting/send_data.c')
-rw-r--r--exporting/send_data.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/exporting/send_data.c b/exporting/send_data.c
index 237a128c83..6315a7d1bf 100644
--- a/exporting/send_data.c
+++ b/exporting/send_data.c
@@ -76,7 +76,7 @@ void simple_connector_receive_response(int *sock, struct instance *instance)
// if we received data, process them
if (buffer_strlen(response))
- exporting_discard_response(response, instance);
+ instance->check_response(response, instance);
}
/**
@@ -98,8 +98,14 @@ void simple_connector_send_buffer(int *sock, int *failures, struct instance *ins
struct stats *stats = &instance->stats;
- ssize_t written;
- written = send(*sock, buffer_tostring(buffer), len, flags);
+ int ret = 0;
+ if (instance->send_header)
+ ret = instance->send_header(sock, instance);
+
+ ssize_t written = -1;
+
+ if (!ret)
+ written = send(*sock, buffer_tostring(buffer), len, flags);
if(written != -1 && (size_t)written == len) {
// we sent the data successfully