Skip to content

Feature/topic reader metrics - #932

Open
NastyaKa wants to merge 12 commits into
ydb-platform:mainfrom
NastyaKa:feature/topic-reader-metrics
Open

NastyaKa wants to merge 12 commits into
ydb-platform:mainfrom
NastyaKa:feature/topic-reader-metrics

Conversation

@NastyaKa

Copy link
Copy Markdown

Pull request type

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

The Python SDK does not provide metrics for topic readers.

What is the new behavior?

Added the following topic reader metrics:

  • ydb.topic.reader.received.messages
  • ydb.topic.reader.received.bytes
  • ydb.topic.reader.delivered.messages
  • ydb.topic.reader.local_buffer.messages
  • ydb.topic.reader.local_buffer.message_age.max
  • ydb.topic.reader.partition_session.count

Metrics are collected for readers with an explicitly configured reader_name.

Other information

Added unit tests, documentation, and an OpenTelemetry example.

@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.45129% with 43 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.10%. Comparing base (012fdf6) to head (648c846).

Files with missing lines Patch % Lines
ydb/observability/metrics.py 89.13% 15 Missing and 19 partials ⚠️
ydb/_topic_reader/topic_reader_asyncio.py 95.78% 6 Missing and 1 partial ⚠️
ydb/_topic_reader/topic_reader_sync.py 60.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #932      +/-   ##
==========================================
+ Coverage   84.84%   85.10%   +0.25%     
==========================================
  Files         102      102              
  Lines       14267    14704     +437     
  Branches     1509     1581      +72     
==========================================
+ Hits        12105    12514     +409     
- Misses       1718     1729      +11     
- Partials      444      461      +17     
Flag Coverage Δ
integration 80.06% <81.90%> (+0.05%) ⬆️
unit 58.89% <51.09%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
ydb/_grpc/grpcwrapper/ydb_topic.py 88.21% <100.00%> (+0.03%) ⬆️
ydb/_topic_reader/datatypes.py 96.89% <100.00%> (+1.35%) ⬆️
ydb/_topic_reader/topic_reader.py 91.46% <100.00%> (+0.43%) ⬆️
ydb/opentelemetry/metrics_plugin.py 96.15% <100.00%> (+0.15%) ⬆️
ydb/topic.py 89.10% <ø> (ø)
ydb/_topic_reader/topic_reader_sync.py 73.17% <60.00%> (+1.01%) ⬆️
ydb/_topic_reader/topic_reader_asyncio.py 89.89% <95.78%> (+2.35%) ⬆️
ydb/observability/metrics.py 93.26% <89.13%> (-3.14%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@NastyaKa
NastyaKa marked this pull request as draft October 30, 2026 14:16

@vgvoleg vgvoleg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Замечание к накладным расходам при выключенных метриках.

@vgvoleg vgvoleg added the SLO label Dec 3, 2026
@NastyaKa
NastyaKa marked this pull request as ready for review December 3, 2026 09:41
@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown

🌋 SLO Test Results

🔴 6 workload(s) tested — 1 workload(s) exceeded failure thresholds

Commit: c93f8a0 · View run

Workload Thresholds Duration Report
async-query 🔴 Failure 10m 3s 📄 Report
sync-topic 🟢 OK 10m 7s 📄 Report
sync-topic-multiwriter 🟢 OK 10m 7s 📄 Report
async-topic 🟢 OK 10m 2s 📄 Report
sync-query 🟢 OK 10m 10s 📄 Report
sync-table 🟢 OK 10m 3s 📄 Report

Threshold violations:

async-query:

  • write_retry_attempts: ▲ 75.0% (≥ 50% fail)

Generated by ydb-slo-action

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants