Skip to content

fix(connector): keep CDC LSN metric guards alive - #26301

Merged
zwang28 merged 1 commit into
mainfrom
agent/fix-cdc-lsn-metrics
Jul 17, 2026
Merged

zwang28 merged 1 commit into
mainfrom
agent/fix-cdc-lsn-metrics

Conversation

@hzxa21

@hzxa21 hzxa21 commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

What's changed and what's your intention?

Fixes #26300.

CDC source enumerator monitor metrics were using with_guarded_label_values(...).set(...) inside each on_tick, so the returned guarded metric was dropped immediately and Prometheus could only see the label series briefly around the 30s refresh tick.

This PR stores the guarded gauges on the enumerator so the CDC metric labels stay alive for the source enumerator lifetime, then updates the cached gauges on each tick. It covers:

  • PostgreSQL pg_cdc_upstream_max_lsn
  • PostgreSQL pg_cdc_confirmed_flush_lsn
  • SQL Server upstream min/max LSN gauges
  • MySQL binlog file seq min/max gauges, which had the same guarded-metric anti-pattern in the same monitor path

Checklist

  • I have written necessary rustdoc comments.
  • I have added necessary unit tests and integration tests.
  • My PR contains breaking changes.

Documentation

  • My PR needs documentation updates.

Tests

cargo test -p risingwave_connector cached_guarded_metric_survives_repeated_collections
cargo check -p risingwave_connector

@github-actions github-actions Bot added type/fix Type: Bug fix. Only for pull requests. ci/run-e2e-cdc-source-tests labels Jul 16, 2026
@hzxa21
hzxa21 marked this pull request as ready for review July 16, 2026 07:14
@hzxa21
hzxa21 requested review from wcy-fdu, wenym1 and zwang28 July 16, 2026 07:14
@zwang28
zwang28 enabled auto-merge July 16, 2026 07:38
@zwang28
zwang28 added this pull request to the merge queue Jul 17, 2026
Merged via the queue into main with commit 0ba03b3 Jul 17, 2026
43 of 44 checks passed
@zwang28
zwang28 deleted the agent/fix-cdc-lsn-metrics branch July 17, 2026 03:26
@github-actions

Copy link
Copy Markdown
Contributor

✅ Cherry-pick PRs (or issues if encountered conflicts) have been created successfully to all target branches.

Lazare pushed a commit to Lazare/risingwave that referenced this pull request Jul 21, 2026
…avelabs#26301) (risingwavelabs#26312)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Zhanxiang (Patrick) Huang <hzxa21@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(cdc/metrics): pg CDC LSN gauges invisible to Prometheus between 30s ticks

2 participants