CB-632: rename the exported metrics bridged_* -> fleet_*
Part of #145 (CB-632). Doing this NOW, ahead of the rest of the path renames, for one reason: the vms lead is about to wire a monitoring dashboard to these series. Renaming a metric after a dashboard points at it breaks continuity and silently leaves a dead panel. Renaming it before costs nothing, so it goes first rather than at the cutover. Nine series renamed, all declared in FleetMetrics. Two real defects found while doing it: - FleetApp had "bridged_auth_failures_total" written as a LITERAL instead of using FleetMetrics.AUTH_FAILURES -- a second hand-written copy of a name, which is how these drift. It now uses the constant, so there is one source for that name again. - Nothing guarded the prefix. One test does assert a wire name (FleetAppAuthTest checks the real /metrics body for fleet_sessions), which is good, but it covers one series out of nine. The literal above was covered by nothing at all. So this adds MetricNamesTest, which reads the constants reflectively rather than listing them -- a test that lists the nine names is itself a second hand-written copy, and would pass while a tenth went unchecked. It asserts its own denominator too: "no name starts with bridged_" is true of an empty set, so a sweep that found nothing would pass loudly. Asserting the count of 9 makes a broken sweep fail instead. Also renamed three herdr contract-test workspace labels, __bridged_* -> __fleet_*. Those are throwaway workspaces created by ensureWorkspace, not metrics, but they are the same word. Verified: mvn clean install green, 52 classes, 881 tests, 0 failures. Test count is up by 3 -- the new prefix, denominator and uniqueness checks. No bridged_ string remains anywhere outside wiki/.
This commit is contained in:
@@ -13,31 +13,31 @@ import java.util.Map;
|
||||
*
|
||||
* <p>The set is deliberately small: each series maps to a failure mode this project has actually
|
||||
* hit, not to whatever was easy to count. The two worth watching in practice are
|
||||
* {@code bridged_sends_total{outcome="completion_fallback"}} — a rising share means turn detection
|
||||
* {@code fleet_sends_total{outcome="completion_fallback"}} — a rising share means turn detection
|
||||
* is degrading, the CB-115/116/118 failure family — and
|
||||
* {@code bridged_push_nudges_total{outcome="exhausted"}}, which means the primary stopped draining
|
||||
* {@code fleet_push_nudges_total{outcome="exhausted"}}, which means the primary stopped draining
|
||||
* its inbox and CB-307's active push gave up.
|
||||
*/
|
||||
public final class FleetMetrics {
|
||||
|
||||
/** Counter: delegated sends by terminal outcome. */
|
||||
public static final String SENDS = "bridged_sends_total";
|
||||
public static final String SENDS = "fleet_sends_total";
|
||||
/** Counter: worker replies by the path that carried them (rendezvous vs stranded-to-inbox). */
|
||||
public static final String REPLIES = "bridged_replies_total";
|
||||
public static final String REPLIES = "fleet_replies_total";
|
||||
/** Counter: push-loop nudges to the primary, by outcome. */
|
||||
public static final String PUSH_NUDGES = "bridged_push_nudges_total";
|
||||
public static final String PUSH_NUDGES = "fleet_push_nudges_total";
|
||||
/** Counter: idle-lead heartbeat nudges to the lead, by outcome (CB-551). */
|
||||
public static final String HEARTBEAT_NUDGES = "bridged_lead_heartbeat_nudges_total";
|
||||
public static final String HEARTBEAT_NUDGES = "fleet_lead_heartbeat_nudges_total";
|
||||
/** Counter: spawn attempts by peer kind and outcome. */
|
||||
public static final String SPAWNS = "bridged_spawns_total";
|
||||
public static final String SPAWNS = "fleet_spawns_total";
|
||||
/** Counter: herdr socket calls by method and outcome. */
|
||||
public static final String HERDR_CALLS = "bridged_herdr_calls_total";
|
||||
public static final String HERDR_CALLS = "fleet_herdr_calls_total";
|
||||
/** Counter: rejected requests by reason (CB-501). */
|
||||
public static final String AUTH_FAILURES = "bridged_auth_failures_total";
|
||||
public static final String AUTH_FAILURES = "fleet_auth_failures_total";
|
||||
/** Gauge: session census by lifecycle state. */
|
||||
public static final String SESSIONS = "bridged_sessions";
|
||||
public static final String SESSIONS = "fleet_sessions";
|
||||
/** Gauge: undrained replies held per target. */
|
||||
public static final String INBOX_DEPTH = "bridged_inbox_depth";
|
||||
public static final String INBOX_DEPTH = "fleet_inbox_depth";
|
||||
|
||||
private FleetMetrics() {
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import dev.ltms.fleet.auth.Authz;
|
||||
import dev.ltms.fleet.auth.CallerResolver;
|
||||
import dev.ltms.fleet.auth.Principal;
|
||||
import dev.ltms.fleet.guard.GuardException;
|
||||
import dev.ltms.fleet.metrics.FleetMetrics;
|
||||
import dev.ltms.fleet.metrics.Metrics;
|
||||
import dev.ltms.fleet.herdr.Agent;
|
||||
import dev.ltms.fleet.herdr.HerdrClient;
|
||||
@@ -166,7 +167,7 @@ public final class FleetApp {
|
||||
|
||||
private void countAuthFailure(String reason) {
|
||||
if (metrics != null) {
|
||||
metrics.inc("bridged_auth_failures_total", "reason", reason);
|
||||
metrics.inc(FleetMetrics.AUTH_FAILURES, "reason", reason);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user