Skip to content

Commit 597d10c

Browse files
authored
Support ROC tools (#195)
1 parent b925f66 commit 597d10c

File tree

2 files changed

+37
-8
lines changed

2 files changed

+37
-8
lines changed

include/Monitoring/Tags.h

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,14 @@ enum class Key : unsigned short int {
3838
CRU,
3939
FLP,
4040
EPN,
41-
Unit
41+
Unit,
42+
Run,
43+
ID,
44+
Type
4245
};
4346

4447
/// Tag keys array
45-
static constexpr std::array<std::string_view, 11> TAG_KEY = {
48+
static constexpr std::array<std::string_view, 12> TAG_KEY = {
4649
"hostname"sv,
4750
"rolenane"sv,
4851
"name"sv,
@@ -53,7 +56,8 @@ static constexpr std::array<std::string_view, 11> TAG_KEY = {
5356
"EPN"sv,
5457
"unit"sv,
5558
"run"sv,
56-
"id"sv
59+
"id"sv,
60+
"type"sv
5761
};
5862

5963
// Tag values
@@ -93,12 +97,13 @@ enum class Value : unsigned short int {
9397
Seconds, // 32
9498
PerSecond, // 33
9599
PerCycle, // 34
96-
PerRun, // 35
97-
Monitoring
100+
PerRun, // 35
101+
Monitoring, // 36
102+
CRORC
98103
};
99104

100105
// Tag value array
101-
static constexpr std::array<std::string_view, 37> TAG_VALUE = {{
106+
static constexpr std::array<std::string_view, 38> TAG_VALUE = {{
102107
"ACO"sv,
103108
"AD"sv, // 1
104109
"CPV"sv, // 2
@@ -135,7 +140,8 @@ static constexpr std::array<std::string_view, 37> TAG_VALUE = {{
135140
"ps"sv, // 33
136141
"pcycle"sv, // 34
137142
"prun"sv, // 35
138-
"monitoring"sv
143+
"monitoring"sv,
144+
"CRORC"sv
139145
}};
140146

141147
static constexpr std::string_view GetValue(const int value)

test/testInfluxDb.cxx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,31 @@ BOOST_AUTO_TEST_CASE(simplySendMetric)
2828

2929
BOOST_AUTO_TEST_CASE(simplySendMetric2)
3030
{
31+
using std::string_literals::operator""s;
3132
auto monitoring = MonitoringFactory::Get("influxdb-stdout://");
32-
monitoring->send(Metric{10, "myCrazyMetric"});
33+
monitoring->send(Metric{"card"}
34+
.addValue(40.217773, "temperature")
35+
.addValue(0, "droppedPackets")
36+
.addValue(0.768170, "ctpClock")
37+
.addValue(240.471130, "localClock")
38+
.addValue(0, "totalPacketsPerSecond")
39+
.addTag(tags::Key::ID, 3)
40+
.addTag(tags::Key::Type, tags::Value::CRU)
41+
);
42+
43+
monitoring->send(Metric{"link"}
44+
.addValue("GBT/GBT"s, "gbtMode")
45+
.addValue("None"s, "loopback")
46+
.addValue("TTC:CTP"s, "gbtMux")
47+
.addValue("Continuous"s, "datapathMode")
48+
.addValue("Disabled"s, "datapath")
49+
.addValue(181.370575, "rxFreq")
50+
.addValue(196.250259, "txFreq")
51+
.addValue(0, "status")
52+
.addValue(657.400024, "opticalPower")
53+
.addTag(tags::Key::CRU, 3)
54+
.addTag(tags::Key::ID, 3)
55+
);
3356
}
3457

3558
} // namespace Test

0 commit comments

Comments
 (0)