From 597d10c1bbfc5153537fc88b2f9e8fb7cf3f3cad Mon Sep 17 00:00:00 2001 From: Adam Wegrzynek Date: Tue, 28 Apr 2020 13:18:53 +0200 Subject: [PATCH] Support ROC tools (#195) --- include/Monitoring/Tags.h | 20 +++++++++++++------- test/testInfluxDb.cxx | 25 ++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/include/Monitoring/Tags.h b/include/Monitoring/Tags.h index 8555c265b..ae0b29329 100644 --- a/include/Monitoring/Tags.h +++ b/include/Monitoring/Tags.h @@ -38,11 +38,14 @@ enum class Key : unsigned short int { CRU, FLP, EPN, - Unit + Unit, + Run, + ID, + Type }; /// Tag keys array -static constexpr std::array TAG_KEY = { +static constexpr std::array TAG_KEY = { "hostname"sv, "rolenane"sv, "name"sv, @@ -53,7 +56,8 @@ static constexpr std::array TAG_KEY = { "EPN"sv, "unit"sv, "run"sv, - "id"sv + "id"sv, + "type"sv }; // Tag values @@ -93,12 +97,13 @@ enum class Value : unsigned short int { Seconds, // 32 PerSecond, // 33 PerCycle, // 34 - PerRun, // 35 - Monitoring + PerRun, // 35 + Monitoring, // 36 + CRORC }; // Tag value array -static constexpr std::array TAG_VALUE = {{ +static constexpr std::array TAG_VALUE = {{ "ACO"sv, "AD"sv, // 1 "CPV"sv, // 2 @@ -135,7 +140,8 @@ static constexpr std::array TAG_VALUE = {{ "ps"sv, // 33 "pcycle"sv, // 34 "prun"sv, // 35 - "monitoring"sv + "monitoring"sv, + "CRORC"sv }}; static constexpr std::string_view GetValue(const int value) diff --git a/test/testInfluxDb.cxx b/test/testInfluxDb.cxx index 6ae8c3e61..bfad0b6fb 100644 --- a/test/testInfluxDb.cxx +++ b/test/testInfluxDb.cxx @@ -28,8 +28,31 @@ BOOST_AUTO_TEST_CASE(simplySendMetric) BOOST_AUTO_TEST_CASE(simplySendMetric2) { + using std::string_literals::operator""s; auto monitoring = MonitoringFactory::Get("influxdb-stdout://"); - monitoring->send(Metric{10, "myCrazyMetric"}); + monitoring->send(Metric{"card"} + .addValue(40.217773, "temperature") + .addValue(0, "droppedPackets") + .addValue(0.768170, "ctpClock") + .addValue(240.471130, "localClock") + .addValue(0, "totalPacketsPerSecond") + .addTag(tags::Key::ID, 3) + .addTag(tags::Key::Type, tags::Value::CRU) + ); + + monitoring->send(Metric{"link"} + .addValue("GBT/GBT"s, "gbtMode") + .addValue("None"s, "loopback") + .addValue("TTC:CTP"s, "gbtMux") + .addValue("Continuous"s, "datapathMode") + .addValue("Disabled"s, "datapath") + .addValue(181.370575, "rxFreq") + .addValue(196.250259, "txFreq") + .addValue(0, "status") + .addValue(657.400024, "opticalPower") + .addTag(tags::Key::CRU, 3) + .addTag(tags::Key::ID, 3) + ); } } // namespace Test