Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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