Skip to content

metricsreader: move cluster-scoped metrics lifecycle into backend clusters#1105

Open
YangKeao wants to merge 2 commits intopingcap:mainfrom
YangKeao:pr/04-multi-cluster-metrics
Open

metricsreader: move cluster-scoped metrics lifecycle into backend clusters#1105
YangKeao wants to merge 2 commits intopingcap:mainfrom
YangKeao:pr/04-multi-cluster-metrics

Conversation

@YangKeao
Copy link
Member

@YangKeao YangKeao commented Mar 19, 2026

What problem does this PR solve?

Issue Number: close #1099

What is changed and how it works:

Move backend metrics lifecycle to the cluster-scoped runtime introduced by the backend-cluster manager.

This PR changes metrics collection so that:

  • each backend cluster owns its own metrics reader
  • backend metrics election is cluster-scoped
  • metrics queries are dispatched through the manager to the right cluster readers

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Notable changes

  • Has configuration change
  • Has HTTP API interfaces change
  • Has tiproxyctl change
  • Other user behavior changes

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot
Copy link

ti-chi-bot bot commented Mar 19, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot
Copy link

ti-chi-bot bot commented Mar 19, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign djshow832 for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the size/XXL label Mar 19, 2026
@YangKeao YangKeao force-pushed the pr/04-multi-cluster-metrics branch from 7e1eaed to 5d2deeb Compare March 19, 2026 17:33
@YangKeao YangKeao marked this pull request as ready for review March 19, 2026 17:37
@ti-chi-bot ti-chi-bot bot requested a review from bb7133 March 19, 2026 17:37
@codecov-commenter
Copy link

codecov-commenter commented Mar 19, 2026

Codecov Report

❌ Patch coverage is 69.04762% with 156 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@29264bd). Learn more about missing BASE report.

Files with missing lines Patch % Lines
pkg/manager/backendcluster/manager.go 63.26% 72 Missing and 18 partials ⚠️
pkg/manager/backendcluster/metrics_querier.go 65.51% 27 Missing and 3 partials ⚠️
pkg/server/server.go 61.11% 6 Missing and 1 partial ⚠️
pkg/balance/observer/health_check.go 44.44% 4 Missing and 1 partial ⚠️
pkg/proxy/backend/backend_conn_mgr.go 54.54% 4 Missing and 1 partial ⚠️
pkg/balance/router/router.go 55.55% 4 Missing ⚠️
pkg/balance/router/router_static.go 0.00% 4 Missing ⚠️
pkg/manager/namespace/manager.go 20.00% 4 Missing ⚠️
pkg/balance/metricsreader/metrics_reader.go 78.57% 3 Missing ⚠️
pkg/balance/router/group.go 81.25% 3 Missing ⚠️
... and 1 more
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1105   +/-   ##
=======================================
  Coverage        ?   67.20%           
=======================================
  Files           ?      144           
  Lines           ?    15195           
  Branches        ?        0           
=======================================
  Hits            ?    10212           
  Misses          ?     4285           
  Partials        ?      698           
Flag Coverage Δ
unit 67.20% <69.04%> (?)

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@YangKeao
Copy link
Member Author

/test all

@YangKeao YangKeao force-pushed the pr/04-multi-cluster-metrics branch 2 times, most recently from 7bbf843 to 34cee09 Compare March 20, 2026 06:20
@YangKeao
Copy link
Member Author

/test all

@YangKeao YangKeao force-pushed the pr/04-multi-cluster-metrics branch 6 times, most recently from 80b8d60 to c81e4dc Compare March 24, 2026 13:13
@YangKeao YangKeao force-pushed the pr/04-multi-cluster-metrics branch from c81e4dc to 89d650a Compare March 24, 2026 13:52
@YangKeao YangKeao marked this pull request as ready for review March 24, 2026 13:57
@YangKeao YangKeao force-pushed the pr/04-multi-cluster-metrics branch from 89d650a to a8ab422 Compare March 24, 2026 14:08
Introduce the backend cluster manager, cluster-scoped InfoSync runtime, topology aggregation, and single-cluster compatibility hooks.
@YangKeao YangKeao force-pushed the pr/04-multi-cluster-metrics branch from a8ab422 to 7add0f2 Compare March 24, 2026 14:21
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.

Move the metrics reader into cluster-scoped struct.

2 participants