VPP LB counters, src-ip-sticky, and frontend state aggregation
New feature: per-VIP / per-backend runtime counters
* New GetVPPLBCounters RPC serving an in-process snapshot refreshed
by a 5s scrape loop (internal/vpp/lbstats.go). Each cycle pulls
the LB plugin's four SimpleCounters (next, first, untracked,
no-server) plus the FIB /net/route/to CombinedCounter for every
VIP and every backend host prefix via a single DumpStats call.
* FIB stats-index discovery via ip_route_lookup (internal/vpp/
fibstats.go); per-worker reduction happens in the collector.
* Prometheus collector exports vip_packets_total (kind label),
vip_route_{packets,bytes}_total, and backend_route_{packets,
bytes}_total. Metrics source interface extended with VIPStats /
BackendRouteStats; vpp.Client publishes snapshots via
atomic.Pointer and clears them on disconnect.
* New 'show vpp lb counters' CLI command. The 'show vpp lbstate'
and 'sync vpp lbstate' commands are restructured under 'show
vpp lb {state,counters}' / 'sync vpp lb state' to make room
for the new verb.
New feature: src-ip-sticky frontends
* New frontend YAML key 'src-ip-sticky' (bool). Plumbed through
config.Frontend, desiredVIP, and the lb_add_del_vip_v2 call.
* Reflected in gRPC FrontendInfo.src_ip_sticky and VPPLBVIP.
src_ip_sticky, and shown in 'show vpp lb state' output.
* Scraped back from VPP by parsing 'show lb vips verbose' through
cli_inband — lb_vip_details does not expose the flag. The same
scrape also recovers the LB pool index for each VIP, which the
stats-segment counters are keyed on. This is a documented
temporary workaround until VPP ships an lb_vip_v2_dump.
* src_ip_sticky cannot be mutated on a live VIP, so a flipped flag
triggers a tear-down-and-recreate in reconcileVIP (ASes deleted
with flush, VIP deleted, then re-added). Flip is logged.
New feature: frontend state aggregation and events
* New health.FrontendState (unknown/up/down) and FrontendTransition
types. A frontend is 'up' iff at least one backend has a nonzero
effective weight, 'unknown' iff no backend has real state yet,
and 'down' otherwise.
* Checker tracks per-frontend aggregate state, recomputing after
each backend transition and emitting a frontend-transition Event
on change. Reload drops entries for removed frontends.
* checker.Event gains an optional FrontendTransition pointer;
backend- vs. frontend-transition events are demultiplexed on
that field.
* WatchEvents now sends an initial snapshot of frontend state on
connect (mirroring the existing backend snapshot), subscribes
once to the checker stream, and fans out to backend/frontend
handlers based on the client's filter flags. The proto
FrontendEvent message grows name + transition fields.
* New Checker.FrontendState accessor.
Refactor: pure health helpers
* Moved the priority-failover selector and the (pool idx, active
pool, state, cfg weight) → (vpp weight, flush) mapping out of
internal/vpp/lbsync.go into a new internal/health/weights.go so
the checker can reuse them for frontend-state computation
without importing internal/vpp.
* New functions: health.ActivePoolIndex, BackendEffectiveWeight,
EffectiveWeights, ComputeFrontendState. lbsync.go now calls
these directly; vpp.EffectiveWeights is a thin wrapper over
health.EffectiveWeights retained for the gRPC observability
path. Fully unit-tested in internal/health/weights_test.go.
maglevc polish
* --color default is now mode-aware: on in the interactive shell,
off in one-shot mode so piped output is script-safe. Explicit
--color=true/false still overrides.
* New stripHostMask helper drops /32 and /128 from VIP display;
non-host prefixes pass through unchanged.
* Counter table column order fixed (first before next) and
packets/bytes columns renamed to fib-packets/fib-bytes to
clarify they come from the FIB, not the LB plugin.
Docs
* config-guide: document src-ip-sticky, including the VIP
recreate-on-change caveat.
* user-guide, maglevc.1, maglevd.8: updated command tree, new
counters command, color defaults, and the src-ip-sticky field.
This commit is contained in:
116
docs/maglevc.1
116
docs/maglevc.1
@@ -12,15 +12,21 @@ is an interactive CLI client for
|
||||
.BR maglevd (8).
|
||||
Without arguments it opens a readline shell with tab completion and
|
||||
inline help.
|
||||
A command may also be passed directly on the command line for one\-shot use,
|
||||
which is useful for scripting (use
|
||||
.B \-color=false
|
||||
to suppress ANSI codes).
|
||||
A command may also be passed directly on the command line for one\-shot
|
||||
use, which is useful for scripting; in that mode ANSI color is
|
||||
disabled by default so the output is script\-safe. Pass
|
||||
.B \-color=true
|
||||
explicitly if you want color in one\-shot mode.
|
||||
.PP
|
||||
When the shell starts it prints the build version and connects to the
|
||||
.B maglevd
|
||||
gRPC server specified by
|
||||
.BR \-server .
|
||||
All static tokens support tab completion; dynamic names (frontend,
|
||||
backend, health\-check names) are completed by querying the server.
|
||||
Type
|
||||
.B ?
|
||||
at any point to list completions without advancing the input.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.BI \-server " addr"
|
||||
@@ -31,81 +37,59 @@ gRPC server.
|
||||
.IR localhost:9090 )
|
||||
.TP
|
||||
.BR \-color [=\fIbool\fR]
|
||||
Colorize static field labels in output using ANSI dark blue.
|
||||
(default: true)
|
||||
Pass
|
||||
Colorize static field labels in output using ANSI dark blue. The
|
||||
default is mode\-aware: enabled (true) in the interactive shell, and
|
||||
disabled (false) in one\-shot mode so that output piped into scripts
|
||||
or files stays free of escape codes. Pass
|
||||
.B \-color=true
|
||||
or
|
||||
.B \-color=false
|
||||
to disable, e.g.\& when piping output.
|
||||
.SH COMMANDS
|
||||
Commands are entered at the
|
||||
.B maglevc>
|
||||
prompt or passed as arguments on the command line.
|
||||
All static tokens support tab completion; dynamic names (frontend, backend,
|
||||
health\-check names) are completed by querying the server.
|
||||
Type
|
||||
.B ?
|
||||
at any point to list completions without advancing the input.
|
||||
.SS Show commands
|
||||
.TP
|
||||
.B show version
|
||||
Print build version, commit hash, and build date.
|
||||
.TP
|
||||
.B show frontends
|
||||
List all configured frontends.
|
||||
.TP
|
||||
.BI "show frontend " name
|
||||
Show address, protocol, port, description, and pools (with weights and
|
||||
disabled\-backend notation) for the named frontend.
|
||||
.TP
|
||||
.B show backends
|
||||
List all active backends.
|
||||
.TP
|
||||
.BI "show backend " name
|
||||
Show address, current health state (with duration), enabled flag,
|
||||
health\-check name, and recent state transitions with timestamps.
|
||||
.TP
|
||||
.B show healthchecks
|
||||
List all configured health checks.
|
||||
.TP
|
||||
.BI "show healthcheck " name
|
||||
Show the full configuration of the named health check.
|
||||
.SS Set commands
|
||||
.TP
|
||||
.BI "set backend " "name " pause
|
||||
Pause health checking for a backend, freezing its state.
|
||||
.TP
|
||||
.BI "set backend " "name " resume
|
||||
Resume health checking for a backend; state resets to
|
||||
.BR unknown .
|
||||
.SS Shell commands
|
||||
.TP
|
||||
.BR quit ", " exit
|
||||
Exit the interactive shell.
|
||||
.SH COMPLETION
|
||||
In interactive mode, press
|
||||
.B Tab
|
||||
to complete the current token.
|
||||
If more than one completion is possible, all candidates are listed.
|
||||
Type
|
||||
.B ?
|
||||
anywhere on the line to list candidates at that position without consuming
|
||||
the character or advancing the cursor.
|
||||
explicitly to override the default for either mode.
|
||||
.SH EXAMPLES
|
||||
One\-shot query (no color, suitable for scripts):
|
||||
Open the interactive shell (no command on the command line). Tab
|
||||
completes the current token; typing
|
||||
.B ?
|
||||
lists candidates at the cursor.
|
||||
.B quit
|
||||
or
|
||||
.B exit
|
||||
(or Ctrl\-D) leaves the shell:
|
||||
.PP
|
||||
.RS
|
||||
.EX
|
||||
maglevc \-color=false show backends
|
||||
$ maglevc
|
||||
maglevc> show frontends
|
||||
\&...
|
||||
maglevc> quit
|
||||
.EE
|
||||
.RE
|
||||
.PP
|
||||
Interactive session:
|
||||
One\-shot query passed on the command line (color is off by default
|
||||
in this mode so the output is script\-safe):
|
||||
.PP
|
||||
.RS
|
||||
.EX
|
||||
maglevc \-server 10.0.0.1:9090
|
||||
$ maglevc show frontends
|
||||
.EE
|
||||
.RE
|
||||
.PP
|
||||
Query VPP version and connection status, forcing color on:
|
||||
.PP
|
||||
.RS
|
||||
.EX
|
||||
$ maglevc \-color=true show vpp info
|
||||
.EE
|
||||
.RE
|
||||
.SH "FULL DOCUMENTATION"
|
||||
This manpage documents only the invocation of
|
||||
.BR maglevc .
|
||||
For the complete command reference — every
|
||||
.BR show ", " set ", " sync ", " config ", and " watch
|
||||
command, with examples and operational notes — see the user guide at:
|
||||
.PP
|
||||
.RS
|
||||
https://git.ipng.ch/ipng/vpp-maglev/docs/user-guide.md
|
||||
.RE
|
||||
.SH SEE ALSO
|
||||
.BR maglevd (8)
|
||||
.SH AUTHOR
|
||||
|
||||
Reference in New Issue
Block a user