X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fwrite_stackdriver.c;h=fd0192a064aef60da5fa8f87d58ca5a81879dcd2;hb=28a82858cb615355ba646f4a10f89bcf69a4abb6;hp=9d06c25039c496b41d9d329ad506267b9a3c4b09;hpb=cb3704e79da2bdd96c58aca72560cc02379fb0b4;p=collectd.git diff --git a/src/write_stackdriver.c b/src/write_stackdriver.c index 9d06c250..fd0192a0 100644 --- a/src/write_stackdriver.c +++ b/src/write_stackdriver.c @@ -22,12 +22,12 @@ #include "collectd.h" -#include "common.h" #include "configfile.h" #include "plugin.h" -#include "utils_format_stackdriver.h" -#include "utils_gce.h" -#include "utils_oauth.h" +#include "utils/common/common.h" +#include "utils/format_stackdriver/format_stackdriver.h" +#include "utils/gce/gce.h" +#include "utils/oauth/oauth.h" #include #include @@ -225,8 +225,10 @@ static int do_post(wg_callback_t *cb, char const *url, void const *payload, if (status != CURLE_OK) { ERROR("write_stackdriver plugin: POST %s failed: %s", url, cb->curl_errbuf); - sfree(ret_content->memory); - ret_content->size = 0; + if (ret_content != NULL) { + sfree(ret_content->memory); + ret_content->size = 0; + } return -1; } @@ -234,10 +236,10 @@ static int do_post(wg_callback_t *cb, char const *url, void const *payload, curl_easy_getinfo(cb->curl, CURLINFO_RESPONSE_CODE, &http_code); if (ret_content != NULL) { - if ((status >= 400) && (status < 500)) { + if ((http_code >= 400) && (http_code < 500)) { ERROR("write_stackdriver plugin: POST %s: %s", url, API_ERROR_STRING(parse_api_error(ret_content->memory))); - } else if (status >= 500) { + } else if (http_code >= 500) { WARNING("write_stackdriver plugin: POST %s: %s", url, ret_content->memory); } @@ -339,11 +341,6 @@ static int wg_flush_nolock(cdtime_t timeout, wg_callback_t *cb) /* {{{ */ char *payload = sd_output_reset(cb->formatter); int status = wg_call_timeseries_write(cb, payload); - if (status != 0) { - ERROR("write_stackdriver plugin: Sending buffer failed with status %d.", - status); - } - wg_reset_buffer(cb); return status; } /* }}} wg_flush_nolock */