Prometheus API: Only output the channels if they where read at least once
This commit is contained in:
parent
c67b3e3cbd
commit
4d18ccf01d
@ -65,27 +65,29 @@ void WebApiPrometheusClass::onPrometheusMetricsGet(AsyncWebServerRequest* reques
|
|||||||
stream->printf("opendtu_last_update{serial=\"%s\",unit=\"%d\",name=\"%s\"} %d\n",
|
stream->printf("opendtu_last_update{serial=\"%s\",unit=\"%d\",name=\"%s\"} %d\n",
|
||||||
serial.c_str(), i, name, inv->Statistics()->getLastUpdate() / 1000);
|
serial.c_str(), i, name, inv->Statistics()->getLastUpdate() / 1000);
|
||||||
|
|
||||||
// Loop all channels
|
// Loop all channels if Statistics have been updated at least once since DTU boot
|
||||||
for (auto& t : inv->Statistics()->getChannelTypes()) {
|
if (inv->Statistics()->getLastUpdate() > 0) {
|
||||||
for (auto& c : inv->Statistics()->getChannelsByType(t)) {
|
for (auto& t : inv->Statistics()->getChannelTypes()) {
|
||||||
addField(stream, serial, i, inv, t, c, FLD_PAC);
|
for (auto& c : inv->Statistics()->getChannelsByType(t)) {
|
||||||
addField(stream, serial, i, inv, t, c, FLD_UAC);
|
addField(stream, serial, i, inv, t, c, FLD_PAC);
|
||||||
addField(stream, serial, i, inv, t, c, FLD_IAC);
|
addField(stream, serial, i, inv, t, c, FLD_UAC);
|
||||||
if (t == TYPE_AC) {
|
addField(stream, serial, i, inv, t, c, FLD_IAC);
|
||||||
addField(stream, serial, i, inv, t, c, FLD_PDC, "PowerDC");
|
if (t == TYPE_AC) {
|
||||||
} else {
|
addField(stream, serial, i, inv, t, c, FLD_PDC, "PowerDC");
|
||||||
addField(stream, serial, i, inv, t, c, FLD_PDC);
|
} else {
|
||||||
|
addField(stream, serial, i, inv, t, c, FLD_PDC);
|
||||||
|
}
|
||||||
|
addField(stream, serial, i, inv, t, c, FLD_UDC);
|
||||||
|
addField(stream, serial, i, inv, t, c, FLD_IDC);
|
||||||
|
addField(stream, serial, i, inv, t, c, FLD_YD);
|
||||||
|
addField(stream, serial, i, inv, t, c, FLD_YT);
|
||||||
|
addField(stream, serial, i, inv, t, c, FLD_F);
|
||||||
|
addField(stream, serial, i, inv, t, c, FLD_T);
|
||||||
|
addField(stream, serial, i, inv, t, c, FLD_PF);
|
||||||
|
addField(stream, serial, i, inv, t, c, FLD_PRA);
|
||||||
|
addField(stream, serial, i, inv, t, c, FLD_EFF);
|
||||||
|
addField(stream, serial, i, inv, t, c, FLD_IRR);
|
||||||
}
|
}
|
||||||
addField(stream, serial, i, inv, t, c, FLD_UDC);
|
|
||||||
addField(stream, serial, i, inv, t, c, FLD_IDC);
|
|
||||||
addField(stream, serial, i, inv, t, c, FLD_YD);
|
|
||||||
addField(stream, serial, i, inv, t, c, FLD_YT);
|
|
||||||
addField(stream, serial, i, inv, t, c, FLD_F);
|
|
||||||
addField(stream, serial, i, inv, t, c, FLD_T);
|
|
||||||
addField(stream, serial, i, inv, t, c, FLD_PF);
|
|
||||||
addField(stream, serial, i, inv, t, c, FLD_PRA);
|
|
||||||
addField(stream, serial, i, inv, t, c, FLD_EFF);
|
|
||||||
addField(stream, serial, i, inv, t, c, FLD_IRR);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user