-
Notifications
You must be signed in to change notification settings - Fork 711
feat: support nats ttl marker #8377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PR Code Suggestions ✨Explore these optional code suggestions:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR implements support for NATS KV TTL markers (issue #8367) by upgrading the async-nats dependency and adding conditional feature support. The changes introduce a new configuration flag v211_support that enables NATS to generate events when key-value entries expire, specifically for 'nodes' and 'clusters' buckets used in cluster management.
The implementation consists of four main changes:
- Configuration: Added
ZO_NATS_V211_SUPPORTenvironment variable (defaults to false) to control the new functionality - Dependency upgrade: Updated async-nats from version 0.39 to 0.42 to access the
limit_markersfield - NATS integration: Modified the bucket creation logic to conditionally set
limit_markerswith the same TTL asmax_agewhen v211_support is enabled - Code cleanup: Removed unused chrono imports from test files
The feature enables OpenObserve to receive expiration events from NATS instead of relying solely on client-side TTL checking. This is particularly valuable for cluster heartbeat monitoring where knowing when node entries expire is crucial for maintaining accurate cluster state. The implementation is backward compatible as it only applies the new functionality when explicitly enabled and only to specific bucket types that already have TTL configured.
Confidence score: 4/5
- This PR is safe to merge with minimal risk as it's gated behind a feature flag
- Score reflects well-structured conditional implementation but minor concern about dependency upgrade impact
- Pay close attention to the NATS configuration logic in
src/infra/src/db/nats.rs
4 files reviewed, no comments
User description
impl #8367
PR Type
Enhancement
Description
Add NATS v2.11 support flag
Set KV marker TTL for nodes/clusters
Upgrade async-nats to 0.42
Minor test cleanup
Diagram Walkthrough
File Walkthrough
config.rs
Introduce NATS v2.11 support configurationsrc/config/src/config.rs
v211_supportboolean config with envZO_NATS_V211_SUPPORT.nats.rs
Add KV marker TTL for nodes/clusterssrc/infra/src/db/nats.rs
bucket.max_agefrom node heartbeat TTL.bucket.limit_markersto TTL whenv211_supportisenabled.
file.rs
Clean up unused test importssrc/config/src/utils/file.rs
Cargo.toml
Upgrade async-nats dependencyCargo.toml
async-natsfrom 0.39 to 0.42.