Skip to content

Commit

Permalink
Increase MAX_SERIALIZED_PAYLOAD_SIZE to 1MB (#2108)
Browse files Browse the repository at this point in the history
  • Loading branch information
sl0thentr0py authored Sep 13, 2023
1 parent cc91b56 commit c916057
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### Bug Fixes

- Rename `http.method` to `http.request.method` in `Span::DataConventions` [#2106](https://github.com/getsentry/sentry-ruby/pull/2106)
- Increase `Envelope::Item::MAX_SERIALIZED_PAYLOAD_SIZE` to 1MB [#2108](https://github.com/getsentry/sentry-ruby/pull/2108)

## 5.11.0

Expand Down
2 changes: 1 addition & 1 deletion sentry-ruby/lib/sentry/envelope.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Sentry
class Envelope
class Item
STACKTRACE_FRAME_LIMIT_ON_OVERSIZED_PAYLOAD = 500
MAX_SERIALIZED_PAYLOAD_SIZE = 1024 * 200
MAX_SERIALIZED_PAYLOAD_SIZE = 1024 * 1000

attr_accessor :headers, :payload

Expand Down
22 changes: 11 additions & 11 deletions sentry-ruby/spec/sentry/transport_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@
let(:envelope) { subject.envelope_from_event(event) }

before do
event.breadcrumbs = Sentry::BreadcrumbBuffer.new(100)
100.times do |i|
event.breadcrumbs = Sentry::BreadcrumbBuffer.new(1000)
1000.times do |i|
event.breadcrumbs.record Sentry::Breadcrumb.new(category: i.to_s, message: "x" * Sentry::Event::MAX_MESSAGE_SIZE_IN_BYTES)
end
serialized_result = JSON.generate(event.to_hash)
Expand All @@ -197,7 +197,7 @@

context "if it's still oversized" do
before do
100.times do |i|
1000.times do |i|
event.contexts["context_#{i}"] = "s" * Sentry::Event::MAX_MESSAGE_SIZE_IN_BYTES
end
end
Expand All @@ -206,7 +206,7 @@
data, _ = subject.serialize_envelope(envelope)
expect(data).to be_nil
expect(io.string).not_to match(/Sending envelope with items \[event\]/)
expect(io.string).to match(/tags: 2, contexts: 820791, extra: 2/)
expect(io.string).to match(/tags: 2, contexts: 8208891, extra: 2/)
end
end
end
Expand All @@ -220,7 +220,7 @@
Regexp.new("^(#{project_root}/)?#{Sentry::Backtrace::APP_DIRS_PATTERN}")
end
let(:frame_list_limit) { 500 }
let(:frame_list_size) { frame_list_limit * 4 }
let(:frame_list_size) { frame_list_limit * 20 }

before do
single_exception = event.exception.values[0]
Expand Down Expand Up @@ -270,7 +270,7 @@

context "if it's still oversized" do
before do
100.times do |i|
1000.times do |i|
event.contexts["context_#{i}"] = "s" * Sentry::Event::MAX_MESSAGE_SIZE_IN_BYTES
end
end
Expand All @@ -279,7 +279,7 @@
data, _ = subject.serialize_envelope(envelope)
expect(data).to be_nil
expect(io.string).not_to match(/Sending envelope with items \[event\]/)
expect(io.string).to match(/tags: 2, contexts: 820791, extra: 2/)
expect(io.string).to match(/tags: 2, contexts: 8208891, extra: 2/)
end
end
end
Expand Down Expand Up @@ -340,8 +340,8 @@
let(:envelope) { subject.envelope_from_event(event) }

before do
event.breadcrumbs = Sentry::BreadcrumbBuffer.new(100)
100.times do |i|
event.breadcrumbs = Sentry::BreadcrumbBuffer.new(1000)
1000.times do |i|
event.breadcrumbs.record Sentry::Breadcrumb.new(category: i.to_s, message: "x" * Sentry::Event::MAX_MESSAGE_SIZE_IN_BYTES)
end
serialized_result = JSON.generate(event.to_hash)
Expand Down Expand Up @@ -370,7 +370,7 @@

context "if it's still oversized" do
before do
100.times do |i|
1000.times do |i|
event.contexts["context_#{i}"] = "s" * Sentry::Event::MAX_MESSAGE_SIZE_IN_BYTES
end
end
Expand All @@ -380,7 +380,7 @@

subject.send_envelope(envelope)

expect(io.string).to match(/tags: 2, contexts: 820791, extra: 2/)
expect(io.string).to match(/tags: 2, contexts: 8208891, extra: 2/)
expect(io.string).not_to match(/Sending envelope with items \[event\]/)
end

Expand Down

0 comments on commit c916057

Please sign in to comment.