Skip to content

perf: add span formatting for membership snapshots - #10248

Merged
ReubenBond merged 1 commit into
mainfrom
reubenbond-span-formattable-snapshots
Jul 6, 2026
Merged

ReubenBond merged 1 commit into
mainfrom
reubenbond-span-formattable-snapshots

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Jul 6, 2026 •

Copy link
Copy Markdown
Member

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/IFormattable for MembershipTableSnapshot, ClusterMembershipSnapshot, MembershipEntry, ClusterMember, and MembershipVersion, while preserving the existing string output. It also tightens SiloAddress formatting so the existing H format is honored through IFormattable and 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

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/IFormattable on ClusterMembershipSnapshot, ClusterMember, MembershipEntry, and MembershipVersion (and span formatting for MembershipTableSnapshot internally).
  • Tightened SiloAddress formatting so IFormattable honors the existing "H" format and span-format failures report charsWritten = 0.
  • Added targeted tests to ensure TryFormat(...) output matches ToString() (including "H" formatting for SiloAddress).
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

@ReubenBond
ReubenBond merged commit c0e58da into main Jul 6, 2026
65 checks passed
@ReubenBond
ReubenBond deleted the reubenbond-span-formattable-snapshots branch July 6, 2026 17:17
This was referenced Jul 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants