Skip to content

Conversation

@AstroProfundis
Copy link
Contributor

What problem does this PR solve?

Add support of retention by size for Prometheus. Default value is empty to keep former behavior unchanged. The storage.tsdb.retention.size and storage.tsdb.retention.time can be set together.

If both time and size retention policies are specified, whichever triggers first will be used.

See Prometheus doc for details.

Also close #2058

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
    • Tested with TiDB v8.5.2, which uses Prometheus v2.49.1
  • No code

Code changes

  • Has exported function/method change
  • Has exported variable/fields change
  • Has interface methods change
  • Has persistent data change

Side effects

  • Possible performance regression
  • Increased code complexity
  • Breaking backward compatibility

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

Release notes:

NONE

@ti-chi-bot ti-chi-bot bot requested a review from nexustar October 10, 2025 08:24
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Oct 10, 2025

[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 xhebox 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 contribution size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 10, 2025
func getRetention(retention string) string {
func getRetentionSize(retention string) string {
retention = strings.ToUpper(strings.TrimSpace(retention))
valid, _ := regexp.MatchString("^[1-9]\\d*(B|KB|MB|GB|TB|PB|EB)$", retention)
Copy link
Contributor

Choose a reason for hiding this comment

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

What about KiB etc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Didn't see that in Prometheus doc though...

Copy link
Contributor

Choose a reason for hiding this comment

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

Then this should be fine.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Oct 31, 2025

@dveeden: adding LGTM is restricted to approvers and reviewers in OWNERS files.

Details

In response to this:

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.

@codecov-commenter
Copy link

codecov-commenter commented Nov 18, 2025

Codecov Report

❌ Patch coverage is 44.44444% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 41.46%. Comparing base (2dea252) to head (b2b2026).

Files with missing lines Patch % Lines
pkg/cluster/spec/monitoring.go 44.44% 8 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2612      +/-   ##
==========================================
+ Coverage   41.39%   41.46%   +0.07%     
==========================================
  Files         363      363              
  Lines       37182    37198      +16     
==========================================
+ Hits        15391    15424      +33     
+ Misses      19898    19871      -27     
- Partials     1893     1903      +10     

☔ 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.

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

Labels

contribution size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use storage.tsdb.retention.time instead of storage.tsdb.retention(DEPRECATED)

3 participants