Skip to content

feat(metadata): add renew and GC policy for app-level metadata#3371

Open
eye-gu wants to merge 5 commits into
apache:developfrom
eye-gu:feat-3355-metadata-renew-and-gc
Open

feat(metadata): add renew and GC policy for app-level metadata#3371
eye-gu wants to merge 5 commits into
apache:developfrom
eye-gu:feat-3355-metadata-renew-and-gc

Conversation

@eye-gu
Copy link
Copy Markdown
Contributor

@eye-gu eye-gu commented Jun 5, 2026

Description

Fixes #3355

Checklist

  • I confirm the target branch is develop
  • Code has passed local testing
  • I have added tests that prove my fix is effective or that my feature works

Comment thread registry/servicediscovery/service_discovery_registry.go Fixed
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 5, 2026

Codecov Report

❌ Patch coverage is 62.22222% with 85 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.77%. Comparing base (60d1c2a) to head (28773a8).
⚠️ Report is 816 commits behind head on develop.

Files with missing lines Patch % Lines
...try/servicediscovery/service_discovery_registry.go 58.76% 28 Missing and 12 partials ⚠️
metadata/report/zookeeper/report.go 62.85% 12 Missing and 1 partial ⚠️
metadata/info/metadata_info.go 0.00% 10 Missing ⚠️
metadata/report/nacos/report.go 80.85% 7 Missing and 2 partials ⚠️
metadata/report/etcd/report.go 76.00% 6 Missing ⚠️
metadata/report/report.go 0.00% 5 Missing ⚠️
metadata/report_instance.go 66.66% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3371      +/-   ##
===========================================
+ Coverage    46.76%   52.77%   +6.00%     
===========================================
  Files          295      493     +198     
  Lines        17172    38089   +20917     
===========================================
+ Hits          8031    20101   +12070     
- Misses        8287    16360    +8073     
- Partials       854     1628     +774     

☔ View full report in Codecov by Harness.
📢 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.

Comment thread registry/servicediscovery/service_discovery_registry.go Fixed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a lifecycle policy for application-level metadata in remote metadata centers by introducing (1) a daily “renew” republish and (2) a GC routine to delete stale revisions, along with new MetadataReport APIs to support listing and unpublishing revisions across Nacos/Etcd/Zookeeper.

Changes:

  • Introduces daily app-metadata renew + stale-revision GC in serviceDiscoveryRegistry, gated by URL params.
  • Extends report.MetadataReport with UnPublishAppMetadata and ListAppRevisions, and implements them for Nacos/Etcd/Zookeeper.
  • Adds lastUpdatedTime to app metadata payloads and adds/updates tests for renew/GC and report backends.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
registry/servicediscovery/service_discovery_registry.go Adds daily renew timer and GC logic that deletes stale app-metadata revisions.
registry/servicediscovery/service_discovery_registry_test.go Adds unit tests for GC behavior, renew behavior, timer stop, and delay calculation.
metadata/report/zookeeper/report.go Adds zk client abstraction; implements publish update-on-exists, unpublish, and list revisions.
metadata/report/zookeeper/report_test.go Adds mock-based tests for publish/get/update, unpublish, and list revisions.
metadata/report/report.go Extends the metadata report interface with revision listing + unpublish and adds helper to parse lastUpdatedTime.
metadata/report/nacos/report.go Implements unpublish + list revisions for Nacos metadata configs.
metadata/report/nacos/report_test.go Adds tests for Nacos unpublish and list revisions behaviors.
metadata/report/etcd/report.go Fixes etcd app-metadata key path; adds unpublish + list revisions for etcd.
metadata/report/etcd/report_test.go Reworks etcd metadata-report tests with a lightweight in-memory mock.
metadata/report_instance.go Delegates the new metadata-report methods through DelegateMetadataReport.
metadata/report_instance_test.go Adds delegation tests for the new interface methods.
metadata/mapping/metadata/service_name_mapping_test.go Updates mock metadata report to satisfy the extended interface.
metadata/info/metadata_info.go Adds LastUpdatedTime field to app metadata payload.
common/constant/key.go Adds configuration keys for metadata renew-on-startup and GC settings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread metadata/report/zookeeper/report.go
Comment thread metadata/report/etcd/report.go
Comment thread registry/servicediscovery/service_discovery_registry.go Outdated
Comment thread metadata/report/nacos/report.go Outdated
Comment thread metadata/report/zookeeper/report_test.go
Comment thread registry/servicediscovery/service_discovery_registry.go
Comment thread registry/servicediscovery/service_discovery_registry.go
Comment thread metadata/report/nacos/report.go Outdated
Comment thread registry/servicediscovery/service_discovery_registry.go Outdated
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 6, 2026

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.

[FEATURE] Add cleanup and update policy for application-level metadata / 为应用级 metadata 增加清理和更新策略

6 participants