tp: typed repeated fields overwrite on slice End, debug annotation arrays append
Begin and End args of a track event slice are merged into one arg set, but arrays merge differently depending on where they come from:
- Debug annotation and JSON arrays append: End's elements continue after Begin's.
track_event_merged_debug_annotations_argstests this. - Typed repeated fields restart at
[0]on End and overwrite Begin's elements.
Repro, a Begin and End on one slice each carrying debug_annotations { name: "da" array_values ... } and chrome_latency_info { component_info ... }, with values 1, 2 on Begin and 3, 4 on End:
| key | int_value |
|---|---|
chrome_latency_info.component_info[0].time_us |
3 |
chrome_latency_info.component_info[1].time_us |
4 |
debug.da[0] |
1 |
debug.da[1] |
2 |
debug.da[2] |
3 |
debug.da[3] |
4 |
Begin's component_info is lost.
The cause: debug annotation and JSON arrays take their indexes from the slice's ArgsInserter, which lives until the slice closes. Typed repeated fields use the parser's RepeatedFieldIndex, which is reset for every event.
We should pick one behaviour. Appending matches the existing test and loses no data, so the likely fix is for typed repeated fields to take their indexes from the inserter too.
Hi @LalitMaganti ! I'd like to work on this issue. I'll first look into the existing indexing logic and tests, then try to fix the repeated-field indexing and add a regression test. Please let me know if there's anything specific I should consider before starting.
I'd prefer if the core team look at this. The difficulty here is not in sending a PR but in deciding what the right thing to do is.