Skip to content

Commit

Permalink
Support ROC tools (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
awegrzyn authored Apr 28, 2020
1 parent b925f66 commit 597d10c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 8 deletions.
20 changes: 13 additions & 7 deletions include/Monitoring/Tags.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string_view, 11> TAG_KEY = {
static constexpr std::array<std::string_view, 12> TAG_KEY = {
"hostname"sv,
"rolenane"sv,
"name"sv,
Expand All @@ -53,7 +56,8 @@ static constexpr std::array<std::string_view, 11> TAG_KEY = {
"EPN"sv,
"unit"sv,
"run"sv,
"id"sv
"id"sv,
"type"sv
};

// Tag values
Expand Down Expand Up @@ -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<std::string_view, 37> TAG_VALUE = {{
static constexpr std::array<std::string_view, 38> TAG_VALUE = {{
"ACO"sv,
"AD"sv, // 1
"CPV"sv, // 2
Expand Down Expand Up @@ -135,7 +140,8 @@ static constexpr std::array<std::string_view, 37> 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)
Expand Down
25 changes: 24 additions & 1 deletion test/testInfluxDb.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 597d10c

Please sign in to comment.