Skip to content

Ub transport test for ci #3

Open
zchuango wants to merge 25 commits into
mainfrom
ub_transport_test
Open

Ub transport test for ci #3
zchuango wants to merge 25 commits into
mainfrom
ub_transport_test

Conversation

@zchuango

@zchuango zchuango commented Apr 5, 2026

Copy link
Copy Markdown
Owner

Description

Module

  • Transfer Engine (mooncake-transfer-engine)
  • Mooncake Store (mooncake-store)
  • Mooncake EP (mooncake-ep)
  • Integration (mooncake-integration)
  • P2P Store (mooncake-p2p-store)
  • Python Wheel (mooncake-wheel)
  • PyTorch Backend (mooncake-pg)
  • Mooncake RL (mooncake-rl)
  • CI/CD
  • Docs
  • Other

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Breaking change
  • Documentation update
  • Other

How Has This Been Tested?

Checklist

  • I have performed a self-review of my own code.
  • I have formatted my own code using ./scripts/code_format.sh before submitting.
  • I have updated the documentation.
  • I have added tests to prove my changes are effective.

@zchuango
zchuango force-pushed the ub_transport_test branch 3 times, most recently from 5f13769 to 841d92c Compare April 10, 2026 03:17
@zchuango
zchuango force-pushed the ub_transport_test branch from 841d92c to 70cf348 Compare May 26, 2026 06:14
@github-actions github-actions Bot added the store label May 26, 2026
@zchuango
zchuango force-pushed the ub_transport_test branch from 5c32729 to 7a198b8 Compare May 26, 2026 09:29
@zchuango
zchuango force-pushed the ub_transport_test branch from cf369d2 to 154df78 Compare May 30, 2026 02:07
liangxu2000 pushed a commit to liangxu2000/Mooncake that referenced this pull request Jul 24, 2026
kvcache-ai#3029)

* [TENT] Add transport labels to metrics for per-transport observability

Switch all 16 TENT metrics from static to dynamic yalantinglibs types to
add a `transport` label (and `from`/`to` on the failover counter), so
operators can slice read/write bytes, requests, failures, latency, and
failover paths by transport without grepping logs.

Cardinality control: label values come exclusively from the TransportType
enum closed set (11 values) via a pre-built lookup table indexed by enum.
No arbitrary strings are accepted — the closed set is enforced at the type
level. Total series upper bound ~1500, fully bounded.

Changes:
- 7 counters + 8 histograms → basic_dynamic_counter/histogram<int64_t, 1>
  with label "transport"; failover counter → <int64_t, 2> with "from"/"to"
- counters_ vector widened to metric_t* base pointers (N varies 1 vs 2)
- All record methods take TransportType; 10 call sites in
  transfer_engine_impl.cpp migrated (9 in recordTaskCompletionMetrics +
  1 failover)
- Macros and ScopedLatencyRecorder updated with transport parameter
- getSummaryString()/getJsonMetrics() sum across labels for flat totals;
  per-transport breakdown available only via Prometheus /metrics
- Label values aligned with TransportSelector::transportTypeName()

Workaround: ylt basic_dynamic_histogram::serialize() calls str.clear()
when all label combos have sum=0, wiping previously serialized content.
Each metric is serialized into a temp buffer then appended to avoid this.
ylt upstream is not modified.

Also fixes pre-existing bug: shutdown() did not reset bound_http_port_,
so httpPort() returned a stale port after a shutdown+reinitialize cycle.

Verified: full build (USE_TENT=ON, TENT_METRICS_ENABLED=ON) clean;
metrics_config_loader_test 25/25, tent_metrics_http_server_test 1/1,
tent_metrics_recording_test 10/10; label landing confirmed via real
TransferEngine path with {transport="tcp"} in Prometheus output.

Signed-off-by: staryxchen <staryxchen@tencent.com>

* docs(tent/metrics): document transport labels and per-transport queries

Add Labels column to the Available Metrics table, a new Labels subsection
explaining the TransportType closed-set scheme (11 values, from/to on
failover, cardinality bounds), and update the Prometheus example output
and Grafana queries to show per-transport filtering.

Signed-off-by: staryxchen <staryxchen@tencent.com>

* Address review: fix initialize() regression + add bounds-checked label lookup

1. initialize() regression fix: the rebase inadvertently reverted task#1's
   fix (commit 7dc87d8) that moved validateConfig before compare_exchange.
   The old order (CAS first, validate second, reset on failure) had a race
   window where concurrent callers see initialized_=true and return OK
   against an unconfigured singleton. Restored the correct order: validate
   first, CAS second, no reset needed.

2. Bounds-checked label lookup: added transportLabel(TransportType) helper
   that returns "unknown" if tp is out of range, replacing 9 direct
   kTransportLabelNames[tp] accesses. Defensive guard against memory
   corruption or a new transport type added without updating the table.

Addresses gemini-code-assist review feedback on PR kvcache-ai#3029 (items zchuango#1 high,
zchuango#2 medium). Item zchuango#3 (null check in sumCounterValues) intentionally not
addressed — the pointers are class members, not dynamically allocated.

Signed-off-by: staryxchen <staryxchen@tencent.com>

* Address review: fix docs code examples + add per-transport label test

M1: Update "Recording Transfer Metrics" and "RAII Latency Measurement"
code examples in metrics.md to use the new API signatures with
TransportType parameter. The old examples would not compile.

M2: Add PrometheusLabelsDistinguishTransports test that records with
RDMA and TCP transports, scrapes /metrics, and asserts per-transport
labels appear as separate lines plus from/to labels on the failover
counter.

Addresses general-purpose-6 review feedback on PR kvcache-ai#3029.

Signed-off-by: staryxchen <staryxchen@tencent.com>

* trigger CI with run-ci label

* Fix CI: guard kTransportLabelNames definition with TENT_METRICS_ENABLED

The definition was outside the #if TENT_METRICS_ENABLED block, so
building with TENT_METRICS_ENABLED=0 (the CI default) failed because
the declaration (inside #if in the header) was not visible. Moved the
definition inside the #if block.

Signed-off-by: staryxchen <staryxchen@tencent.com>

---------

Signed-off-by: staryxchen <staryxchen@tencent.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant