Class: Sentry::Envelope::Item Private
- Inherits:
-
Object
- Object
- Sentry::Envelope::Item
- Defined in:
- lib/sentry/envelope.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- STACKTRACE_FRAME_LIMIT_ON_OVERSIZED_PAYLOAD =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
500- MAX_SERIALIZED_PAYLOAD_SIZE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
1024 * 1000
Instance Attribute Summary collapse
- #headers ⇒ Object private
- #payload ⇒ Object private
Class Method Summary collapse
-
.data_category(type) ⇒ Object
private
rate limits and client reports use the data_category rather than envelope item type.
Instance Method Summary collapse
- #data_category ⇒ Object private
-
#initialize(headers, payload) ⇒ Item
constructor
private
A new instance of Item.
- #serialize ⇒ Object private
- #size_breakdown ⇒ Object private
- #to_s ⇒ Object private
- #type ⇒ Object private
Constructor Details
#initialize(headers, payload) ⇒ Item
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Item.
12 13 14 15 |
# File 'lib/sentry/envelope.rb', line 12 def initialize(headers, payload) @headers = headers @payload = payload end |
Instance Attribute Details
#headers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/sentry/envelope.rb', line 10 def headers @headers end |
#payload ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/sentry/envelope.rb', line 10 def payload @payload end |
Class Method Details
.data_category(type) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
rate limits and client reports use the data_category rather than envelope item type
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/sentry/envelope.rb', line 22 def self.data_category(type) case type when "session", "attachment", "transaction", "profile", "span" then type when "sessions" then "session" when "check_in" then "monitor" when "statsd", "metric_meta" then "metric_bucket" when "event" then "error" when "client_report" then "internal" else "default" end end |
Instance Method Details
#data_category ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
34 35 36 |
# File 'lib/sentry/envelope.rb', line 34 def data_category self.class.data_category(type) end |
#serialize ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/sentry/envelope.rb', line 42 def serialize result = to_s if result.bytesize > MAX_SERIALIZED_PAYLOAD_SIZE result = to_s end if result.bytesize > MAX_SERIALIZED_PAYLOAD_SIZE reduce_stacktrace! result = to_s end [result, result.bytesize > MAX_SERIALIZED_PAYLOAD_SIZE] end |
#size_breakdown ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
58 59 60 61 62 |
# File 'lib/sentry/envelope.rb', line 58 def size_breakdown payload.map do |key, value| "#{key}: #{JSON.generate(value).bytesize}" end.join(", ") end |
#to_s ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
38 39 40 |
# File 'lib/sentry/envelope.rb', line 38 def to_s [JSON.generate(@headers), @payload.is_a?(String) ? @payload : JSON.generate(@payload)].join("\n") end |
#type ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 |
# File 'lib/sentry/envelope.rb', line 17 def type @headers[:type] || "event" end |