Skip to content

cJSON JsonWriter backend, proven by porting the profiles exporter #109

Closed

Description

@ltowarek

Parent

Part of #102

What to build

A cJSON-backed JsonWriter for ESP-IDF, proven by porting the existing profiles exporter onto it and verifying on hardware. This is the validation of the upstream interface: a second, independent consumer that shakes out vocabulary gaps before the design is proposed upstream.

Target: this repository, branch json-writer-cjson.

cJSON is a document library, so the backend maintains a node stack translating begin/end tokens into node construction. This does not realise a streaming memory benefit; it buys the option at no extra cost, and cJSON is chosen deliberately to minimise hand-maintained code and to reuse the correct string escaping and number formatting it already provides. It is already a declared dependency of this component.

The profiles exporter currently hand-rolls cJSON calls. Porting it leaves the component with one JSON emission path instead of two.

Acceptance criteria

  • A cJSON-backed JsonWriter implements the full token vocabulary
  • It compiles with exceptions and RTTI disabled
  • Failures set the sticky flag and are logged, never thrown
  • The profiles exporter emits exclusively through the interface
  • Profile payloads are byte-equivalent to those produced before the port
  • The existing profiles end-to-end test passes against the headless stack with the real device
  • Any vocabulary gap found during the port is reported back so the upstream interface can be corrected before review

Blocked by

Activity

  1. ltowarek commented on Sep 11, 2026

    @ltowarek
    OwnerAuthor

    Implemented in 0f3af2a0bb4dc9edb1a93ec9779345206b8cf450 ("Add a cJSON-backed JsonWriter, proven by porting the profiles exporter") and 28e9e5a3762daa6403313ee7a418c24515676016 (code-review follow-up), on branches json-writer-cjson and otlp-json-no-protobuf. The cJSON JsonWriter implements the full token vocabulary, compiles with exceptions/RTTI disabled, and reports failures through the sticky ok() flag rather than throwing; the profiles exporter now emits exclusively through it.

    The real-hardware AC wasn't run in that session, but it was covered afterward: otlp-json-no-protobuf (which carries this port) was verified end to end on the car in #115, and observability/tests/e2e/test_profiles.py was among the 44/48 passing tests there — the 4 failures were unrelated (an autonomous-driving timing dependency, not profiles/Pyroscope).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestready-for-agentFully specified, ready for an AFK agent

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions