mirror of https://github.com/Icinga/icinga2.git
Influx DB: don't unneccessarily truncate timestamps to whole seconds
Instead send timestamps with the highest possible precision (ns). Useful for check intervals <1s.
This commit is contained in:
parent
f855cfa155
commit
eaa3cd83ad
|
@ -37,6 +37,7 @@
|
||||||
#include <boost/math/special_functions/fpclassify.hpp>
|
#include <boost/math/special_functions/fpclassify.hpp>
|
||||||
#include <boost/regex.hpp>
|
#include <boost/regex.hpp>
|
||||||
#include <boost/scoped_array.hpp>
|
#include <boost/scoped_array.hpp>
|
||||||
|
#include <iomanip>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
@ -398,7 +399,7 @@ void InfluxdbCommonWriter::SendMetric(const Checkable::Ptr& checkable, const Dic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
msgbuf << " " << static_cast<unsigned long>(ts);
|
msgbuf << " " << std::fixed << std::setprecision(0) << ts * 1.0e9;
|
||||||
|
|
||||||
Log(LogDebug, GetReflectionType()->GetName())
|
Log(LogDebug, GetReflectionType()->GetName())
|
||||||
<< "Checkable '" << checkable->GetName() << "' adds to metric list:'" << msgbuf.str() << "'.";
|
<< "Checkable '" << checkable->GetName() << "' adds to metric list:'" << msgbuf.str() << "'.";
|
||||||
|
@ -553,7 +554,7 @@ Url::Ptr InfluxdbCommonWriter::AssembleBaseUrl()
|
||||||
url->SetScheme(GetSslEnable() ? "https" : "http");
|
url->SetScheme(GetSslEnable() ? "https" : "http");
|
||||||
url->SetHost(GetHost());
|
url->SetHost(GetHost());
|
||||||
url->SetPort(GetPort());
|
url->SetPort(GetPort());
|
||||||
url->AddQueryElement("precision", "s");
|
url->AddQueryElement("precision", "ns");
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue