Skip to content

Commit 485db48

Browse files
committed
[mon] Improve monitoring interface
1 parent 8ac0b9a commit 485db48

File tree

5 files changed

+43
-41
lines changed

5 files changed

+43
-41
lines changed

README.md

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,9 @@ metric format for the CRORC and the CRU is different, as different parameters ar
417417
| Value name | Value | Type |
418418
| ---------------------- | ------------------------ | ------ |
419419
| `"pciAddress"` | - | string |
420-
| `"qsfp"` | "Enabled" or "Disabled" | string |
421-
| `"offset"` | "Dynamic" or "Fixed" | string |
422-
| `"timeFrameDetection"` | "Enabled" or "Disabled" | string |
420+
| `"qsfp"` | 0/1 (Disabled/Enabled) | int |
421+
| `"dynamicOffset"` | 0/1 (Disabled/Enabled) | int |
422+
| `"timeFrameDetection"` | 0/1 (Disabled/Enabled) | int |
423423
| `"timeFrameLength"` | - | int |
424424
425425
| Tag key | Value |
@@ -429,27 +429,28 @@ metric format for the CRORC and the CRU is different, as different parameters ar
429429
430430
###### Metric: `"link"`
431431
432-
| Value name | Value | Type |
433-
| ---------------- | -------------- | ------ |
434-
| `"pciAddress"` | - | string |
435-
| `"status"` | "UP" or "DOWN" | string |
436-
| `"opticalPower"` | - | double |
432+
| Value name | Value | Type |
433+
| ---------------- | -------------- | ------ |
434+
| `"pciAddress"` | - | string |
435+
| `"status"` | 0/1 (DOWN/UP) | int |
436+
| `"opticalPower"` | - | double |
437437
438-
| Tag key | Value |
439-
| ------------------ | --------------- |
440-
| `tags::Key::CRORC` | ID of the CRORC |
441-
| `tags::Key::ID` | ID of the link |
438+
| Tag key | Value |
439+
| ------------------ | -------------------- |
440+
| `tags::Key::CRORC` | ID of the CRORC |
441+
| `tags::Key::ID` | ID of the link |
442+
| `tags::Key::Type` | `tags::Value::CRORC` |
442443
443444
##### CRU
444445
445446
###### Metric: `"CRU"`
446447
447-
| Value name | Value | Type |
448-
| -------------- | ----------------------- | ------ |
449-
| `"pciAddress"` | - | string |
450-
| `"clock"` | "TTC" or "local" | string |
451-
| `"offset"` | "Dynamic" or "Fixed" | string |
452-
| `"userLogic"` | "Enabled" or "Disabled" | string |
448+
| Value name | Value | Type |
449+
| ----------------- | ----------------------- | ------ |
450+
| `"pciAddress"` | - | string |
451+
| `"clock"` | "TTC" or "Local" | string |
452+
| `"dynamicOffset"` | 0/1 (Disabled/Enabled) | int |
453+
| `"userLogic"` | 0/1 (Disabled/Enabled) | int |
453454
454455
| Tag key | Value |
455456
| ----------------- | ------------------ |
@@ -462,19 +463,20 @@ metric format for the CRORC and the CRU is different, as different parameters ar
462463
| ---------------- | ------------------------------------------------------- | ------ |
463464
| `"pciAddress"` | - | string |
464465
| `"gbtMode"` | "GBT/GBT" or "GBT/WB" | string |
465-
| `"loopback"` | "Enabled" or "None" | string |
466+
| `"loopback"` | 0/1 (Enabled/Disabled) | int |
466467
| `"gbtMux"` | "DDG", "SWT", "TTC:CTP", "TTC:PATTERN", or "TTC:MIDTRG" | string |
467468
| `"datapathMode"` | "PACKET" or "CONTINUOUS" | string |
468-
| `"datapath"` | "Enabled" or "Disabled" | string |
469+
| `"datapath"` | 0/1 (Disabled/Enabled) | int |
469470
| `"rxFreq"` | - | double |
470471
| `"txFreq"` | - | double |
471-
| `"status"` | "UP", "DOWN" or "UP (was DOWN)" | string |
472+
| `"status"` | 0/1/2 (DOWN/UP/UP was DOWN) | int |
472473
| `"opticalPower"` | - | double |
473474
474-
| Tag key | Value |
475-
| ---------------- | ---------------|
476-
| `tags::Key::CRU` | ID of the CRU |
477-
| `tags::Key::ID` | ID of the link |
475+
| Tag key | Value |
476+
| ----------------- | ------------------ |
477+
| `tags::Key::CRU` | ID of the CRU |
478+
| `tags::Key::ID` | ID of the link |
479+
| `tags::Key::Type` | `tags::Value::CRU` |
478480
479481
Exceptions
480482
-------------------

src/CommandLineUtilities/ProgramMetrics.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ class ProgramMetrics : public Program
8181
std::unique_ptr<Monitoring> monitoring;
8282
if (mOptions.monitoring) {
8383
monitoring = MonitoringFactory::Get(getMonitoringUri());
84-
monitoring->addGlobalTag(tags::Key::Subsystem, tags::Value::CRU);
8584
}
8685

