Repository navigation
perf: add span formatting for membership snapshots - #10248
Merged
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves performance in Orleans membership diagnostics/logging by adding span-based formatting support to membership snapshot-related types, reducing intermediate string allocations while preserving existing string output.
Changes:
- Implemented
ISpanFormattable/IFormattableonClusterMembershipSnapshot,ClusterMember,MembershipEntry, andMembershipVersion(and span formatting forMembershipTableSnapshotinternally). - Tightened
SiloAddressformatting soIFormattablehonors the existing"H"format and span-format failures reportcharsWritten = 0. - Added targeted tests to ensure
TryFormat(...)output matchesToString()(including"H"formatting forSiloAddress).
Show a summary per file
| File | Description |
|---|---|
| test/Orleans.Runtime.Internal.Tests/ClusterMembershipSnapshotTests.cs | Adds TryFormat vs ToString() equivalence tests for cluster membership snapshots and related types. |
| test/Orleans.Core.Tests/Membership/MembershipTableSnapshotTests.cs | Adds TryFormat vs ToString() equivalence tests for membership table snapshots, entries, versions, and SiloAddress "H" format. |
| src/Orleans.Runtime/MembershipService/ClusterMembershipSnapshot.cs | Implements span-based formatting for ClusterMembershipSnapshot. |
| src/Orleans.Runtime/MembershipService/ClusterMember.cs | Implements span-based formatting for ClusterMember. |
| src/Orleans.Core/SystemTargetInterfaces/IMembershipTable.cs | Implements span-based formatting for MembershipEntry. |
| src/Orleans.Core/Runtime/MembershipTableSnapshot.cs | Implements span-based formatting for MembershipTableSnapshot (internal). |
| src/Orleans.Core.Abstractions/Runtime/MembershipVersion.cs | Implements span-based formatting and provider-aware IFormattable formatting for MembershipVersion. |
| src/Orleans.Core.Abstractions/IDs/SiloAddress.cs | Ensures "H" format is honored via IFormattable and failed hash-span appends reset charsWritten to 0. |
| src/api/Orleans.Runtime/Orleans.Runtime.cs | Updates public API baselines for ClusterMember and ClusterMembershipSnapshot to include formatting interfaces. |
| src/api/Orleans.Core/Orleans.Core.cs | Updates public API baseline for MembershipEntry to include formatting interfaces. |
| src/api/Orleans.Core.Abstractions/Orleans.Core.Abstractions.cs | Updates public API baseline for MembershipVersion to include formatting interfaces. |
Copilot's findings
- Files reviewed: 11/11 changed files
- Comments generated: 0
This was referenced Jul 22, 2026
This was referenced Jul 29, 2026
This was referenced Jul 29, 2026
Merged
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Membership snapshots are rendered in diagnostic and logging paths, but the existing formatting relied on string-building and interpolation through nested member values. This adds span-based formatting so callers can format snapshots and their member/version values without unnecessary intermediate strings.
This change implements
ISpanFormattable/IFormattableforMembershipTableSnapshot,ClusterMembershipSnapshot,MembershipEntry,ClusterMember, andMembershipVersion, while preserving the existing string output. It also tightensSiloAddressformatting so the existingHformat is honored throughIFormattableand failed span writes report zero characters written.The public API baselines and targeted coverage were updated to match the new interfaces and verify span formatting remains equivalent to
ToString().Microsoft Reviewers: Open in CodeFlow