Skip to content

Commit c169cc5

Browse files
authored
Fix warning and linking against pthread (#191)
* Use tag name in ApMon * Fix InfluxDB test * Bump CMake version
1 parent 205b2dc commit c169cc5

File tree

4 files changed

+8
-16
lines changed

4 files changed

+8
-16
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ endif()
1717

1818
# Define project
1919
project(Monitoring
20-
VERSION 2.6.6
20+
VERSION 3.0.2
2121
DESCRIPTION "O2 Monitoring library"
2222
LANGUAGES CXX
2323
)

src/Backends/ApMonBackend.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ void ApMonBackend::send(const Metric& metric)
6464
std::string entity = mEntity;
6565
for (const auto& [key, value] : metric.getTags()) {
6666
entity += ',';
67+
entity += tags::TAG_KEY[key];
68+
entity += '=';
6769
entity += tags::GetValue(value);
6870
}
6971

test/testInfluxDb.cxx

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111
#define BOOST_TEST_MODULE Test Monitoring InfluxDB
1212
#define BOOST_TEST_DYN_LINK
1313
#include <boost/test/unit_test.hpp>
14-
#include "../src/UriParser/UriParser.h"
15-
#include "../src/Transports/UDP.h"
16-
#include "../src/Transports/StdOut.h"
17-
#include "../src/Backends/InfluxDB.h"
14+
#include "Monitoring/MonitoringFactory.h"
1815

1916
namespace o2
2017
{
@@ -25,20 +22,14 @@ namespace Test
2522

2623
BOOST_AUTO_TEST_CASE(simplySendMetric)
2724
{
28-
std::string url = "influxdb-udp://localhost:1000";
29-
auto parsed = http::ParseHttpUrl(url);
30-
auto transport = std::make_unique<transports::UDP>(parsed.host, parsed.port);
31-
o2::monitoring::backends::InfluxDB influxBackend(std::move(transport));
32-
o2::monitoring::Metric metric{10, "myCrazyMetric"};
33-
influxBackend.send(metric);
25+
auto monitoring = MonitoringFactory::Get("influxdb-udp://localhost:1000");
26+
monitoring->send(Metric{10, "myCrazyMetric"});
3427
}
3528

3629
BOOST_AUTO_TEST_CASE(simplySendMetric2)
3730
{
38-
auto transport = std::make_unique<transports::StdOut>();
39-
o2::monitoring::backends::InfluxDB influxBackend(std::move(transport));
40-
o2::monitoring::Metric metric{10, "myCrazyMetric"};
41-
influxBackend.send(metric);
31+
auto monitoring = MonitoringFactory::Get("influxdb-stdout://");
32+
monitoring->send(Metric{10, "myCrazyMetric"});
4233
}
4334

4435
} // namespace Test

test/testMetric.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include "../include/Monitoring/Metric.h"
22
#include <chrono>
3-
#include <thread>
43

54
#define BOOST_TEST_MODULE Test Monitoring Metric
65
#define BOOST_TEST_DYN_LINK

0 commit comments

Comments
 (0)