Skip to content

Commit c7c8257

Browse files
committed
[metrics,status] Add serial and endpoint metrics
1 parent 14fc3d3 commit c7c8257

File tree

3 files changed

+31
-5
lines changed

3 files changed

+31
-5
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,9 @@ To directly send metrics to the Alice O2 Monitoring library, the argument `--mon
389389
390390
| Value name | Value | type |
391391
| ------------------------- | ----- | ------ |
392+
| `"pciAddress"` | - | string |
393+
| `"serial"` | - | int |
394+
| `"endpoint"` | - | int |
392395
| `"temperature"` | - | double |
393396
| `"droppedPackets"` | - | int |
394397
| `"ctpClock"` | - | double |
@@ -436,6 +439,7 @@ metric format for the CRORC and the CRU is different, as different parameters ar
436439
| Value name | Value | Type |
437440
| ---------------------- | ------------------------ | ------ |
438441
| `"pciAddress"` | - | string |
442+
| `"serial"` | - | int |
439443
| `"qsfp"` | 0/1 (Disabled/Enabled) | int |
440444
| `"dynamicOffset"` | 0/1 (Disabled/Enabled) | int |
441445
| `"timeFrameDetection"` | 0/1 (Disabled/Enabled) | int |
@@ -451,6 +455,7 @@ metric format for the CRORC and the CRU is different, as different parameters ar
451455
| Value name | Value | Type |
452456
| ---------------- | -------------- | ------ |
453457
| `"pciAddress"` | - | string |
458+
| `"serial"` | - | int |
454459
| `"status"` | 0/1 (DOWN/UP) | int |
455460
| `"opticalPower"` | - | double |
456461
@@ -467,6 +472,8 @@ metric format for the CRORC and the CRU is different, as different parameters ar
467472
| Value name | Value | Type |
468473
| --------------------------- | ----------------------- | ------ |
469474
| `"pciAddress"` | - | string |
475+
| `"serial"` | - | int |
476+
| `"endpoint"` | - | int |
470477
| `"CRU ID"` | Assigned CRU ID | int |
471478
| `"clock"` | "TTC" or "Local" | string |
472479
| `"dynamicOffset"` | 0/1 (Disabled/Enabled) | int |
@@ -500,6 +507,8 @@ metric format for the CRORC and the CRU is different, as different parameters ar
500507
| Value name | Value | Type |
501508
| ---------------- | ----------------------------------------------------------------- | ------ |
502509
| `"pciAddress"` | - | string |
510+
| `"serial"` | - | int |
511+
| `"endpoint"` | - | int |
503512
| `"gbtMode"` | "GBT/GBT" or "GBT/WB" | string |
504513
| `"loopback"` | 0/1 (Enabled/Disabled) | int |
505514
| `"gbtMux"` | "DDG", "SWT", "TTC:CTP", "TTC:PATTERN", "TTC:MIDTRG", or "TTCUP" | string |

src/CommandLineUtilities/ProgramMetrics.cxx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ class ProgramMetrics : public Program
6262
{
6363

6464
std::ostringstream table;
65-
auto formatHeader = " %-3s %-6s %-10s %-10s %-19s %-20s %-19s %-26s\n";
66-
auto formatRow = " %-3s %-6s %-10s %-10s %-19s %-20s %-19s %-26s\n";
67-
auto header = (boost::format(formatHeader) % "#" % "Type" % "PCI Addr" % "Temp (C)" % "#Dropped Packets" % "CTP Clock (MHz)" % "Local Clock (MHz)" % "Total Packets per second").str();
65+
auto formatHeader = " %-3s %-6s %-10s %-8s %-10s %-10s %-19s %-20s %-19s %-26s\n";
66+
auto formatRow = " %-3s %-6s %-10s %-8s %-10s %-10s %-19s %-20s %-19s %-26s\n";
67+
auto header = (boost::format(formatHeader) % "#" % "Type" % "PCI Addr" % "Serial" % "Endpoint" % "Temp (C)" % "#Dropped Packets" % "CTP Clock (MHz)" % "Local Clock (MHz)" % "Total Packets per second").str();
6868
auto lineFat = std::string(header.length(), '=') + '\n';
6969
auto lineThin = std::string(header.length(), '-') + '\n';
7070

7171
if (mOptions.csvOut) {
72-
auto csvHeader = "#,Type,PCI Addr,Temp (C),#Dropped Packets,CTP Clock (MHz),Local Clock (MHz),Total Packets per second\n";
72+
auto csvHeader = "#,Type,PCI Addr,Serial,Endpoint,Temp (C),#Dropped Packets,CTP Clock (MHz),Local Clock (MHz),Total Packets per second\n";
7373
std::cout << csvHeader;
7474
} else if (!mOptions.jsonOut) {
7575
table << lineFat << header << lineThin;
@@ -105,6 +105,8 @@ class ProgramMetrics : public Program
105105
if (mOptions.monitoring) {
106106
monitoring->send(Metric{ "card" }
107107
.addValue(card.pciAddress.toString(), "pciAddress")
108+
.addValue(card.serialId.getSerial(), "serial")
109+
.addValue(card.serialId.getEndpoint(), "endpoint")
108110
.addValue(temperature, "temperature")
109111
.addValue(dropped, "droppedPackets")
110112
.addValue(ctpClock, "ctpClock")
@@ -119,6 +121,8 @@ class ProgramMetrics : public Program
119121
// add kv pairs for this card
120122
cardNode.put("type", CardType::toString(card.cardType));
121123
cardNode.put("pciAddress", card.pciAddress.toString());
124+
cardNode.put("serial", card.serialId.getSerial());
125+
cardNode.put("endpoint", card.serialId.getEndpoint());
122126
cardNode.put("temperature", Utilities::toPreciseString(temperature));
123127
cardNode.put("droppedPackets", std::to_string(dropped));
124128
cardNode.put("ctpClock", Utilities::toPreciseString(ctpClock));
@@ -129,11 +133,12 @@ class ProgramMetrics : public Program
129133
root.add_child(std::to_string(i), cardNode);
130134
} else if (mOptions.csvOut) {
131135
auto csvLine = std::to_string(i) + "," + CardType::toString(card.cardType) + "," + card.pciAddress.toString() + "," +
136+
std::to_string(card.serialId.getSerial()) + "," + std::to_string(card.serialId.getEndpoint()) + "," +
132137
std::to_string(temperature) + "," + std::to_string(dropped) + "," + std::to_string(ctpClock) + "," +
133138
std::to_string(localClock) + "," + std::to_string(totalPacketsPerSecond) + "\n";
134139
std::cout << csvLine;
135140
} else {
136-
auto format = boost::format(formatRow) % i % CardType::toString(card.cardType) % card.pciAddress.toString() % temperature % dropped % ctpClock % localClock % totalPacketsPerSecond;
141+
auto format = boost::format(formatRow) % i % CardType::toString(card.cardType) % card.pciAddress.toString() % card.serialId.getSerial() % card.serialId.getEndpoint() % temperature % dropped % ctpClock % localClock % totalPacketsPerSecond;
137142

138143
table << format;
139144
}

src/CommandLineUtilities/ProgramStatus.cxx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,17 @@ class ProgramStatus : public Program
114114
if (mOptions.monitoring) {
115115
monitoring->send(Metric{ "CRORC" }
116116
.addValue(card.pciAddress.toString(), "pciAddress")
117+
.addValue(card.serialId.getSerial(), "serial")
117118
.addValue(reportInfo.qsfpEnabled, "qsfp")
118119
.addValue(reportInfo.dynamicOffset, "dynamicOffset")
119120
.addValue(reportInfo.timeFrameDetectionEnabled, "timeFrameDetection")
120121
.addValue(reportInfo.timeFrameLength, "timeFrameLength")
121122
.addTag(tags::Key::ID, card.sequenceId)
122123
.addTag(tags::Key::Type, tags::Value::CRORC));
123124
} else if (mOptions.jsonOut) {
125+
root.put("pciAddress", card.pciAddress.toString());
126+
root.put("serial", card.serialId.getSerial());
127+
root.put("endpoint", card.serialId.getEndpoint());
124128
root.put("qsfp", qsfpEnabled);
125129
root.put("offset", offset);
126130
root.put("timeFrameDetection", timeFrameDetectionEnabled);
@@ -150,6 +154,7 @@ class ProgramStatus : public Program
150154
if (mOptions.monitoring) {
151155
monitoring->send(Metric{ "link" }
152156
.addValue(card.pciAddress.toString(), "pciAddress")
157+
.addValue(card.serialId.getSerial(), "serial")
153158
.addValue(link.status, "status")
154159
.addValue(opticalPower, "opticalPower")
155160
.addTag(tags::Key::CRORC, card.sequenceId)
@@ -202,6 +207,8 @@ class ProgramStatus : public Program
202207
if (mOptions.monitoring) {
203208
monitoring->send(Metric{ "CRU" }
204209
.addValue(card.pciAddress.toString(), "pciAddress")
210+
.addValue(card.serialId.getSerial(), "serial")
211+
.addValue(card.serialId.getEndpoint(), "endpoint")
205212
.addValue(clock, "clock")
206213
.addValue(reportInfo.dynamicOffset, "dynamicOffset")
207214
.addValue(reportInfo.userLogicEnabled, "userLogic")
@@ -210,6 +217,9 @@ class ProgramStatus : public Program
210217
.addTag(tags::Key::ID, card.sequenceId)
211218
.addTag(tags::Key::Type, tags::Value::CRU));
212219
} else if (mOptions.jsonOut) {
220+
root.put("pciAddress", card.pciAddress.toString());
221+
root.put("serial", card.serialId.getSerial());
222+
root.put("endpoint", card.serialId.getEndpoint());
213223
root.put("cruId", reportInfo.cruId);
214224
root.put("clock", clock);
215225
root.put("offset", offset);
@@ -330,6 +340,8 @@ class ProgramStatus : public Program
330340
if (mOptions.monitoring) {
331341
monitoring->send(Metric{ "link" }
332342
.addValue(card.pciAddress.toString(), "pciAddress")
343+
.addValue(card.serialId.getSerial(), "serial")
344+
.addValue(card.serialId.getEndpoint(), "endpoint")
333345
.addValue(gbtTxRxMode, "gbtMode")
334346
.addValue(link.loopback, "loopback")
335347
.addValue(gbtMux, "gbtMux")

0 commit comments

Comments
 (0)