8786
// Used for the JSON output
@@ -111,7 +110,7 @@ class ProgramMetrics : public Program
111110
.addValue(ctpClock, "ctpClock")
112111
.addValue(localClock, "localClock")
113112
.addValue((int)totalPacketsPerSecond, "totalPacketsPerSecond")
114-
.addTag(tags::Key::ID, i)
113+
.addTag(tags::Key::ID, card.sequenceId)
115114
.addTag(tags::Key::Type, tags::Value::CRU));
116115

117116
} else if (mOptions.jsonOut) {

src/CommandLineUtilities/ProgramStatus.cxx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ class ProgramStatus : public Program
8282
std::unique_ptr<Monitoring> monitoring;
8383
if (mOptions.monitoring) {
8484
monitoring = MonitoringFactory::Get(getMonitoringUri());
85-
monitoring->addGlobalTag(tags::Key::Subsystem, tags::Value::CRU);
8685
}
8786

8887
if (cardType == CardType::type::Crorc) {
@@ -112,9 +111,9 @@ class ProgramStatus : public Program
112111
if (mOptions.monitoring) {
113112
monitoring->send(Metric{ "CRORC" }
114113
.addValue(card.pciAddress.toString(), "pciAddress")
115-
.addValue(qsfpEnabled, "qsfp")
116-
.addValue(offset, "offset")
117-
.addValue(timeFrameDetectionEnabled, "timeFrameDetection")
114+
.addValue(reportInfo.qsfpEnabled, "qsfp")
115+
.addValue(reportInfo.dynamicOffset, "dynamicOffset")
116+
.addValue(reportInfo.timeFrameDetectionEnabled, "timeFrameDetection")
118117
.addValue(reportInfo.timeFrameLength, "timeFrameLength")
119118
.addTag(tags::Key::ID, card.sequenceId)
120119
.addTag(tags::Key::Type, tags::Value::CRORC));
@@ -148,10 +147,11 @@ class ProgramStatus : public Program
148147
if (mOptions.monitoring) {
149148
monitoring->send(Metric{ "link" }
150149
.addValue(card.pciAddress.toString(), "pciAddress")
151-
.addValue(linkStatus, "status")
150+
.addValue(link.status, "status")
152151
.addValue(opticalPower, "opticalPower")
153152
.addTag(tags::Key::CRORC, card.sequenceId)
154-
.addTag(tags::Key::ID, id));
153+
.addTag(tags::Key::ID, id)
154+
.addTag(tags::Key::Type, tags::Value::CRORC));
155155
} else if (mOptions.jsonOut) {
156156
pt::ptree linkNode;
157157

@@ -198,8 +198,8 @@ class ProgramStatus : public Program
198198
monitoring->send(Metric{ "CRU" }
199199
.addValue(card.pciAddress.toString(), "pciAddress")
200200
.addValue(clock, "clock")
201-
.addValue(offset, "offset")
202-
.addValue(userLogic, "userLogic")
201+
.addValue(reportInfo.dynamicOffset, "dynamicOffset")
202+
.addValue(reportInfo.userLogicEnabled, "userLogic")
203203
.addTag(tags::Key::ID, card.sequenceId)
204204
.addTag(tags::Key::Type, tags::Value::CRU));
205205
} else if (mOptions.jsonOut) {
@@ -262,16 +262,17 @@ class ProgramStatus : public Program
262262
monitoring->send(Metric{ "link" }
263263
.addValue(card.pciAddress.toString(), "pciAddress")
264264
.addValue(gbtTxRxMode, "gbtMode")
265-
.addValue(loopback, "loopback")
265+
.addValue(link.loopback, "loopback")
266266
.addValue(gbtMux, "gbtMux")
267267
.addValue(datapathMode, "datapathMode")
268-
.addValue(enabled, "datapath")
268+
.addValue(link.enabled, "datapath")
269269
.addValue(rxFreq, "rxFreq")
270270
.addValue(txFreq, "txFreq")
271-
.addValue(linkStatus, "status")
271+
.addValue(link.stickyBit, "status")
272272
.addValue(opticalPower, "opticalPower")
273273
.addTag(tags::Key::CRU, card.sequenceId)
274-
.addTag(tags::Key::ID, globalId));
274+
.addTag(tags::Key::ID, globalId)
275+
.addTag(tags::Key::Type, tags::Value::CRU));
275276
} else if (mOptions.jsonOut) {
276277
pt::ptree linkNode;
277278

src/Crorc/Common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ namespace Crorc
2424
{
2525

2626
enum LinkStatus {
27-
Up,
2827
Down,
28+
Up,
2929
};
3030

3131
struct Link {

src/Cru/Common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ namespace Cru
2828
{
2929

3030
enum LinkStatus {
31-
Up,
3231
Down,
32+
Up,
3333
UpWasDown
3434
};
3535

0 commit comments

Comments
 (0)