We have updated our Terms of Service, Code of Conduct, and Addendum.

Event Breaking issues in JSON Array Mode

Options

Hey all, I'm having some event breaking issues, and I'm really struggling. `events` is an array of objects, and each object has some fields. I'm using the `Event Breaker` function, in `JSON Array` mode. `Array Field` is set to `events`, and yet nothing is happening. I've tried with `JSON Extract Fields` both on and off, to no avail.|

Answers

  • Jon Rust
    Jon Rust Posts: 439 mod
    Options

    Try using Unroll, source field set to `events`

  • Jon Rust
    Jon Rust Posts: 439 mod
    Options

    IIRC, EB works on _raw. not on arbitrary fields in the event

  • Jon Rust
    Jon Rust Posts: 439 mod
    Options

    if events was a thing under _raw, you might see the results you were expecting

  • Igor Gifrin
    Igor Gifrin Posts: 12 mod
    Options

    Progress! If I unroll onto _raw, each new event has its own events array, with all 105 siblings, essentially squaring the memory footprint. If I unroll onto events, now I just need to eval all child fields to top-level fields. Long shot question - is it possible to return multiple events from a code function? I can try modifying raw to get EB working, but I don't think that's a long-term solution, in case we need the OG event later for debugging.

  • Jon Rust
    Jon Rust Posts: 439 mod
    Options

    Code: No, code works inside a single event context only

  • Igor Gifrin
    Igor Gifrin Posts: 12 mod
    Options

    Valid. If I overwrite _raw in code with a *stringified* array, then EB will work. Seems silly to json parse and then stringify to json parse again, so unroll is likely the best option here.

  • Jon Rust
    Jon Rust Posts: 439 mod
    Options

    def experiment with that. Hit the CPU profiler in the stats popout

  • Jon Rust
    Jon Rust Posts: 439 mod
    Options

    0

  • Igor Gifrin
    Igor Gifrin Posts: 12 mod
    Options

    unroll takes 87ms; total time 260ms; though more than half appears to be writing the pipeline results to the preview pane

  • Igor Gifrin
    Igor Gifrin Posts: 12 mod
    Options

    EB takes 53ms; increases code from 2 to 3 for the stringify; total time 103ms - less than half. IDK what `run Microtasks` is, but it takes a lot longer after `unroll`

  • Igor Gifrin
    Igor Gifrin Posts: 12 mod
    Options

    Looks like parse -> stringify -> parse is most performant. Thanks for the hint on the profiler!

  • Jon Rust
    Jon Rust Posts: 439 mod
    Options

    woof, that's a lot of time! If you can cleanse your data, I'd love to get a sample to see what sort of optimizations i can come up with. let me know.