Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions shutdown_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
6 changes: 4 additions & 2 deletions transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down