From 1b5bc20e50c87d69d2e2bdec8d3bffd34b5f8981 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Tue, 16 Jan 2024 12:19:47 +0100 Subject: [PATCH 1/2] Revert "Remove no-op InfluxDB URL param" This reverts commit 21f548d3c07189c6a413cf88c2b60cc9ada73497. (cherry picked from commit fc5b1178c643d37dfa1ce8512966b95961bac18f) --- lib/perfdata/influxdbcommonwriter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/perfdata/influxdbcommonwriter.cpp b/lib/perfdata/influxdbcommonwriter.cpp index 5dbc29c51af..a22e78e0599 100644 --- a/lib/perfdata/influxdbcommonwriter.cpp +++ b/lib/perfdata/influxdbcommonwriter.cpp @@ -554,6 +554,7 @@ Url::Ptr InfluxdbCommonWriter::AssembleBaseUrl() url->SetScheme(GetSslEnable() ? "https" : "http"); url->SetHost(GetHost()); url->SetPort(GetPort()); + url->AddQueryElement("precision", "ns"); return url; } From 3a274ac305b94d485eb8d90c1df20a6cc4f475d9 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Tue, 16 Jan 2024 12:19:48 +0100 Subject: [PATCH 2/2] Revert "Influx DB: don't unneccessarily truncate timestamps to whole seconds" This reverts commit eaa3cd83adf860732b955a77b8f5fca7e30c65c2. (cherry picked from commit cc9db3756fa68b303c13258cbb1500d691b1b770) --- lib/perfdata/influxdbcommonwriter.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/perfdata/influxdbcommonwriter.cpp b/lib/perfdata/influxdbcommonwriter.cpp index a22e78e0599..fb0bcc9cc30 100644 --- a/lib/perfdata/influxdbcommonwriter.cpp +++ b/lib/perfdata/influxdbcommonwriter.cpp @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -399,7 +398,7 @@ void InfluxdbCommonWriter::SendMetric(const Checkable::Ptr& checkable, const Dic } } - msgbuf << " " << std::fixed << std::setprecision(0) << ts * 1.0e9; + msgbuf << " " << static_cast(ts); Log(LogDebug, GetReflectionType()->GetName()) << "Checkable '" << checkable->GetName() << "' adds to metric list:'" << msgbuf.str() << "'."; @@ -554,7 +553,7 @@ Url::Ptr InfluxdbCommonWriter::AssembleBaseUrl() url->SetScheme(GetSslEnable() ? "https" : "http"); url->SetHost(GetHost()); url->SetPort(GetPort()); - url->AddQueryElement("precision", "ns"); + url->AddQueryElement("precision", "s"); return url; }