stripe / veneur

A distributed, fault-tolerant pipeline for observability data
MIT License
1.74k stars 174 forks source link

Improvements around testing Chunking behavior #1006

Closed mimran-stripe closed 1 year ago

mimran-stripe commented 1 year ago

Summary

  1. Changes the logic to use len(batch) to determine when we have reached write_batch_size instead of the iteration variable.
  2. Adds assertions to how large each batch is that was written.
  3. A few changes to comments.

Motivation

I was investigating the test cases and noted that the first batch written was always 1 more than the write_batch_size. In particular, I noticed that for TestChunkedWritesRespectContextCancellation the metricsFlushed was 4, despite the batch_size being 3. This seems incorrect / unintended behavior to me.

Test plan

Updated the test cases to assert on the batch size. Just using unit tests.

Rollout/monitoring/revert plan