Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metrics, balance: add metrics for load balance #556

Merged
merged 2 commits into from
Jun 13, 2024

Conversation

djshow832
Copy link
Collaborator

What problem does this PR solve?

Issue Number: close #555

Problem Summary:
Users may need these metrics for load balance:

  • The reasons for connection migration
  • Cross-zone traffic

What is changed and how it works:

  • Add ConfigGetter to pull configs instead of pushing configs because Potential concurrency bugs in ConfigManager #532
  • BackendObserver decides backend locality by TiProxy labels and backend labels. This is moved from FactorLocation so that both FactorLocation and BackendConnMgr can know backend locality by BackendInst
  • Add cross-az traffic and connection migration metrics

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.

- Add metrics of cross-az traffic and connection migration reasons

@ti-chi-bot ti-chi-bot bot requested review from bb7133 and xhebox June 12, 2024 10:41
@ti-chi-bot ti-chi-bot bot added the size/XXL label Jun 12, 2024
@pingcap pingcap deleted a comment from ti-chi-bot bot Jun 12, 2024
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 74.19355% with 16 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@de4a59b). Learn more about missing BASE report.

Files Patch % Lines
pkg/balance/router/metrics.go 45.45% 4 Missing and 2 partials ⚠️
pkg/balance/router/router.go 0.00% 5 Missing ⚠️
pkg/balance/router/router_static.go 0.00% 2 Missing ⚠️
pkg/balance/factor/factor_location.go 50.00% 0 Missing and 1 partial ⚠️
pkg/balance/policy/simple_policy.go 83.33% 1 Missing ⚠️
pkg/balance/router/router_score.go 85.71% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #556   +/-   ##
=======================================
  Coverage        ?   67.06%           
=======================================
  Files           ?       76           
  Lines           ?     6926           
  Branches        ?        0           
=======================================
  Hits            ?     4645           
  Misses          ?     1940           
  Partials        ?      341           
Flag Coverage Δ
unit 67.06% <74.19%> (?)

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.

Copy link

ti-chi-bot bot commented Jun 13, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: xhebox

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

The pull request process is described here

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 lgtm label Jun 13, 2024
Copy link

ti-chi-bot bot commented Jun 13, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-06-13 01:45:03.106577465 +0000 UTC m=+601857.159889384: ☑️ agreed by xhebox.

@ti-chi-bot ti-chi-bot bot added the approved label Jun 13, 2024
@ti-chi-bot ti-chi-bot bot merged commit de5e73a into pingcap:main Jun 13, 2024
5 checks passed
@djshow832 djshow832 deleted the factor_metrics branch June 28, 2024 07:39
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.

Add metrics of cross-az traffic and connection migration factors
3 participants