feat(spans): Flush oversized segments in chunks#111820
feat(spans): Flush oversized segments in chunks#111820
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| chunks.append(current_chunk) | ||
|
|
||
| if len(chunks) > 1: | ||
| metrics.incr("spans.buffer.flusher.oversized_segments_chunked") |
There was a problem hiding this comment.
Can we also track a distribution on the number of chunks we have? metrics.timing(..., len(chunks))?
There was a problem hiding this comment.
We also drop spans during ingestion into the redis lua script, those spans are still dropped. Instead we should stop merging sets and flush them out individually. This will make it unnecessary to do the same in the flusher, and preserves the invariant that there is only one root span per flushed chunk. Right now it's possible that multiple unrelated spans (i.e. distinct trees) are flushed in a single chunk and it's not clear to me how the segments consumer handles that (or that it's supposed to)

Refs STREAM-826
spans.buffer.flush-oversized-segmentsto allow for flushing entire segments that exceedspans.buffer.max-segments-bytesbytes._chunk_segment()function in the flusher that splits span payloads into chunks, each chunk undermax-segment-bytesWhen the option is enabled, the flusher produces one Kafka message per chunk instead of one per segment.