Add two Topic Reader state gauges - #734
Open
KirillKurdyukov wants to merge 9 commits into
Open
KirillKurdyukov wants to merge 9 commits into
KirillKurdyukov wants to merge 9 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #734 +/- ##
============================================
+ Coverage 74.70% 75.07% +0.36%
- Complexity 3669 3689 +20
============================================
Files 394 394
Lines 16633 16639 +6
Branches 1757 1755 -2
============================================
+ Hits 12426 12491 +65
+ Misses 3593 3533 -60
- Partials 614 615 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
KirillKurdyukov
force-pushed
the
codex/topic-reader-state-gauges
branch
from
October 1, 2026 13:46
e909180 to
cb1e0bb
Compare
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.
Summary
Add two Topic Reader observable gauges, using the closeable API merged in #735:
ydb.topic.reader.partition_session.count, unit{session}.ydb.topic.reader.credit_balance_bytes, unitBy.After successful stream initialization,
ReaderMetrics.registerStream(stream)registers callbacks reading that concrete stream. Each replacement closes both
previous registrations. Retry/end unregister the matching stream; Reader close
removes registrations permanently.
Registration takes a nonnull stream. A private
closeGauges()performs shared cleanup;there is no
registerStream(null)command. Finalclose()also rejects future registrations.No changes to TopicRetryableStream and no metric getters in ReaderImpl.
ReaderMetrics owns two registration fields, without a composite lambda or handles
on ReadSession. No additional accounting maps/counters or reading/retry changes.
Names, units and descriptions match the C# SDK. The two existing received-counter
descriptions are also aligned. Common attributes remain
consumerandreader.name.No Core, table/query pool or public settings changes.
Validation
Java21 clean package passed46 tests, no failures/errors/skips:
All Reader metric tests are in
ReaderMetricsTest: the existing counter case,one gauge happy-path case, and a stale-source/closed-owner regression, with a shared Meter.
After extracting cleanup, all three ReaderMetricsTest cases and the SDK/real OTel
smoke were rerun successfully, including late init and concurrent shutdown.
Public TopicClient/SyncReader smoke with a real OpenTelemetry collector:
after releasing/joining both workers, the real collector has no gauge observations.
LSP diagnostics and javac/checkstyle/package checks pass. Expected deprecated-API
warnings from compatibility tests remain.
Database-backed integration tests were not run locally: the Docker daemon is unreachable.
The SDK smoke uses fake network streams and the real native OpenTelemetry backend.
Lifecycle tradeoffs
their close calls; no lock is added to message processing, counters or Reader state.
Lifecycle callers can wait for a concurrent registration/backend operation.
a future federated reader must not share this single slot across concurrent streams.
The existing ReadSession closed flag and a terminal metrics flag reject late init.
Actual unregister requires a backend implementing closeable registrations;
legacy Meter's default NOOP registration remains the existing compatibility limitation.
Tracker: https://st.yandex-team.ru/YDBAPPTEAM-2094.