Skip to content

Document that SimpleStatsCounter.snapshot() may be - #8745

Merged
copybara-service[bot] merged 1 commit into
masterfrom
test_999520863
Oct 14, 2026
Merged

copybara-service[bot] merged 1 commit into
masterfrom
test_999520863

Conversation

@copybara-service

Copy link
Copy Markdown
Contributor

Document that SimpleStatsCounter.snapshot() may be
inconsistent with concurrent updates.

SimpleStatsCounter is documented as thread-safe, but it updates its counters independently
and without locking, so a snapshot taken during an update can include part of it (for example,
a load-success count without the corresponding load time). That's intentional for performance,
so document it rather than adding synchronization.

Fixes #8741

RELNOTES=n/a

 inconsistent with concurrent updates.

`SimpleStatsCounter` is documented as thread-safe, but it updates its counters independently
and without locking, so a snapshot taken during an update can include part of it (for example,
a load-success count without the corresponding load time). That's intentional for performance,
so document it rather than adding synchronization.

Fixes #8741

RELNOTES=n/a
PiperOrigin-RevId: 999541957
@copybara-service
copybara-service Bot merged commit dea4984 into master Oct 14, 2026
3 checks passed
@copybara-service
copybara-service Bot deleted the test_999520863 branch October 14, 2026 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant