Class: Variant2EnvelopeWrapper

Inherits:
EnvelopeWrapperBase show all
Defined in:
lib/rookout/com_ws/envelope_wrapper.rb

Instance Method Summary collapse

Methods inherited from EnvelopeWrapperBase

#wrap_in_envelope

Constructor Details

#initialize(agent_id, aug_id, report_id, arguments) ⇒ Variant2EnvelopeWrapper

Returns a new instance of Variant2EnvelopeWrapper.



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rookout/com_ws/envelope_wrapper.rb', line 24

def initialize agent_id, aug_id, report_id, arguments
  super()

  @aug_report_message = Com::Rookout::AugReportMessage.new agent_id: agent_id,
                                                           aug_id: aug_id,
                                                           report_id: report_id
  @serializer = Rookout::Processor::NamespaceSerializer2.new
  @aug_report_message.arguments2 = @serializer.dump arguments, true

  @estimated_length = @serializer.estimated_pending_bytes
  @envelope = nil
end

Instance Method Details

#calculate_sizeObject



50
51
52
# File 'lib/rookout/com_ws/envelope_wrapper.rb', line 50

def calculate_size
  @estimated_length
end

#envelopeObject



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/rookout/com_ws/envelope_wrapper.rb', line 37

def envelope
  if @envelope.nil?
    @serializer.string_cache.each do |key, value|
      @aug_report_message.strings_cache[key.encode "UTF-8", invalid: :replace, undef: :replace, replace: "?"] = value
    end
    @envelope = wrap_in_envelope @aug_report_message

    @serializer = nil
    @aug_report_message = nil
  end
  @envelope
end