feat(metadata): add renew and GC policy for app-level metadata#3371
feat(metadata): add renew and GC policy for app-level metadata#3371eye-gu wants to merge 5 commits into
Conversation
Codecov Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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.MetadataReportwithUnPublishAppMetadataandListAppRevisions, and implements them for Nacos/Etcd/Zookeeper. - Adds
lastUpdatedTimeto 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.
|



Description
Fixes #3355
Checklist
develop