Skip to content

feat(fabric-api): Report Looking Glass throttling and limiter health - #1122

Merged
privateip merged 1 commit into
feat/lg-backend-controlsfrom
feat/lg-backend-telemetry
Oct 27, 2026
Merged

privateip merged 1 commit into
feat/lg-backend-controlsfrom
feat/lg-backend-telemetry

Conversation

@privateip

@privateip privateip commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Operators had no way to tell why Looking Glass requests were refused, whether the cell's limiter was healthy, or why a node refused a probe permit.

The gateway and nodes now export metrics with fixed label sets for requests, router outcomes, refusals by caller type and limit, charged packets, limiter state, clock health and permit decisions. The leader logs one line per request with its service, project, request ID and counts, never its target or results.

Four new alerts cover an unavailable limiter, an unsynchronised clock, and mostly throttled or mostly failing requests, on top of #1121.

Note

These rules fire in production only once infra adds runbook entries for the four alerts and its central copy of the rules, which follow this change.

Test plan

  • Lint, build and unit tests pass with the race detector, and the alert rules pass promtool, including idle and disabled cells that must not fire
  • Logs from real requests carry no target or result, and no metric label carries a target, project, request or service ID
  • Each request is counted once, including one the leader refuses after a follower forwarded it

Related to #1047

@privateip

Copy link
Copy Markdown
Contributor Author

Two review passes ran on this PR. In the second pass pr-rereviewer returned merge: all four findings applied after the first pass were confirmed fixed with tamper tests (the leader counts forwarded refusals, a permit's invalid outcome is handled, the body's test plan matches the log fields, and the summary is four sentences). pr-conventions-reviewer returned hold, on warnings that were then fixed rather than waived. Its one decision finding, about not rendering Kustomize output at the head, does not apply: this PR changes no Kustomize files, and task test:alerts (promtool check and test of the rules) passed on a tree containing this PR's rules.

After the second pass the fix commit was squashed into the first, because its 73-character subject broke the subject limit. The PR is now one commit, "feat(fabric-api): Report Looking Glass throttling and limiter health", and its body carries a note that infra's runbook entries and central rules copy follow this change. The tree is byte-identical to the re-reviewed head.

CI on a85ba15 is green: Build, Lint, Unit Tests, Unit Tests (root), E2E Tests, Service API bundle, the image and bundle publish jobs, and the CLA check all passed.

Auto-merge is not enabled. This PR is based on the branch of #1121, so it must merge only after #1121 lands and this PR is retargeted to main. No human reviewer is configured for this repository, so review comes from the code owners.

@privateip
privateip requested a review from a team as a code owner October 26, 2026 21:09
@privateip
privateip added this pull request to stack #1125 October 26, 2026 21:10
ecv
ecv previously approved these changes Oct 26, 2026

@ecv ecv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve.

Reviewed against its base feat/lg-backend-controls, not main: metrics and alerts only, with no change to limiter defaults; CI is green at a85ba15.

  • Metric labels are bounded: operation is a fixed query-type set with Unsupported as the catch-all, reason and outcome are errcode values, scope comes from the limiter's fixed scopes, and class is one of three traffic classes. Project, request, service and node names are never labels.
  • serviceOmitted uses r.OmittedReason directly as a label value. It is bounded only if discovery sets it from a fixed set; worth a quick check (internal/fabric/gateway/metrics.go).
  • The four new alerts gate on minimum request counts (20 and 10 in 30m) and for of 10-15m, so idle or disabled cells do not fire. The gauges exist only where --aggregate-budgets or --probe-permits is on.

Follow-ups:

  • The runbook_url anchors point at docs/runbooks/galactic/README.md in the infra repo (#fabricapilimiterunavailable and three more); confirm those sections exist or land them alongside.
  • FabricAPIClockUnsynchronized ORs two selectors, so a pod label collision between gateway and node series is possible only if they ever share a pod; fine today.

scotwells
scotwells previously approved these changes Oct 26, 2026
Nothing reported why Looking Glass requests were refused, how the cell's aggregate limiter was doing, whether its clock was trusted or why a node refused a probe permit, and no alert covered any of it.

The gateway now exports service requests by operation and reason, router outcomes and omissions, request duration, admission refusals by traffic class (service, operator, fabricquery), limiter scope and reason, charged packets by traffic class, the service switch's state, live streams, limiter state and key counts, and clock health. The node exports permit decisions by outcome (accepted, or invalid, malformed, mismatch, expired, starting, clock, lease, epoch, replayed, full) and its clock health. Labels come from fixed sets: no project, request or service ID, node name or target is a label. A follower counts only the requests it refused itself, and the leader counts the rest, including forwarded requests it refused before executing them, so each request is counted once.

The leader logs one line per request it ran with the service, project, request ID, operation, reason, router counts and duration, never targets, results or node error text; a request refused before its snapshot is logged at debug level. A test runs requests and throttling and checks the registry and the logs for each.

The fabric-api rule group gains FabricAPILimiterUnavailable (no ready limiter in a cell for 10 minutes), FabricAPIClockUnsynchronized, FabricAPIServiceThrottled (most of at least 20 requests in 30 minutes refused by a budget, queue or the limiter) and FabricAPIServiceExecutionFailing (most of at least 10 executed requests returned no router result), each unit-tested with promtool, including idle and disabled cells that must not fire.

Related to #1047
@privateip
privateip dismissed stale reviews from scotwells and ecv via 199ff59 October 27, 2026 02:02
@privateip
privateip force-pushed the feat/lg-backend-telemetry branch from a85ba15 to 199ff59 Compare October 27, 2026 02:02
@privateip
privateip requested review from ecv and scotwells October 27, 2026 02:13

@ecv ecv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve.

The PR's own patch at 199ff59 is identical to the one I approved at a85ba15 (diffed bcb5c24..a85ba15 against eb31cc8..199ff59; only a hunk offset in rules-test.yaml differs), so the gateway.go and rules changes are rebase noise, not new content.

  • Prior item 1 is fine: serviceOmitted labels with r.OmittedReason, which is only ever set from the fixed Omit* constants in discovery.go (or empty, which is filtered by !r.Selected), so cardinality is bounded.
  • Prior item 2 is still open: none of the four runbook_url anchors (#fabricapilimiterunavailable, #fabricapiclockunsynchronized, #fabricapiservicethrottled, #fabricapiserviceexecutionfailing) exist in infra docs/runbooks/galactic/README.md on main.

Follow-ups:

  • Add the four runbook sections to infra docs/runbooks/galactic/README.md, or point the annotations somewhere that exists, so paged alerts do not link to a dead anchor.

@privateip
privateip merged commit e803cd6 into main Oct 27, 2026
28 of 29 checks passed
@privateip
privateip deleted the feat/lg-backend-telemetry branch October 27, 2026 12:12
@privateip privateip mentioned this pull request Oct 29, 2026
7 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants