Remove state=average labels, labels are optional, we don't use labels except for info

This commit is contained in:
zzz
2025-04-21 07:57:54 -04:00
parent 53969c55e5
commit 7fe9170519
2 changed files with 7 additions and 5 deletions

View File

@@ -1,3 +1,6 @@
2025-04-xx [0.4]
- Remove state=average labels, labels are optional, we don't use labels except for info
2025-04-15 [0.3] 2025-04-15 [0.3]
- Add timer to add stats that appear after startup - Add timer to add stats that appear after startup
- More stat name fixes so they are valid metrics - More stat name fixes so they are valid metrics

View File

@@ -156,8 +156,7 @@ public class PromManager implements ClientApp {
private static boolean addStat(final Rate rate, long period, String name, String desc) { private static boolean addStat(final Rate rate, long period, String name, String desc) {
boolean rv = false; boolean rv = false;
GaugeWithCallback.Builder gwcb = GaugeWithCallback.builder() GaugeWithCallback.Builder gwcb = GaugeWithCallback.builder()
.help(desc) .help(desc);
.labelNames("state");
// heuristics // heuristics
String nlc = name.toLowerCase(Locale.US); String nlc = name.toLowerCase(Locale.US);
if (nlc.contains("time") || nlc.contains("delay") || nlc.contains("lag") || if (nlc.contains("time") || nlc.contains("delay") || nlc.contains("lag") ||
@@ -165,18 +164,18 @@ public class PromManager implements ClientApp {
// All our stats are in ms // All our stats are in ms
gwcb.unit(Unit.SECONDS) gwcb.unit(Unit.SECONDS)
.callback(callback -> { .callback(callback -> {
callback.call(rate.getAvgOrLifetimeAvg() / 1000, "average"); callback.call(rate.getAvgOrLifetimeAvg() / 1000);
}); });
} else if (nlc.contains("size") || nlc.contains("memory") || } else if (nlc.contains("size") || nlc.contains("memory") ||
nlc.contains("sendrate") || nlc.contains("recvrate") || nlc.contains("sendrate") || nlc.contains("recvrate") ||
nlc.contains("bps") || nlc.contains("bandwidth")) { nlc.contains("bps") || nlc.contains("bandwidth")) {
gwcb.unit(Unit.BYTES) gwcb.unit(Unit.BYTES)
.callback(callback -> { .callback(callback -> {
callback.call(rate.getAvgOrLifetimeAvg(), "average"); callback.call(rate.getAvgOrLifetimeAvg());
}); });
} else { } else {
gwcb.callback(callback -> { gwcb.callback(callback -> {
callback.call(rate.getAvgOrLifetimeAvg(), "average"); callback.call(rate.getAvgOrLifetimeAvg());
}); });
// events // events
// Add a _count unit // Add a _count unit