Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase MAX_SERIALIZED_PAYLOAD_SIZE to 1MB #2108

Merged
merged 1 commit into from
Sep 13, 2023
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
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