Conversation
TELEMETRY/COMMAND/DECOM/DECOMCMD streams were bounded only by the log and TSDB microservices trimming them, so disabled logging, a missing TSDB, or a lagging trimmer let Redis grow without limit. Writes now pass an approximate MINID (OPENC3_STREAM_MAX_AGE_SECONDS, default 600s, never less than two log cycles for raw streams) so the streams stay bounded without a trimmer. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3951 +/- ##
=======================================
Coverage 80.08% 80.09%
=======================================
Files 901 901
Lines 68356 68450 +94
Branches 2645 2698 +53
=======================================
+ Hits 54743 54823 +80
- Misses 12946 12969 +23
+ Partials 667 658 -9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What
Every write to the high-rate target streams (
TELEMETRY__,COMMAND__,DECOM__,DECOMCMD__) now passes an approximateXADD ... MINID ~ <cutoff>, so Redis/Valkey never keeps entries older than a configurable max age.OPENC3_STREAM_MAX_AGE_SECONDS: default600. Set it to0or empty to disable. Documented inconfiguration/environment.md.TELEMETRY__/COMMAND__, the max age is never less than2 × (log cycle time + LogWriter::CLEANUP_DELAY), which is 1320 s with the default 600 s cycle. The reason: historical streaming reads data that isn't in the bucket yet (the current log file) from the stream. The per-targettlm_log_cycle_time/cmd_log_cycle_timeis read fromTargetModelonce and cached per process.DECOM__/DECOMCMD__use the plain max age. Historical DECOM data comes from TSDB, and TSDB normally keeps 60 s of these streams.*. Decom reuses the raw packet's id, so an entry written by a decom that's running behind is never trimmed by its own add.write_topicin Ruby and Python (store +Topic) takes an optionalminid:keyword. Existing callers are unaffected.Topic,LogWriter, andTsdbMicroservice.Why
Until now these streams were bounded only by their consumers trimming them: the log microservice after it uploads a file, and the TSDB microservice. If logging is disabled (
PacketLogWriter#writereturns early, so no trim offsets are ever queued), TSDB isn't deployed, or a trimmer falls behind, the streams grow without bound until Redis runs out of memory. This cap bounds memory even when no trimmer is running, and it sits well above normal retention so it doesn't change behavior on a healthy system.Tradeoff: a consumer that falls further behind than the cap loses the trimmed entries. That's the intended failure mode, better than taking down Redis. Warning the user when this happens belongs in a separate PR about lag and data-loss alerting.
Testing
spec/topics/topic_spec.rbandtest/topics/test_topic.py: minid math (now-relative, id-relative, min age, disabled), log cycle lookup and caching,write_topicpassingMINIDthrough to XADD (fakeredis confirms old entries are actually trimmed), andTelemetryTopicqueued and unqueued writes.minidargument.bundle exec rspec spec/topics spec/microservices spec/logs spec/api spec/utilities/store*: 643 examples, 1 failure. The failure isdecom_microservice_spec.rb:58, an order-dependent limits-set test that passes on its own and also fails onmain.uv run pytest: 3040 passed.uv run ruff check openc3: clean.🤖 Generated with Claude Code