Skip to content

feat: tell the collector how far to trust the timestamp - #37

Merged
DavidCozens merged 1 commit into
mainfrom
stage/time-quality
Jul 29, 2026
Merged

feat: tell the collector how far to trust the timestamp#37
DavidCozens merged 1 commit into
mainfrom
stage/time-quality

Conversation

@DavidCozens

@DavidCozens DavidCozens commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Pull request

What this stage adds

timeQuality (RFC 5424 section 7.1) joins the record, and meta gains sysUpTime.
Store-and-forward is the next stage, and it breaks the assumption that a record's
timestamp is close to when the collector saw it — so the device says what its clock
is actually worth before that assumption goes.

wire ... BOOT [meta sequenceId="1" sysUpTime="362"][timeQuality tzKnown="1" isSynced="0"] device started

Flash +7,612 B (+292 on the previous stage)
RAM +5,880 B (+24)
Log stack +448 B (unchanged)
Service +672 B (unchanged)

isSynced is 0 and stays 0. This device reads the host clock once at boot and then
free-runs on the FreeRTOS tick: enough to stamp a record, not synchronisation, and
an operator is better served by being told so than by an unqualified timestamp.
RFC 5424 section 7.1.3 forbids syncAccuracy when isSynced is 0, so it is omitted
rather than guessed. tzKnown is 1 — the device works in UTC throughout and knows it.

sysUpTime lands here rather than beside sequenceId because it answers the same
question the clock does: after a reboot the sequence restarts at 1, and an uptime
near zero is what distinguishes that from a counter wrap. Adding it is one more
field on a config struct that already existed, which is the point — an SD-ID grows a
PARAM at a time and nothing downstream notices.

One constraint worth knowing: SolidSyslogFreeRtosSysUpTime_Get is guarded at compile
time, and with a 32-bit TickType_t it rejects any configTICK_RATE_HZ that does not
divide 100. This device runs at 100 Hz and builds; a 1000 Hz device would not, and
the escape is to supply your own SolidSyslogSysUpTimeFunction.

Files

 README.md                     | 11 ++++++-----
 app/syslog/Syslog.c           | 20 ++++++++++++++++++--
 measurements/stages.tsv       |  1 +
 measurements/time-quality.csv | 13 +++++++++++++
 run-report.md                 | 30 +++++++++++++++---------------
 5 files changed, 53 insertions(+), 22 deletions(-)

Checklist

  • The diff is application-only — no change to board bring-up, config headers, or build infra.
  • measurements/time-quality.csv committed.
  • Row added to measurements/stages.tsv.
  • README regenerated: python3 scripts/gen-cost-table.py.
  • ./run.sh green (build + QEMU + baseline self-check) — run-report.md committed.

Context for review: 10 of 21 sequential single-commit PRs replaying the integration on top of the Baseline root. Each lands green and reviewed before the next is built on it, because a change to an early commit would force every commit above it to be re-run and re-measured.

Summary by CodeRabbit

  • New Features

    • Added structured time-quality information to syslog output, including synchronization status and system uptime.
    • Devices now report unsynchronized timestamps until reliable time information is available.
  • Documentation

    • Updated stage descriptions, resource usage figures, and validation results to cover the new time-quality functionality.
    • Added time-quality measurements to the documented cost table.

timeQuality (RFC 5424 section 7.1) joins the record, and meta gains sysUpTime.
Store-and-forward is the next stage, and it breaks the assumption that a record's
timestamp is close to when the collector saw it — so the device says what its clock
is actually worth before that assumption goes.

  wire ... BOOT [meta sequenceId="1" sysUpTime="362"][timeQuality tzKnown="1" isSynced="0"] device started

  Flash       +7,612 B    (+292 on the previous stage)
  RAM         +5,880 B        (+24)
  Log stack     +448 B  (unchanged)
  Service       +672 B  (unchanged)

isSynced is 0 and stays 0. This device reads the host clock once at boot and then
free-runs on the FreeRTOS tick: enough to stamp a record, not synchronisation, and
an operator is better served by being told so than by an unqualified timestamp.
RFC 5424 section 7.1.3 forbids syncAccuracy when isSynced is 0, so it is omitted
rather than guessed. tzKnown is 1 — the device works in UTC throughout and knows it.

sysUpTime lands here rather than beside sequenceId because it answers the same
question the clock does: after a reboot the sequence restarts at 1, and an uptime
near zero is what distinguishes that from a counter wrap. Adding it is one more
field on a config struct that already existed, which is the point — an SD-ID grows a
PARAM at a time and nothing downstream notices.

One constraint worth knowing: SolidSyslogFreeRtosSysUpTime_Get is guarded at compile
time, and with a 32-bit TickType_t it rejects any configTICK_RATE_HZ that does not
divide 100. This device runs at 100 Hz and builds; a 1000 Hz device would not, and
the escape is to supply your own SolidSyslogSysUpTimeFunction.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 032a9258-765e-4168-a15a-57e09c751ef0

📥 Commits

Reviewing files that changed from the base of the PR and between 3f1847f and 8bc5224.

⛔ Files ignored due to path filters (2)
  • measurements/stages.tsv is excluded by !**/*.tsv
  • measurements/time-quality.csv is excluded by !**/*.csv
📒 Files selected for processing (3)
  • README.md
  • app/syslog/Syslog.c
  • run-report.md

📝 Walkthrough

Walkthrough

Syslog now publishes timeQuality and sysUpTime structured data. README stage documentation, resource-cost tables, and run-report measurements were updated for the time-quality configuration.

Changes

Time quality structured data

Layer / File(s) Summary
Syslog structured-data wiring
app/syslog/Syslog.c
Adds uptime and time-quality includes, expands SD storage to two entries, wires GetSysUpTime, and initializes the timeQuality callback.
Stage documentation and run measurements
README.md, run-report.md
Replaces TCP stage documentation with time-quality details and updates resource costs, baseline checks, wire samples, and self-check expectations.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: adding timeQuality and timestamp trust signaling to syslog records.
Description check ✅ Passed The description follows the template and includes the stage summary plus a complete checklist.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch stage/time-quality

Comment @coderabbitai help to get the list of available commands.

@DavidCozens
DavidCozens merged commit f4724fc into main Jul 29, 2026
2 checks passed
@DavidCozens
DavidCozens deleted the stage/time-quality branch July 29, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant