File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1797,7 +1797,19 @@ def test_mixed_batch_respects_max_payload_size_per_buffer(self):
17971797 # buffer overflowing must not drag the other one out with it.
17981798 sent = []
17991799 self .statsd ._send_to_server = lambda packet , replay_safe = False : sent .append ((packet , replay_safe ))
1800- self .statsd ._max_payload_size = 250
1800+
1801+ # Measure a real serialised line and size the cap from it. Hard-coding
1802+ # a byte count would make the test depend on how long constant/origin
1803+ # tags happen to make each line in this environment: too small and a
1804+ # single line breaches the cap, too large and nothing ever overflows.
1805+ self .statsd .open_buffer ()
1806+ self .statsd .gauge ("plain.filler.0" , 0 )
1807+ line_size = self .statsd ._buffer_sizes [False ]
1808+ self .statsd .close_buffer ()
1809+ del sent [:]
1810+
1811+ # Room for two lines, so every third one forces a flush.
1812+ self .statsd ._max_payload_size = line_size * 2 + 1
18011813
18021814 self .statsd .open_buffer ()
18031815 # One small replay-safe line that should still be buffered while the
You can’t perform that action at this time.
0 commit comments