Skip to content

Commit

Permalink
Fix warning and linking against pthread (#191)
Browse files Browse the repository at this point in the history
* Use tag name in ApMon

* Fix InfluxDB test

* Bump CMake version
  • Loading branch information
awegrzyn authored Apr 15, 2020
1 parent 205b2dc commit c169cc5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ endif()

# Define project
project(Monitoring
VERSION 2.6.6
VERSION 3.0.2
DESCRIPTION "O2 Monitoring library"
LANGUAGES CXX
)
Expand Down
2 changes: 2 additions & 0 deletions src/Backends/ApMonBackend.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ void ApMonBackend::send(const Metric& metric)
std::string entity = mEntity;
for (const auto& [key, value] : metric.getTags()) {
entity += ',';
entity += tags::TAG_KEY[key];
entity += '=';
entity += tags::GetValue(value);
}

Expand Down
19 changes: 5 additions & 14 deletions test/testInfluxDb.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
#define BOOST_TEST_MODULE Test Monitoring InfluxDB
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
#include "../src/UriParser/UriParser.h"
#include "../src/Transports/UDP.h"
#include "../src/Transports/StdOut.h"
#include "../src/Backends/InfluxDB.h"
#include "Monitoring/MonitoringFactory.h"

namespace o2
{
Expand All @@ -25,20 +22,14 @@ namespace Test

BOOST_AUTO_TEST_CASE(simplySendMetric)
{
std::string url = "influxdb-udp://localhost:1000";
auto parsed = http::ParseHttpUrl(url);
auto transport = std::make_unique<transports::UDP>(parsed.host, parsed.port);
o2::monitoring::backends::InfluxDB influxBackend(std::move(transport));
o2::monitoring::Metric metric{10, "myCrazyMetric"};
influxBackend.send(metric);
auto monitoring = MonitoringFactory::Get("influxdb-udp://localhost:1000");
monitoring->send(Metric{10, "myCrazyMetric"});
}

BOOST_AUTO_TEST_CASE(simplySendMetric2)
{
auto transport = std::make_unique<transports::StdOut>();
o2::monitoring::backends::InfluxDB influxBackend(std::move(transport));
o2::monitoring::Metric metric{10, "myCrazyMetric"};
influxBackend.send(metric);
auto monitoring = MonitoringFactory::Get("influxdb-stdout://");
monitoring->send(Metric{10, "myCrazyMetric"});
}

} // namespace Test
Expand Down
1 change: 0 additions & 1 deletion test/testMetric.cxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "../include/Monitoring/Metric.h"
#include <chrono>
#include <thread>

#define BOOST_TEST_MODULE Test Monitoring Metric
#define BOOST_TEST_DYN_LINK
Expand Down

0 comments on commit c169cc5

Please sign in to comment.