Fix: TTL query add metadata TTL and PersistentWorker used wrong TTL for metrics cache if the storage is BanyanDB.#13827
Conversation
* Fix: PersistentWorker used wrong TTL for metrics cache if the storage is BanyanDB.
There was a problem hiding this comment.
Pull request overview
This PR enhances TTL reporting and TTL usage in metrics persistence, especially for BanyanDB, and adds E2E coverage to ensure TTL config can be queried and validated across storage backends.
Changes:
- Extend TTL status output to include metadata TTL (alongside minute/hour/day metrics TTLs).
- Introduce a per-metrics-model TTL hook (
StorageTTLStatusQuery#getMetricsTTL(Model)) and use it when creatingMetricsPersistentWorkers (fixing BanyanDB’s effective TTL handling for cache/expiration checks). - Add E2E verification for
/status/config/ttlacross multiple storage cases, with separate expected output for BanyanDB.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/e2e-v2/cases/storage/postgres/e2e.yaml | Add TTL status endpoint verification to Postgres storage E2E. |
| test/e2e-v2/cases/storage/opensearch/e2e.yaml | Add TTL status endpoint verification to OpenSearch storage E2E. |
| test/e2e-v2/cases/storage/mysql/e2e.yaml | Add TTL status endpoint verification to MySQL storage E2E. |
| test/e2e-v2/cases/storage/es/e2e.yaml | Add TTL status endpoint verification to ES storage E2E. |
| test/e2e-v2/cases/storage/es/es-sharding/e2e.yaml | Add additional trace verifications and TTL status endpoint verification for ES sharding case. |
| test/e2e-v2/cases/storage/es/es-sharding/docker-compose.yml | Parameterize Elasticsearch image version with ${ES_VERSION}. |
| test/e2e-v2/cases/storage/banyandb/e2e.yaml | Add TTL status endpoint verification for BanyanDB storage E2E. |
| test/e2e-v2/cases/storage/banyandb/docker-compose.yml | Adjust BanyanDB case env to exercise effective TTL behavior (warm-stage-related). |
| test/e2e-v2/cases/storage/expected/ttl-config.yml | New expected TTL JSON for non-BanyanDB storages (includes metadata TTL). |
| test/e2e-v2/cases/storage/expected/ttl-config-banyandb.yml | New expected TTL JSON for BanyanDB (includes effective TTL values). |
| oap-server/server-storage-plugin/storage-banyandb-plugin/.../BanyanDBTTLStatusQuery.java | Include metadata TTL in TTL definition; add per-model metrics TTL implementation for BanyanDB. |
| oap-server/server-core/.../storage/ttl/MetricsTTL.java | Add metadata field to metrics TTL model. |
| oap-server/server-core/.../storage/ttl/TTLDefinition.java | Include metadata TTL in string output. |
| oap-server/server-core/.../storage/ttl/StorageTTLStatusQuery.java | Add default getMetricsTTL(Model) extension point. |
| oap-server/server-core/.../query/TTLStatusQuery.java | Add getMetricsTTL(Model) that falls back to core TTL when storage doesn’t customize. |
| oap-server/server-core/.../analysis/worker/MetricsStreamProcessor.java | Use TTLStatusQuery#getMetricsTTL(Model) when creating persistent workers; remove direct core TTL injection. |
| oap-server/server-core/.../CoreModuleProvider.java | Stop setting metricsDataTTL directly into MetricsStreamProcessor (now resolved via TTLStatusQuery). |
| docs/en/changes/changes.md | Add changelog entries for metadata TTL reporting and BanyanDB metrics cache TTL fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
This PR enhances TTL visibility and correctness across storage backends by exposing a dedicated metadata TTL in the TTL status API, and by ensuring metrics persistent workers use the effective per-model TTL (not the generic core TTL) when running on BanyanDB.
Changes:
- Extend TTL reporting to include
metrics.metadataand add e2e coverage for/status/config/ttlacross storages (with BanyanDB-specific expectations). - Add a per-metrics-model TTL API (
StorageTTLStatusQuery#getMetricsTTL(Model)), surfaced viaTTLStatusQuery, and wire it intoMetricsStreamProcessorso persistent workers use the effective TTL. - Update BanyanDB TTL status implementation to provide metadata TTL and per-model TTL decisions, plus adjust BanyanDB e2e config to validate warm/cold stage behavior.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/e2e-v2/cases/storage/postgres/e2e.yaml | Add TTL status endpoint verification for Postgres storage e2e. |
| test/e2e-v2/cases/storage/opensearch/e2e.yaml | Add TTL status endpoint verification for OpenSearch storage e2e. |
| test/e2e-v2/cases/storage/mysql/e2e.yaml | Add TTL status endpoint verification for MySQL storage e2e. |
| test/e2e-v2/cases/storage/es/e2e.yaml | Add TTL status endpoint verification for Elasticsearch storage e2e. |
| test/e2e-v2/cases/storage/es/es-sharding/e2e.yaml | Expand ES-sharding e2e coverage and add TTL status verification. |
| test/e2e-v2/cases/storage/es/es-sharding/docker-compose.yml | Parameterize Elasticsearch image version via ${ES_VERSION}. |
| test/e2e-v2/cases/storage/banyandb/e2e.yaml | Add BanyanDB-specific TTL status verification. |
| test/e2e-v2/cases/storage/banyandb/docker-compose.yml | Enable warm/cold stages for BanyanDB minute metrics to validate effective TTL behavior. |
| test/e2e-v2/cases/storage/expected/ttl-config.yml | New expected JSON output for TTL status on non-BanyanDB storages. |
| test/e2e-v2/cases/storage/expected/ttl-config-banyandb.yml | New expected JSON output for TTL status on BanyanDB (includes staged TTL effects). |
| oap-server/server-storage-plugin/storage-banyandb-plugin/.../BanyanDBTTLStatusQuery.java | Add metadata TTL and implement per-model metrics TTL selection for BanyanDB. |
| oap-server/server-core/.../storage/ttl/TTLDefinition.java | Include metrics.metadata in text representation of TTL definitions. |
| oap-server/server-core/.../storage/ttl/StorageTTLStatusQuery.java | Add default per-model metrics TTL API to storage TTL status service. |
| oap-server/server-core/.../storage/ttl/MetricsTTL.java | Extend metrics TTL DTO with a metadata TTL field. |
| oap-server/server-core/.../query/TTLStatusQuery.java | Populate metadata TTL in defaults and expose getMetricsTTL(Model) with fallback behavior. |
| oap-server/server-core/.../analysis/worker/MetricsStreamProcessor.java | Use per-model effective TTL when constructing persistent workers (fixes BanyanDB cache TTL selection). |
| oap-server/server-core/.../CoreModuleProvider.java | Remove now-obsolete wiring of core TTL into MetricsStreamProcessor. |
| docs/en/changes/changes.md | Document the TTL metadata addition and BanyanDB metrics cache TTL fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CHANGESlog.