Class: StackifyRubyAPM::AgentBaseTransport Private
- Inherits:
-
Object
- Object
- StackifyRubyAPM::AgentBaseTransport
- Includes:
- Log
- Defined in:
- lib/stackify_apm/transport/agent_base.rb
Overview
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.
This class will take care of building a protobuf message.
Direct Known Subclasses
Constant Summary
Constants included from Log
Instance Method Summary collapse
- #build_json_message(transactions = []) ⇒ Object private
-
#build_message(transactions = []) ⇒ Object
private
This method will build a group of Stackify::Traces from the protobuf objects.
- #get_json_message(transactions) ⇒ Object private
- #get_protobuf_message(transactions) ⇒ Object private
-
#initialize(config) ⇒ AgentBaseTransport
constructor
private
A new instance of AgentBaseTransport.
- #post(_transactions = []) ⇒ Object private
Methods included from Log
#debug, #error, #fatal, #info, #log, #warn
Constructor Details
#initialize(config) ⇒ AgentBaseTransport
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 AgentBaseTransport.
11 12 13 14 |
# File 'lib/stackify_apm/transport/agent_base.rb', line 11 def initialize(config) @config = config @transaction_serializers = Serializers::Transactions.new(config) end |
Instance Method Details
#build_json_message(transactions = []) ⇒ 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.
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/stackify_apm/transport/agent_base.rb', line 41 def (transactions = []) traces = [] transactions.each do |transaction| # convert transaction to json json_transaction = @transaction_serializers.build_json(@config, transaction) # add to traces array traces << json_transaction end return traces rescue StandardError => e debug "[AgentBaseTransport] build_json_message() exception: #{e.inspect}" end |
#build_message(transactions = []) ⇒ 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.
This method will build a group of Stackify::Traces from the protobuf objects. It accept Array of transactions.
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/stackify_apm/transport/agent_base.rb', line 27 def (transactions = []) # convert transactions to protobuf traces = StackifyProtoBuf::Traces.new transactions.each do |transaction| # convert transaction to protobuf protobuf_transaction = @transaction_serializers.build_protobuf(@config, transaction) # add to traces array traces.traces.push(protobuf_transaction) end return traces rescue StandardError => e debug "[AgentBaseTransport] build_message() exception: #{e.inspect}" end |
#get_json_message(transactions) ⇒ 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.
21 22 23 |
# File 'lib/stackify_apm/transport/agent_base.rb', line 21 def (transactions) JSON.generate((transactions)) end |
#get_protobuf_message(transactions) ⇒ 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.
16 17 18 19 |
# File 'lib/stackify_apm/transport/agent_base.rb', line 16 def (transactions) protobuf_obj = (transactions) StackifyProtoBuf::Traces.encode(protobuf_obj) end |
#post(_transactions = []) ⇒ 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.
54 55 56 |
# File 'lib/stackify_apm/transport/agent_base.rb', line 54 def post(_transactions = []) raise NotImplementedError end |