robustify against influxdb out-of-retention stores

pull/110/head
bert hubert 2020-02-25 23:19:09 +01:00
parent 4fa7b30f50
commit 1640e7b509
2 changed files with 9 additions and 3 deletions

View File

@ -114,8 +114,14 @@ void InfluxPusher::doSend(const set<std::string>& buffer)
infl.open ("infl.txt", std::ofstream::out | std::ofstream::app);
infl << newout;
*/
mc.postURL("http://127.0.0.1:8086/write?db="+d_dbname, newout, mch);
try {
mc.postURL("http://127.0.0.1:8086/write?db="+d_dbname, newout, mch);
}
catch(std::exception& e) {
if(strstr(e.what(), "retention"))
return;
throw;
}
}
}

View File

@ -151,7 +151,7 @@ std::string MiniCurl::postURL(const std::string& str, const std::string& postdat
if(res != CURLE_OK || http_code >= 300 ) {
cerr<<"Detailed error: "<<d_data<<endl;
cerr<<postdata<<endl;
throw std::runtime_error("Unable to post URL ("+std::to_string(http_code)+"): "+string(curl_easy_strerror(res)));
throw std::runtime_error("Unable to post URL ("+std::to_string(http_code)+"): "+string(curl_easy_strerror(res))+", detail: "+d_data);
}
std::string ret=d_data;