Skip to content

feat: number every record with a meta sequenceId - #6

Merged
DavidCozens merged 1 commit into
mainfrom
stage-06-sequence-id
Aug 16, 2026
Merged

feat: number every record with a meta sequenceId#6
DavidCozens merged 1 commit into
mainfrom
stage-06-sequence-id

Conversation

@DavidCozens

Copy link
Copy Markdown
Contributor

Add the first structured-data element, SolidSyslogMetaSd, carrying a sequence number. Elements
are supplied to the logger as an array and read on every record, so they must outlive the call that
creates the logger.

static struct SolidSyslogStructuredData* sd[1];

struct SolidSyslogMetaSdConfig metaConfig = {
    .Counter = SolidSyslogStdAtomicCounter_Create(),
};
sd[0] = SolidSyslogMetaSd_Create(&metaConfig);

struct SolidSyslogConfig config = {
    /* ... */
    .Sd      = sd,
    .SdCount = 1U,
};
... BOOT [meta sequenceId="1"] device started

The sequence number is incremented once per record formatted, not once per record delivered. A
record that never arrives therefore leaves a gap in the sequence rather than no trace at all, which
is why it is worth adding before any buffering or storage that could drop one. Instrument first,
then introduce the failure mode.

Unlike a header field, an SD PARAM has no nil value: one that is unset is omitted entirely rather
than written as -.

The counter comes from SolidSyslogStdAtomicCounter. If your toolchain has no atomics, supply your
own to the contract SolidSyslogAtomicCounter_Increment states — and note that logging from more
than one task is what makes the atomic part of it necessary.

StdAtomic joins the platform list, and here that is all it is: naming it compiles its two sources
exactly as naming LwipRaw compiles its eleven.

When you need it. If anyone needs to know that records have gone missing.

@DavidCozens

Copy link
Copy Markdown
Contributor Author

@coderabbitai pause

@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3b825675-57e2-443d-90c4-c54301c2e63d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Note

Reviews paused

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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

@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews paused.

@DavidCozens
DavidCozens force-pushed the stage-05-header-fields branch from 8dc0e61 to 4ed519b Compare August 16, 2026 21:47
  <134>1 ... solid-syslog-example - BOOT [meta sequenceId="1"] device started

  Flash  +6,052 B  (+944 on the previous stage)
  RAM    +1,972 B    (+64)

The counter increments once per record *formatted*, not per record delivered. A
record that never reaches the collector therefore leaves a gap in the sequence
rather than no trace at all — which is the whole value of the field, and the
reason it lands before the circular buffer rather than after it. Instrument
first, then introduce the failure mode; the other order means asserting a drop
you already caused.

The first SD-ELEMENT also introduces the rule that governs the rest: unlike a
header field, an SD PARAM has no NILVALUE, so an unset one is omitted entirely
rather than written as "-".

StdAtomic joins the platform list, and here that is all it is. Naming it compiles
its two sources exactly as naming LwipRaw compiles its eleven, because the
fragment hands back sources rather than link targets. The counter is the real one
rather than the Null fallback that reports 1 forever — the image retains its
StdAtomicCounter symbols.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@DavidCozens
DavidCozens force-pushed the stage-06-sequence-id branch from 2dbd29b to 87039e5 Compare August 16, 2026 21:47
@DavidCozens
DavidCozens changed the base branch from stage-05-header-fields to main August 16, 2026 21:47
@DavidCozens
DavidCozens merged commit 6c45124 into main Aug 16, 2026
@DavidCozens
DavidCozens deleted the stage-06-sequence-id branch August 16, 2026 21:54
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