feat: add received_time to inject_tlm - #3720
Conversation
Adds an optional received_time parameter to Python inject_tlm so scripts can inject historical telemetry while still using the normal COSMOS packet path instead of modifying TSDB data directly. received_time is represented as nanoseconds since the Unix epoch, matching COSMOS's existing packet timestamp serialization. When omitted, behavior is unchanged and the receive time is still set to the current UTC time. Implementation: - thread received_time through the public inject_tlm API - forward it through InterfaceTopic and DecomInterfaceTopic - convert nanoseconds back to a UTC datetime in handle_inject_tlm - expose the option through the Python Script Runner wrapper - preserve 0 as a valid Unix-epoch timestamp - add regression coverage for both routing paths, conversion, epoch zero, and Script Runner forwarding Compatibility: Existing callers remain unchanged because the new argument is optional and appended after scope. The Script Runner wrapper only forwards the new keyword when explicitly supplied. Closes OpenC3#3521
|
Hello @suhaslord, thanks for your contribution! These changes look good, but we also need the corresponding ruby code updated to have parity with this. Please update the ruby code, or if you want, I can push a commit to your branch or send you a patch file. Just let me know. The relevant files are listed here:
Once addressed, I'll approve the workflow runs and make sure we get two OpenC3 staff reviews on this. |
|
Hi Ryan,
Thanks for the review. I’ve now added Ruby parity across all five files you
listed.
The Ruby path now matches the Python behavior end-to-end: received_time is
optional on the public API and Script Runner wrapper, both topic paths
forward it only when supplied, and the decom handler converts nanoseconds
with Time.from_nsec_from_epoch while preserving 0 as a valid Unix-epoch
timestamp. Existing calls still use the normal current receive time when
the keyword is omitted.
I also added focused Ruby regression coverage for a historical timestamp
and epoch zero, and checked the final API diff to make sure the change is
scoped only to inject_tlm.
The new workflow runs are showing action_required, so they should be ready
for the maintainer-side approval you mentioned.
Thanks again,
Suhas
On Mon, 17 Aug 2026 15:40:01 -0700, Ryan Pratt ***@***.*** wrote:
ryan-pratt left a comment (OpenC3/cosmos#3720)
<#3720 (comment)>
Hello @suhaslord <https://github.com/suhaslord>, thanks for your
contribution!
These changes look good, but we also need the corresponding ruby code
updated to have parity with this. Please update the ruby code, or if you
want, I can push a commit to your branch or send you a patch file. Just let
me know. The relevant files are listed here:
-
openc3/lib/openc3/api/tlm_api.rb
-
openc3/lib/openc3/microservices/interface_decom_common.rb
-
openc3/lib/openc3/script/telemetry.rb
-
openc3/lib/openc3/topics/decom_interface_topic.rb
-
openc3/lib/openc3/topics/interface_topic.rb
Once addressed, I’ll approve the workflow runs and make sure we get two
OpenC3 staff reviews on this.
—
Reply to this email directly, view it on GitHub
<#3720?email_source=notifications&email_token=BBJPPMVKUC6YJ3GCN3PP6H35KOCUDA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMZSGEYDONJYGMZKM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-5321075832>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BBJPPMRSXH5ZQLXQYNLV4R35KOCUDAVCNFSNUABFKJSXA33TNF2G64TZHM2TCMRYG4ZTQOBRHNEXG43VMU5TKMJWGU4TAMZSHE42C5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/BBJPPMSV7Y5M2NXS5J2XPQ35KOCUDA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMZSGEYDONJYGMZKM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/BBJPPMUFQUVMLNNBNXMEWU35KOCUDA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMZSGEYDONJYGMZKM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you were mentioned.
|
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3720 +/- ##
==========================================
+ Coverage 79.30% 79.33% +0.03%
==========================================
Files 885 885
Lines 65365 65383 +18
Branches 2543 2591 +48
==========================================
+ Hits 51838 51872 +34
+ Misses 12859 12847 -12
+ Partials 668 664 -4
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:
|



Adds an optional received_time parameter to Python inject_tlm so scripts can inject historical telemetry while still using the normal COSMOS packet path instead of modifying TSDB data directly.
received_time is represented as nanoseconds since the Unix epoch, matching COSMOS's existing packet timestamp serialization. When omitted, behavior is unchanged and the receive time is still set to the current UTC time.
Implementation:
Compatibility:
Existing callers remain unchanged because the new argument is optional and appended after scope. The Script Runner wrapper only forwards the new keyword when explicitly supplied.
Closes #3521