Re: [RFC PATCH 3/3] trace2: add a schema validator for trace2 events
- From
- Jeff Hostetler <git@jeffhostetler.com>
- Date
- Jun 27, 2019, 13:57 UTC
- Message-ID
- <2add419b-80e9-2b21-b4ae-eeb7a1f25776@jeffhostetler.com>
- In-Reply-To
- <86y31vxihj.fsf@gmail.com>
On 6/21/2019 7:53 AM, Jakub Narebski wrote:
Show 24 quoted lines
> Josh Steadmon <steadmon@google.com> writes: >> On 2019.06.12 15:28, Ævar Arnfjörð Bjarmason wrote: >>> On Wed, Jun 12 2019, Josh Steadmon wrote: >>> >>>> trace_schema_validator can be used to verify that trace2 event output >>>> conforms to the expectations set by the API documentation and codified >>>> in event_schema.json (or strict_schema.json). This allows us to build a >>>> regression test to verify that trace2 output does not change >>>> unexpectedly. >>> >>> Does this actually work for you? As seen in my code at >>> https://public-inbox.org/git/87zhnuwdkp.fsf@evledraar.gmail.com/ our >>> test suite emits various lines of JSON that aren't even validly encoded, >>> so I can't imagine we're passing any sort of proper parser validatior, >>> let alone a schema validator. > [...] >> The problem with the existing validators is that they expect each file to be a >> complete JSON entity, whereas the trace output is one object per line. You can >> of course loop over the lines in a shell script, but in my testing this approach >> took multiple hours on the full test suite trace output, vs. 15 minutes for the >> implementation in this patch. > > Isn't this JSON-Lines (http://jsonlines.org/), also known as > Line-delimited JSON (LDJSON), newline-delimited JSON (NDJSON) format?
Yes. My Trace2 event format is a series of JSON objects, one per line. I didn't know there was an official name for it.
Thanks Jeff
Show 5 quoted lines
> > Best, > -- > Jakub Narębski >