diff --git a/shutdown_test.go b/shutdown_test.go index 89c88b6..0cd29f6 100644 --- a/shutdown_test.go +++ b/shutdown_test.go @@ -72,8 +72,8 @@ func TestRecordsAfterCloseAreReportedOnce(t *testing.T) { } } -// Found by sending a 12 MiB record to the real endpoint: it answered 2xx and the record never -// appeared, because the per-record limit is enforced after the request is accepted. +// Found by sending a 12 MiB record to the real endpoint: it answered 2xx and replaced the record +// with a notice row in the source, so the client counted as sent what never landed. func TestRecordOverTheSizeLimitIsDroppedBeforeSending(t *testing.T) { server, requests := newServer(t, accepted) errs := &errorList{} diff --git a/transport.go b/transport.go index 33f8051..111f23f 100644 --- a/transport.go +++ b/transport.go @@ -38,8 +38,10 @@ const ( dropReportInterval = 5 * time.Second // maxRecordBytes is Better Stack's limit on one record's uncompressed JSON. The endpoint - // accepts a request whose compressed body fits and discards such a record afterwards - // without a word, so the check has to happen here for the drop to be visible. + // accepts a request whose compressed body fits and then replaces such a record with a + // notice row in the source. Checking here saves uploading megabytes that cannot land, + // reports the drop where the application can see it and keeps Stats honest instead of + // counting the record as sent. maxRecordBytes = 10 << 20 )