Skip to content

*: revert keyspace observability labels#68751

Open
zeminzhou wants to merge 1 commit into
pingcap:release-nextgen-202603from
zeminzhou:revert-68404-cluster-information2
Open

*: revert keyspace observability labels#68751
zeminzhou wants to merge 1 commit into
pingcap:release-nextgen-202603from
zeminzhou:revert-68404-cluster-information2

Conversation

@zeminzhou
Copy link
Copy Markdown
Contributor

@zeminzhou zeminzhou commented May 29, 2026

What problem does this PR solve?

Issue Number: ref #68405

Problem Summary:

This PR reverts #68404 (*: add keyspace observability labels). The keyspace observability feature added config, startup, log, and metrics behavior across NextGen deployments; this PR removes that feature surface and restores the previous behavior on release-nextgen-202603.

What changed and how does it work?

  • Remove keyspace-observability config structures, validation, example config, and resolved values.
  • Remove starter startup handling that resolves activation metadata into metric, slow-log, and statement-log fields.
  • Remove metadata from standby activation requests and the related getter/tests.
  • Stop appending keyspace observability fields to slow query logs and statement summary logs.
  • Restore metrics registration and PD client option handling to the previous keyspace ID/name labeling behavior, and clean up related tests and Bazel metadata.

Check List

Tests

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

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

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

Revert the keyspace observability configuration and labels added by #68404.

@ti-chi-bot ti-chi-bot Bot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels May 29, 2026
@tiprow
Copy link
Copy Markdown

tiprow Bot commented May 29, 2026

Hi @zeminzhou. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

📝 Walkthrough

Walkthrough

This PR removes the keyspace observability feature from TiDB. It deletes the KeyspaceObservability config types, removes activation metadata from standby controller requests, eliminates observability field injections from slow-log and statement-log output, refactors metrics label initialization to occur during PD client creation, and removes associated test cases and build targets across multiple packages.

Changes

Keyspace Observability Feature Removal

Layer / File(s) Summary
Config structure and validation removal
pkg/config/keyspace_observability.go, pkg/config/config.go, pkg/config/BUILD.bazel, pkg/config/config.toml.nextgen.example
KeyspaceObservability and KeyspaceObservabilityValues fields are removed from the Config struct; the entire keyspace_observability.go file is deleted along with its types and validation logic; Config.Valid() no longer validates observability settings; the prometheus_common dependency is removed from the config library.
Startup flow integration removal
cmd/tidb-server/main.go, cmd/tidb-server/main_test.go
The maps import is removed; activationMetadata extraction from the standby controller is removed; the starter-mode conditional invoking prepareKeyspaceObservabilityForStarter is deleted; the helper function that resolved and applied observability values is removed; two tests validating this behavior for TiKV and non-TiKV configurations are removed.
Standby metadata propagation removal
pkg/standby/standby.go, pkg/standby/BUILD.bazel, pkg/standby/standby_test.go
The Metadata field is removed from ActivateRequest so activation requests no longer carry arbitrary key/value data; the LoadKeyspaceController.ActivationMetadata() getter method is removed; the activation-received log statement is simplified to log the entire request object; the go_test target is removed and standby_test.go is deleted, removing tests for metadata parsing and the copy-like behavior of the getter.
Logging field integration removal
pkg/sessionctx/variable/slow_log.go, pkg/sessionctx/variable/tests/session_test.go, pkg/util/stmtsummary/v2/logger.go, pkg/util/stmtsummary/v2/record_test.go, pkg/util/stmtsummary/v2/BUILD.bazel
The slow-log format no longer appends observability fields from global config; the statement-log marshaling is simplified to directly use json.Marshal instead of wrapping with additional fields; config imports are removed; test assertions verifying these extra fields are deleted; config dependency is removed from the test BUILD target.
Metrics registration refactoring
pkg/util/metricsutil/common.go, pkg/util/metricsutil/BUILD.bazel, pkg/util/metricsutil/common_test.go, pkg/store/driver/tikv_driver.go, pkg/store/driver/BUILD.bazel, pkg/store/driver/config_test.go
Constant label initialization is moved into PD client creation using pd.NewClient with opt.WithMetricsLabels; label-manipulation helpers (cloneConstLabels, setKeyspaceIDConstLabel, setConstLabels) are removed; the maps import is dropped; PD client options are inlined directly in OpenWithOptions instead of delegating to a pdClientOptions() helper; metrics/common and pd opt dependencies are removed; test assertions verifying metrics label manipulation are removed; the common_test.go file is deleted; test sharding is adjusted in multiple BUILD files.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • pingcap/tidb#68404: Introduced the keyspace observability feature that this PR removes, including the config types, startup initialization, logging integrations, and metrics label handling.

Suggested labels

size/XL, release-note-none, ok-to-test

Suggested reviewers

  • ChangRui-Ryan
  • yibin87
  • D3Hunter
  • yudongusa

Poem

🐰 A keyspace once observed with care,
Now fades like morning's misty air.
Config fields and metadata gone,
Metrics labels simplified at dawn.
TiDB runs cleaner, sleek and light,
Feature removed—the PR shines bright!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: reverting the keyspace observability labels feature. It is directly related to the changeset.
Description check ✅ Passed The description is comprehensive and follows the template structure. It includes issue reference, problem summary, detailed explanation of changes, appropriate checklist selections, and a release note.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zeminzhou zeminzhou changed the title Revert "*: add keyspace observability labels" *: revert keyspace observability labels May 29, 2026
@ti-chi-bot ti-chi-bot Bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels May 29, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

❌ Patch coverage is 10.52632% with 51 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release-nextgen-202603@f78c7f9). Learn more about missing BASE report.

Additional details and impacted files
@@                     Coverage Diff                     @@
##             release-nextgen-202603     #68751   +/-   ##
===========================================================
  Coverage                          ?   77.0942%           
===========================================================
  Files                             ?       1966           
  Lines                             ?     547832           
  Branches                          ?          0           
===========================================================
  Hits                              ?     422347           
  Misses                            ?     124633           
  Partials                          ?        852           
Flag Coverage Δ
unit 76.1821% <1.7857%> (?)

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

Components Coverage Δ
dumpling 61.5065% <0.0000%> (?)
parser ∅ <0.0000%> (?)
br 60.9898% <0.0000%> (?)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented May 29, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: D3Hunter
Once this PR has been reviewed and has the lgtm label, please assign terry1purcell 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 needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label May 29, 2026
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented May 29, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-05-29 07:28:25.783477095 +0000 UTC m=+4246.158286771: ☑️ agreed by D3Hunter.

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

Labels

needs-1-more-lgtm Indicates a PR needs 1 more LGTM. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants