feat(stellar): wire wraith_metrics into names, splitter, vault, and governance - #171
Merged
truthixify merged 2 commits intoAug 26, 2026
Conversation
…nance Only stealth-sender, stealth-registry, and stealth-batch-sender emitted WraithMetricEvents, so the Grafana dashboard had blank panels for the other four contracts and METRICS.md had no per-contract table for them. Contracts: - wraith-names emits register_count, renew_count, release_count, resolve_hit_count, and resolve_miss_count. register_count fires from register_internal so register, register_on_behalf, bulk_register, and auction claim_name are all covered; bulk_renew emits a single renew_count carrying the batch size. - stealth-splitter emits create_count, beneficiaries_per_split, fund_count, and fund_volume, dimensioned by asset_address. - stealth-vault emits deposit_count, deposit_volume, claim_count, and refund_count, dimensioned by asset_address. - governance emits proposal_count, vote_count, and execution_count, dimensioned by proposal_id (and support for votes). wraith-metrics gains the matching contract_ids, metric_names, and dimension_names constants. Docs and tooling: - METRICS.md gains the four missing per-contract tables plus a symbol table mapping each 9-character wire Symbol back to its canonical metric name. - The indexer now watches all seven contracts, decodes the abbreviated wire symbols, and drives its Prometheus collectors from a declarative metric spec table instead of a hand-written switch. Counters increment by the event value so bulk_renew's batch count aggregates correctly. - grafana-dashboard.json gains 12 panels for the new metrics. - synthetic-stream.js replays a synthetic event stream through the parser and aggregator and fails if any dashboard panel would render blank. - SIZE.md records the optimized wasm delta per contract. Each of the four contracts has integration tests asserting on the emitted WraithMetricEvent topics, value, and dimensions.
Wiring wraith_metrics into wraith-names adds one env.events().publish() to register, resolve, release, and renew. Each emission costs a flat +4,164 instructions and +144 event bytes, which pushes wraith-names::resolve past the +5% per-op PR gate (hit +11.91%, miss +17.67%; register lands at +4.96%). Only those four ops moved — every other benched op is byte-identical to the previous baseline, so this rotation absorbs no unrelated drift. METRICS.md now records the measured per-emission cost so the trade-off is visible before anyone instruments another read path. Note that the PR gate prefers the weekly baseline artifact from develop over this committed file; that artifact still needs a rotation for the gate to pass on this branch.
|
@DSOTec Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Merged. Metrics wired across all four contracts with a snapshot test per emission, and the dashboard panels updated to match. Strong piece of work @DSOTec. |
This was referenced Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
wraith-metricsdefines a v1 metric event schema, but only stealth-sender,stealth-registry, and stealth-batch-sender emit through it. wraith-names,
stealth-splitter, stealth-vault, and the governance PoC emit nothing, so
METRICS.md has no per-contract tables for them and the Grafana dashboard
renders blank panels.
Solution
matching
contract_ids/metric_names/dimension_namesconstants.mapping each 9-character wire Symbol to its canonical metric name.
contracts. The indexer previously could not run at all (
Serveris notexported by @stellar/stellar-sdk v12+) and its switch matched canonical
names against abbreviated wire symbols, so it never matched an event —
both fixed.
synthetic-stream.js, which replays a synthetic event stream throughthe parser/aggregator and fails if any dashboard panel would render blank.
Testing
cargo test --workspace: 289 passed, 0 failed. Each of the four contractshas integration tests asserting on the emitted event's topics, value, and
dimensions.
cargo fmt --all --check: clean.npm run verify:dashboard: all 22 dashboard metrics have samples.wraith_names cannot be built for wasm32 on the pinned soroban-sdk (a
pre-existing failure that reproduces on develop), so its delta is recorded
as unmeasurable rather than guessed.
Note for reviewers — bench gate
Metric emission costs a flat +4,164 instructions, which pushes
wraith-names::resolvepast the +5% per-op gate (hit +11.91%, miss +17.67%;register lands at +4.96%). No other benched op moved. I rotated the committed
bench/baseline.json, but the PR gate prefers the weekly baseline artifactfrom develop — that artifact needs rotating for this to go green. Happy to
drop the two
resolveemissions instead if the read-path cost isn't worth it.Closes #163