Repository navigation
Conversation
…imental SER012 IServer.ClusterSlotStatsBySlotRange(Async) and ClusterSlotStatsOrderBy(Async), modelled on the CLUSTER SLOTS file layout and the HOTKEYS field handling: node-local read, lenient nominal parsing, config-gated metrics as nullable properties (absent != zero), unknown metrics preserved as Metadata, cpu-usec surfaced as TimeSpan. RedisFeatures.ClusterSlotStats gates on 8.2 RC1. Promotes the CommandCoverage 'deferred' row.
This branch has not been deployed
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.
Adds first-class support for
CLUSTER SLOT-STATS(Redis 8.2): per-slot usage statistics, so callers can see which slots carry a cluster's load. Promotes thedeferredrow in CommandCoverage ("pairs with hot-key tooling" — the hot-key tooling has since shipped).API (all experimental,
SER012)ClusterSlotStatsEntrycarriesSlot,KeyCount(always collected), andCpuTime(TimeSpan?, fromcpu-usec),MemoryBytes,NetworkBytesIn/Outas nullable values: the server only reports whatcluster-slot-stats-enabledcollects, and "not collected" is deliberately distinct from a collected zero. Metrics the library doesn't recognize are preserved inMetadata(the metric set is documented as extensible, and has grown before).Design grounding
CLUSTER SLOTS(ClusterSlots.cssiblings) — partial-interface file per feature,Message.Create(-1, flags.WithCategory(NodeLocalRead), RedisCommand.CLUSTER, ...), lenient aggregate parsing,nullfor nil.HOTKEYS— internal[AsciiHash]field enum with generatedTryParse, nominal (never positional) parsing, microsecond counters surfaced asTimeSpan,limit = 0meaning "server default" asHotKeysStart(count = 0)does.LIMITsent only whenlimit > 0,ASConly when ascending — the server defaults are expressed by omission.RedisFeatures.ClusterSlotStatsgates on the existingv8_2_0_rc1constant. Pre-8.2 answersERR Unknown subcommand.SER012is a feature-specific experiment id (SER011 is Server 8.12 on the open Set-member expiration (Redis 8.12): SADDEX / SEXPIRE / SPTTL / SPERSIST on IDatabase #3340; keeping them separate avoids coupling the PRs).Plan with observed server facts (verified against
src/cluster_slot_stats.cand a live cluster):notes/cluster-slot-stats/plan.md.Tests
RoundTripUnitTests/ClusterSlotStatsRoundTrip.cs, 10/10): exact request bytes for both forms including LIMIT/ASC minimality; the full metric map parsed identically from RESP2 flat pairs and a RESP3 map; key-count-only replies leave the gated metricsnull; an unknown metric lands inMetadata; empty array and nil replies; argument validation.ClusterSlotStatsTests.cs, 12/12 against the repo cluster topology, per protocol, zero skips): a routed write is counted in its slot by the owning node; whole-range answers stay shard-local and ascending; ORDERBY honours LIMIT and both orders;CONFIG SET cluster-slot-stats-enabled "cpu net"surfacesCpuTime/NetworkBytes*at runtime (withMemoryBytesstill null, config restored infinally); ORDERBY on the disabledmemmetric gets the server's ORDERBY refusal; the standalone node answers "cluster support disabled".Full solution build clean (
/p:CI=true, 0 warnings) across net461/net472/netstandard2.0/net8.0/net10.0;eng/public-api.py --checkpasses.Note: RS0016 does not fire in my local environment, so the
PublicAPI.Unshipped.txtentries are hand-written against the shipped[SER009]/ #3340[SER011]precedents and sorted witheng/public-api.py— worth a glance.