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]
- Add timer to add stats that appear after startup
- 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) {
boolean rv = false;
GaugeWithCallback.Builder gwcb = GaugeWithCallback.builder()
.help(desc)
.labelNames("state");
.help(desc);
// heuristics
String nlc = name.toLowerCase(Locale.US);
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
gwcb.unit(Unit.SECONDS)
.callback(callback -> {
callback.call(rate.getAvgOrLifetimeAvg() / 1000, "average");
callback.call(rate.getAvgOrLifetimeAvg() / 1000);
});
} else if (nlc.contains("size") || nlc.contains("memory") ||
nlc.contains("sendrate") || nlc.contains("recvrate") ||
nlc.contains("bps") || nlc.contains("bandwidth")) {
gwcb.unit(Unit.BYTES)
.callback(callback -> {
callback.call(rate.getAvgOrLifetimeAvg(), "average");
callback.call(rate.getAvgOrLifetimeAvg());
});
} else {
gwcb.callback(callback -> {
callback.call(rate.getAvgOrLifetimeAvg(), "average");
callback.call(rate.getAvgOrLifetimeAvg());
});
// events
// Add a _count unit