mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #4940] [RFC]: [TENT] End-to-end production observability contract #1255
Labels
No labels
ascend
auto-closed
bug
bug
CI/Build
Common
documentation
enhancement
feature request
good first issue
help wanted
high priority
MetaX
nightly-failure
pull-request
PyTorch Backend
question
RFC
Roadmap
stale
Store
Tests
Transfer Engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/Mooncake#1255
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @zxpdemonio on GitHub (Oct 26, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/4940
Changes proposed
Summary
This RFC defines a production-oriented observability contract for TENT across
four connected surfaces:
The complete implementation is staged as 24 linear commits in draft integration
PR #4939, rebased on community
mainatb46254de. Stage 0 is independentlyreviewable in #4938. Later review PRs will be extracted from the integration
stack rather than merging #4939 monolithically.
The operating objective is concrete: during an incident, an operator should be
able to start from an alert or symptom, identify the failing phase and
transport, retrieve a bounded diagnostic snapshot, and pivot from a metric to
the correlated request/attempt logs or retained trace without adding
high-cardinality metric labels.
Status
set pass. The four review-driven follow-up stages also pass their focused
metrics-on and metrics-off build/test matrices.
panels and the alert bundle has 18 rules.
work for the extracted review PRs.
Motivation
TENT already exposed request, byte, latency, attempt, and stage metrics, but an
operator could not reliably answer several basic questions:
failover?
submission, queueing, posting, polling, completion, retry, notification,
cleanup, or shutdown?
Prometheus labels?
RDMA hardware retry exhaustion?
observe a committed-length inconsistency?
Without this contract, incidents require source inspection and ad-hoc logging
before the failing subsystem can be localized.
Goals
and failovers.
admission, staging, and worker paths.
/healthcompatibility while adding/live,/ready, and aversioned
/diagnosticsschema.to deterministic head sampling.
checkable, and expose bounded queue/capacity and suspected-stuck signals.
protocol framing/correlation failures.
TENT_METRICS_ENABLED=OFFvalid and keep tracing disabled by default.Non-goals
IDs, NIC names, or QP numbers in Prometheus labels.
separate compatibility RFC covering negotiation, mixed versions, CPU cost,
and failure semantics.
Public metrics contract
Metrics pipeline self-observability
Stage 0 (#4938) makes the telemetry plane observable:
tent_metrics_build_info;tent_metrics_runtime_enabled;tent_metrics_http_server_up;tent_metrics_http_start_failures_total;tent_metrics_serialization_attempts_total;tent_metrics_serialization_failures_total;tent_metrics_last_success_timestamp_seconds.These families remain visible before transfer traffic and while runtime transfer
recording is disabled. A completely unreachable target must still be detected
with Prometheus
up; an in-process metric cannot report an endpoint that cannotbe scraped.
Logical requests versus physical attempts
Existing read/write request, byte, failure, size, and latency families retain
their logical-request meaning and final-transport attribution. New physical
attempt families record the transport that actually executed each attempt:
tent_transport_attempts_total;tent_transport_attempt_failures_total;tent_transport_attempt_latency_us;tent_transport_failover_total;tent_inflight_attempts.A recovered RDMA-to-TCP request therefore records one successful logical TCP
outcome, one failed RDMA attempt, one successful TCP attempt, and one failover.
The accounting families are deliberately paired:
The equalities are process-local and apply to matching operation/transport
dimensions. They make a lost terminal edge visible instead of inferring it
from legacy success/failure counters. Paired state updates remain active across
runtime sampling changes so a gauge cannot drift when only one half is seen.
Bounded failure model
Terminal failures use a shared phase/reason taxonomy. Phases are limited to:
Reasons are limited to:
Detailed native status text remains in the owning subsystem's existing log path;
it is not copied into metric labels.
Implemented subsystem signals
register/unregister operation, byte, and outcome counters.
deferred-cleanup gauges, cleanup timeouts, and quarantined batches.
software timeout, software retries/retry exhaustion, categorized non-success
WC status (including retry and RNR retry exhaustion), CQ poll errors, and
worker/posted in-flight gauges.
and notification QP transition failures, and bounded notification events.
attempt, retry, timeout, peer-close, terminal outcome, queue wait, and attempt
latency. HP-TCP additionally samples Linux TCP_INFO retransmission deltas,
smoothed RTT, and congestion window, and classifies malformed or inconsistent
protocol frames.
phase/transport/operation counter and one correlated structured warning per
logical request without changing request behavior.
outcome and latency.
remote fetch/cache/reset/invalidation, and generation advance.
unavailability, selection, fallback, exhaustion, and metadata refresh.
and outstanding owner/byte gauges by bounded owner kind.
The complete metric table, labels, units, and cardinality notes are in
docs/source/design/tent/metrics.md.Liveness, readiness, and diagnostics
The endpoints share the existing metrics HTTP server:
/health: retained as200 OKplain-text compatibility and only proves theHTTP event loop is serving;
/live: versioned JSON process liveness and remains200while the endpointcan respond;
/ready: versioned JSON readiness,200only when mandatory checks pass and503otherwise;/diagnostics: the same redacted snapshot, always200so it can be collectedduring an incident.
Readiness reasons are a closed set:
/readyuses only bounded aggregate state and is O(number of transport kinds),so it is safe for frequent probes.
/diagnosticsintentionally retains themore detailed O(number of live tasks) scan and must not be used as the readiness
probe.
The progress-worker stall decision requires both old outstanding work and stale
progress, so a legitimately long request does not make the engine unready while
the worker continues to advance.
Diagnostics schema version 1 contains build identity, engine/control-plane
availability, bounded loaded-transport names, progress-worker state, runtime
queue aggregates, alive batch count, and oldest in-flight age. It omits request
and peer identifiers, segment names, network and memory addresses, keys,
credentials, payloads, and raw pointers.
Provider ownership is explicit: the engine registers and clears its diagnostics
provider with an owner token, and snapshot invocation is protected against
teardown races.
Readiness and in-process metrics cannot report after the process has exited or
crashed. A missing
/live/scrape target is therefore correlated with thesupervisor's exit status, stderr/startup logs, and a core dump or sanitizer
report.
tent_metrics_build_infoidentifies the binary while it is alive; itdoes not replace external crash retention.
Structured logs and correlation
The initial stable events are:
They use process-local monotonic
request_id,batch_id,task_id, andattempt_idvalues, a 128-bittrace_id, bounded transport/operation/phase/reason/status values, duration, failover count where applicable, and
configuration generation.
Raw
BatchIDpointers are never logged as correlation IDs. Tests assert thatstructured events contain neither source addresses nor target offsets.
observability/slow_request_threshold_uscontrols slow-request logs.observability/stuck_request_threshold_uscontrols the first still-pendingthreshold crossing. Both default to zero (disabled). A stuck event is
diagnostic: it neither cancels a request nor proves a deadlock.
Network loss, retransmission, and protocol integrity
The public signals intentionally keep three retry layers separate:
tent_rdma_retries_totalis a TENT software slice re-enqueue;tent_tcp_retransmissions_totalis a delta of LinuxTCP_INFO.tcpi_total_retrans, sampled every 256 completed HP-TCP operationsand once before connection close;
tent_rdma_wc_errors_total{category=~"retry_exceeded|rnr_retry_exceeded"}isthe terminal WC status after the NIC/QP hardware retry budget is exhausted.
Per-packet RDMA retransmission counts are below the verbs completion boundary
and require NIC/vendor telemetry. Classic RPC-backed TCP does not expose its
socket handle at this layer, so host TCP telemetry remains the source for that
transport.
HP-TCP protocol counters distinguish invalid size, magic, version, reserved
fields, opcode, length, and status from response
request_id_mismatchandcommitted_length_mismatch. TCP already provides ordered, checksummed bytedelivery; these counters diagnose framing, mixed-version, correlation, or peer
implementation faults. End-to-end payload checksums are explicitly deferred to
a child RFC because they change the wire/data path and need mixed-version and
performance design, not just observability instrumentation.
Sampled traces and OpenMetrics exemplars
Tracing is backend-neutral in this slice and is emitted as completed structured
span records:
tent.logical_transferroot span per logical request;tent.transport_attemptchild span per physical attempt;observability/trace_sample_rate_ppm(capped at one million);slower than
observability/trace_slow_threshold_us;head_sampled,slow,error,timeout, andlinked_child.Tracing is disabled by default. Retained spans are
INFOlogs, so deploymentsthat enable tracing also set
log_level=info. The implementation does not add atracing dependency and does not change the TENT wire protocol. Cross-process
context propagation is a compatible future extension rather than an implicit
claim of this stage.
/metricsremains Prometheus 0.0.4 compatible. The opt-in/metrics/openmetricsendpoint uses the OpenMetrics 1.0 content type, ends with# EOF, and can attach the latest retained trace ID to the matchingtent_transport_attempt_latency_us+Infbucket. Exemplar publication occursafter the corresponding histogram observation and uses a bounded fixed-size
per-series store.
Cardinality, safety, and compatibility
closed maximum domain.
raw pointers, addresses, target offsets, or peer-provided strings.
/healthbehavior remain compatible.Operations assets
The stack includes:
mooncake-transfer-engine/tent/monitoring/grafana/tent-overview.json: animportable 20-panel dashboard for telemetry health, logical requests,
physical attempts, latency, failover, workers, RDMA, admission, staging,
HP-TCP socket health, protocol errors, and stuck events;
mooncake-transfer-engine/tent/monitoring/prometheus/tent-alerts.yaml: 18starter alerts covering scrape/serialization health, logical and physical
failure rates, worker stalls, staging cleanup, RDMA errors/retry exhaustion,
admission rejection, and selection exhaustion;
docs/source/design/tent/observability-runbook.md: a symptom-first workflowthat connects readiness, bounded metrics, structured logs, traces, and
exemplars.
Alert thresholds are conservative examples and must be tuned to workload SLOs
and traffic floors. The rules assume normal Prometheus
jobandinstancelabels and document the job-selector adjustment point.
Implementation and review plan
Integration stack
Draft PR #4939 contains the complete linear integration history below. It is a
continuously tested reference stack, not the intended merge unit:
aae72ce1,5c969fe1,0c20b102(review fixes; #4938)8da2d4d9,c0fe1f27,8311b35d14b794f9,2a6b2fe5a376597bac700ccf,5c9e77b348d4d6e2,554f5cd1,02d3fb4ab5a0ae2d,32cf582f,c2efeae0b50027e92ead741d28e4b6af6f75ffd51a62c0f4cdfa0ae5c04cda84The commit IDs describe the current integration snapshot based on community
mainatb46254deand ending at0c20b102. They will be refreshed in thisRFC if the Draft integration branch is rebased.
Extracted review slices
The four review-driven follow-up patches complete earlier functional areas and
will be folded into those owner slices rather than submitted as four trailing
fix-up PRs. In particular, Stage 11 is divided between TCP capacity and
readiness, Stage 12 between RDMA and HP-TCP, and Stage 13 between request-state
diagnostics and operational assets.
aae72ce1) plus its review fixes (5c969fe1,0c20b102), already open as #4938 (1bf03834,639ec638,80ee17d1)6f75ffd5)cdfa0ae5)1a62c0f4) and the HP-TCP part of Stage 12 (cdfa0ae5)1a62c0f4)c04cda84)c04cda84)R0 and R1 establish the public metric and accounting foundations. R2 through
R5 then add subsystem instrumentation and may be reviewed in parallel after
their shared foundation is available. R6 follows the transport-state model;
R7 follows the request/attempt lifecycle; R8 follows correlation; and R9 is
last because it consumes the final names and semantics from all preceding
slices.
Each extracted PR will be created from the latest community
main, with onlythe commits or hunks needed for that dependency-complete slice. Cross-cutting
follow-up commits may therefore be split and folded during extraction. After a
predecessor merges, dependent slices will be rebased so already merged commits
are not repeated. The Draft integration PR remains open as the end-to-end
reference and is not intended for monolithic merge.
Review fixes may remain as explicit commits at the integration branch tip so
their validation history stays visible. During extraction they belong to, and
will be folded into, the review slice that owns the affected contract; for
example,
5c969fe1and0c20b102are part of R0 rather than new trailingfeature stages.
Every extracted PR must be independently buildable and reviewable and include:
AI-assistance disclosure in the same PR;
paths;
cardinality where applicable;
git diff --check;documentation tooling is available; and
attempt, posting, polling, or completion paths.
Production-topology performance acceptance and workload-specific alert
threshold tuning remain explicit merge gates for the slices that own those
surfaces; the development-container smoke results below are supporting evidence,
not a replacement for those gates.
Validation evidence
Baseline validation at Stage 9 after rebasing to
b46254de:metrics-enabled full incremental build: 211/211 build steps completed;
metrics-enabled cross-stage regression set: 20/20 passed;
metrics-compiled-out regression set: 4/4 passed;
pre-commit on all files changed from
main: passed;Grafana JSON parse, alert YAML validation, repository links: passed;
paired TCP-loopback submit benchmark, 4096 requests x 100 iterations x three
runs: metrics-enabled median submit/completion deltas approximately
+0.12%/+0.17%versus metrics compiled out in the development container.Review-driven delta validation:
The Stage 0 review fix passed metrics-enabled and metrics-compiled-out focused
builds and tests (2/2 in each configuration), changed-line clang-format, and
git diff --check.Stage 10/11 outcome, readiness, stream-capacity, metrics HTTP, TCP and HP-TCP
focused tests passed.
Stage 12 metrics-on network/protocol tests passed 4/4 and metrics-off tests
passed 2/2.
Stage 13 final-format metrics-on and metrics-off recording tests each passed
1/1; dashboard JSON and alert YAML parsed successfully.
The benchmark result is a smoke measurement, not a production-topology claim.
Extracted review PRs still require topology-specific performance acceptance and
workload-specific alert tuning. Sphinx was not rerun for the final documentation
because it is unavailable in the validation container; Stage 0's earlier Sphinx
build passed. The later delta passed changed-line clang-format,
git diff --check, dashboard JSON parsing, and alert YAML parsing.Relationship to existing work
observability. This RFC does not duplicate per-NIC Prometheus labels or
change selection policy.
supplies the live in-process signals and snapshot that such tooling may
consume; it does not create a competing CLI or archive format.
Review questions
single-transport deployments?
slices, especially the TCP/readiness split for Stage 11 and the
RDMA/HP-TCP split for Stage 12?
low-rate-tracing performance gates?
propagation RFC standardize?
remain delegated to transport/NIC checks until a negotiated wire version is
available?
Before submitting a new issue...
diagnostics, tracing, health, readiness, and multi-rail statistics.
responsibility of this RFC.
AI Assistance Disclosure
OpenAI Codex assisted with implementation, tests, documentation, validation,
and self-review. Each extracted review PR will retain the applicable disclosure
and exact validation evidence.
@zxpdemonio commented on GitHub (Oct 26, 2026):
Implementation progress: draft integration PR #4939 now contains commit
5d1caece, the first Stage 1 patch.This patch adds:
tent_terminal_failures_total{transport,phase,reason}at the canonical terminal task accounting point;tent_memory_operations_total{transport,operation,outcome}around real backend registration calls;tent_memory_operation_bytes_total{transport,operation,outcome}with batched-register byte semantics;The rest of Stage 1 (oldest inflight age, worker progress, staging cleanup and control/metadata RPC signals) remains pending in the ordered commit stack.
@github-actions[bot] commented on GitHub (Oct 26, 2026):
Thanks for opening this issue, @zxpdemonio!
16206312A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide
@zxpdemonio commented on GitHub (Oct 26, 2026):
Stage 1 follow-up commit
81353e8eis now in draft integration PR #4939.It adds worker-owned progress timestamps, staging in-flight task/byte gauges,
deferred cleanup resource gauges and the bounded shutdown-drain timeout
counter. Metrics-enabled and metrics-compiled-out builds both pass the metrics,
progress-worker and proxy-shutdown regression targets.
The oldest-inflight signal remains assigned to the versioned engine snapshot
stage so the metrics hot path does not maintain a second locked registry of
live attempts. Control/metadata RPC signals remain pending.
@zxpdemonio commented on GitHub (Oct 26, 2026):
Stage 1 is now complete on draft integration PR #4939.
The final Stage 1 patch (
86063abe) instruments the canonicalCoroRpcAgent::callCoroutine()attempt loop with bounded physical-attempt metrics:tent_rpc_attempts_total{method,outcome};tent_rpc_retries_total{method};tent_rpc_attempt_latency_us{method,outcome}.An idempotent logical call that retries once records two attempts and one retry. The retry counter advances only when the second attempt is actually issued. Outcomes distinguish connection establishment failures, RPC transport/protocol failures, and successful transport responses. Application-level failures returned inside a successful response remain owned by the calling subsystem's failure metric or log.
The method and outcome domains are closed enums, so peer addresses, endpoint identities, function IDs, and error strings never become metric labels. Metrics-disabled builds compile the attempt path out.
Validation for Stage 1c:
Oldest-inflight age remains assigned to Stage 6, where it can be derived from the engine-owned task snapshot instead of introducing a second hot-path task registry in metrics.
@zxpdemonio commented on GitHub (Oct 26, 2026):
Stage 2a is now available in draft PR #4939 as commit
da8fcd1f([TENT] Add RDMA data-path metrics).This patch adds bounded, physical-slice RDMA diagnostics at the canonical worker owner:
The contract explicitly counts physical slices rather than logical requests and excludes peer IDs, addresses, connection identities and QP numbers from metric labels. Retry counters advance only when another attempt is actually enqueued; terminal exhaustion is a separate signal.
Validation:
Stage 2 remains open for endpoint/QP lifecycle and notification diagnostics.
@zxpdemonio commented on GitHub (Oct 26, 2026):
Stage 2 is complete in draft PR #4939.
Stage 2b is commit
9bb48750([TENT] Add RDMA endpoint metrics) and adds the remaining bounded RDMA lifecycle signals:No endpoint name, peer address, connection identity or QP number is exposed as a Prometheus label. Expected flushes from already-retiring notification QPs are excluded from completion-error counts.
Validation:
The ordered Stage 2 commits are
da8fcd1f(slice/data path) and9bb48750(endpoint/QP/notification).@zxpdemonio commented on GitHub (Oct 26, 2026):
Stage 3 is complete in draft PR #4939 as commit
323d0446([TENT] Add TCP transport diagnostics).The patch adds one bounded stream contract shared by TCP and HP-TCP:
Counting semantics remain explicit: classic TCP queues logical tasks and records every data RPC issued by its retry loop as a physical attempt. HP-TCP queue/attempt metrics describe physical slice operations, while a logical retry is counted only after retry admission succeeds. Peer IDs, addresses, lane IDs and request IDs are not labels.
Validation:
@zxpdemonio commented on GitHub (Oct 26, 2026):
Stage 4 is complete on draft integration PR #4939.
80bd032e) adds bounded SHM relocation/mapping events plus synchronous physical copy outcomes and latency.958d1c1d) adds local segment snapshot/mutation, registry publish/delete, remote descriptor fetch/cache/reset/invalidation, and cache-generation events.The next integration slice is Stage 5: transport selection and admission decisions.
@zxpdemonio commented on GitHub (Oct 26, 2026):
Stage 5 is complete on draft integration PR #4939.
220950b1) records bounded selector decisions: policy miss, candidate empty/unavailable, hint rejection/unavailability, selected/fallback/exhausted, and metadata refresh.05f6f048) records admission owner admit/reject/dispatch/deadline-drop/cancel events, queue wait latency, and paired outstanding owner/byte gauges by owner kind.The next integration slice is Stage 6: liveness, readiness, and the versioned/redacted diagnostics snapshot.
@zxpdemonio commented on GitHub (Oct 26, 2026):
@alogfans The RFC and linked Draft implementation PR #4939 are now complete and ready for design review. The RFC has been updated to match the implemented scope: bounded subsystem metrics, versioned readiness/diagnostics, structured correlation logs, process-local sampled spans with OpenMetrics exemplars, and public dashboard/alert/runbook assets. The full stack is rebased on
b46254deand passes the final metrics-on/off integration checks; production-topology performance acceptance and alert threshold tuning are explicitly left to the extracted review PRs. Could you please review the contract and proposed extraction sequence?@zxpdemonio commented on GitHub (Oct 26, 2026):
@alogfans The RFC and draft integration PR have been updated after the observability gap review. The added design covers lossless request/attempt accounting, O(1) readiness, stream capacity, TCP retransmissions, terminal RDMA hardware retry exhaustion, HP-TCP protocol errors, suspected-stuck requests, and the explicit payload-checksum boundary. Could you please review the RFC and the staged split in #4939?