Skip to content

State the rules a reader follows on the format pages - #47

Merged
wu-sheng merged 3 commits into
mainfrom
format-reading-rules
Sep 27, 2026
Merged

wu-sheng merged 3 commits into
mainfrom
format-reading-rules

Conversation

@wu-sheng

@wu-sheng wu-sheng commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

Why

The formats are JSON lines and JSON. A reader in another language, such as the SkyWalking OAP, builds the same asz.view document from the same files. Where the pages did not state a rule, such a reader had to find it in asz's Go code, and ended up copying what Go's libraries do: how Go decodes a null inside a list, which integer type a field has, how it trims white space, how it rounds a time to milliseconds, and how it orders map keys. The pages now state these rules, so a reader follows the pages and never the code.

What changes

Documentation only. No code, key or format changes; the formats stay sd/1, sf/1 and asz.view 1.0.

  • Session Data, "Reading a record": the type of every record field, of every part field, of every dropped entry field, and of the usage values. A null is a field left out, and a reader ignores a field the page does not list, so a later version can add one. An integer is a whole number that fits in 64 bits with its sign, and ord and off are never negative. asz's reader stops at a line it cannot decode, as at a line that is not JSON. A time is RFC 3339 with a four-digit year, and times compare as the instants they name, with examples where the text order is the reverse. A reader does not have to copy what asz's code does with input asz never writes.
  • Session Flow: attrs keys are written sorted, and ids and keys sort in code point order, which the page defines. The rejection list gains the provider_bodies rule that ProviderBodiesOf already applies, with null read as no bodies.
  • asz.view: times round down to the millisecond; a round header's time is null when absent and 0 when it is not a time; ids compare in code point order; attrs are as the round wrote them; a data part's text is the record's readable text when it has one, a queued command's prompt included, and otherwise the data as written; white space is Unicode's White_Space property; which records give a call its result, result_state, result_bytes and failed; request_to_result_ms drops the rest of a millisecond; usage leaves out a count of zero, a dropped entry holds its what, bytes and why, and a field Session Data does not list is not copied.

Each statement was checked against the code on main: pkg/sessiondata (Record, Part, Drop, Usage, Reader.Next and its callers in internal/view), pkg/sessionflow (ProviderBodiesOf, checkRefs, the frame sort) and internal/view (Millis, millisPtr, durationMillis, fill, fillResult, readable, withoutProviderBodies, shortName). GPT-6 reviewed the pages against that code in two rounds; its three findings on them are fixed.

Tests

make check passes.

The formats are JSON lines and JSON, and a reader in another language,
such as the SkyWalking OAP, builds the same asz.view document from the
same files. Where a page did not state a rule, such a reader had to find
it in asz's Go code, and ended up copying what Go's libraries do. The
pages now state these rules, so a reader follows the pages.

- Session Data: the type of every record, part and dropped field, and of
  the usage values; a null is a field left out; a reader ignores a field
  the page does not list; asz's reader stops at a line it cannot decode.
  Times are RFC 3339 with a four-digit year, compared as instants.
- Session Flow: attrs keys and ids sort in code point order, which the
  page defines, and the provider_bodies rule asz's reader already applies.
- asz.view: times round down to the millisecond; header times are null
  or 0; attrs and data are as written; a data part's text; white space is
  Unicode's White_Space property; which records give a call its result;
  how request_to_result_ms is cut.

Documentation only. The formats stay sd/1, sf/1 and asz.view 1.0.
The counts in usage leave out a count of zero, a dropped entry holds its
what and bytes, and why when there is one, and a field the Session Data
page does not list is not copied. A reader in another language needs this
to write the same document.
@wu-sheng wu-sheng added this to the 0.6.0 milestone Sep 27, 2026
@wu-sheng wu-sheng added the documentation Improvements or additions to documentation label Sep 27, 2026
A view writes each tree down to twelve levels below its root, a talk or an
entry of loose, and leaves a deeper node out. The page said the document
holds every run and step, which is true only within that depth. No talk
measured has more than three levels.
@wu-sheng
wu-sheng merged commit fc04fa1 into main Sep 27, 2026
24 checks passed
@wu-sheng
wu-sheng deleted the format-reading-rules branch September 27, 2026 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant