Class: OneApm::EventAnalyticData
- Inherits:
-
Object
- Object
- OneApm::EventAnalyticData
- Includes:
- Coerce
- Defined in:
- lib/one_apm/transaction/event_analytic_data.rb
Constant Summary collapse
- OA_ERROR_ALL_KEY =
'Errors/all'.freeze
Instance Attribute Summary collapse
-
#apdex ⇒ Object
readonly
Returns the value of attribute apdex.
-
#bytes_rec ⇒ Object
readonly
Returns the value of attribute bytes_rec.
-
#bytes_sent ⇒ Object
readonly
Returns the value of attribute bytes_sent.
-
#call_count ⇒ Object
readonly
Returns the value of attribute call_count.
-
#call_type ⇒ Object
readonly
Returns the value of attribute call_type.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#exec_time ⇒ Object
readonly
Returns the value of attribute exec_time.
-
#guid ⇒ Object
readonly
Returns the value of attribute guid.
-
#has_trace ⇒ Object
readonly
Returns the value of attribute has_trace.
-
#refer_guid ⇒ Object
readonly
Returns the value of attribute refer_guid.
-
#request_url ⇒ Object
readonly
Returns the value of attribute request_url.
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
-
#trip_guid ⇒ Object
readonly
Returns the value of attribute trip_guid.
Instance Method Summary collapse
- #error_times(txn_metrics) ⇒ Object
-
#initialize(payload = {}) ⇒ EventAnalyticData
constructor
A new instance of EventAnalyticData.
- #to_collector_array(encoder = nil) ⇒ Object
Methods included from Coerce
#event_params, #float, #int, #int_or_nil, #log_failure, #string
Constructor Details
#initialize(payload = {}) ⇒ EventAnalyticData
Returns a new instance of EventAnalyticData.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/one_apm/transaction/event_analytic_data.rb', line 10 def initialize(payload = {}) @start_time = payload[:start_timestamp].to_f * 1000 @guid = payload[:guid] @refer_guid = payload[:referring_transaction_guid] @trip_guid = payload[:cat_trip_id] || @refer_guid || @guid @call_count = payload[:call_count] || 1 @duration = payload[:duration] @errors = error_times(payload[:metrics]) @apdex = payload[:apdex_perf_zone] @request_url = payload[:request_url] @bytes_sent = 0 @bytes_rec = 0 @has_trace = apdex != Transaction::OA_APDEX_S ? 1 : 0 @exec_time = payload[:duration] @call_type = 0 # 0: syn , 1: asyn end |
Instance Attribute Details
#apdex ⇒ Object (readonly)
Returns the value of attribute apdex.
8 9 10 |
# File 'lib/one_apm/transaction/event_analytic_data.rb', line 8 def apdex @apdex end |
#bytes_rec ⇒ Object (readonly)
Returns the value of attribute bytes_rec.
8 9 10 |
# File 'lib/one_apm/transaction/event_analytic_data.rb', line 8 def bytes_rec @bytes_rec end |
#bytes_sent ⇒ Object (readonly)
Returns the value of attribute bytes_sent.
8 9 10 |
# File 'lib/one_apm/transaction/event_analytic_data.rb', line 8 def bytes_sent @bytes_sent end |
#call_count ⇒ Object (readonly)
Returns the value of attribute call_count.
7 8 9 |
# File 'lib/one_apm/transaction/event_analytic_data.rb', line 7 def call_count @call_count end |
#call_type ⇒ Object (readonly)
Returns the value of attribute call_type.
8 9 10 |
# File 'lib/one_apm/transaction/event_analytic_data.rb', line 8 def call_type @call_type end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
7 8 9 |
# File 'lib/one_apm/transaction/event_analytic_data.rb', line 7 def duration @duration end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
8 9 10 |
# File 'lib/one_apm/transaction/event_analytic_data.rb', line 8 def errors @errors end |
#exec_time ⇒ Object (readonly)
Returns the value of attribute exec_time.
8 9 10 |
# File 'lib/one_apm/transaction/event_analytic_data.rb', line 8 def exec_time @exec_time end |
#guid ⇒ Object (readonly)
Returns the value of attribute guid.
7 8 9 |
# File 'lib/one_apm/transaction/event_analytic_data.rb', line 7 def guid @guid end |
#has_trace ⇒ Object (readonly)
Returns the value of attribute has_trace.
8 9 10 |
# File 'lib/one_apm/transaction/event_analytic_data.rb', line 8 def has_trace @has_trace end |
#refer_guid ⇒ Object (readonly)
Returns the value of attribute refer_guid.
7 8 9 |
# File 'lib/one_apm/transaction/event_analytic_data.rb', line 7 def refer_guid @refer_guid end |
#request_url ⇒ Object (readonly)
Returns the value of attribute request_url.
8 9 10 |
# File 'lib/one_apm/transaction/event_analytic_data.rb', line 8 def request_url @request_url end |
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
7 8 9 |
# File 'lib/one_apm/transaction/event_analytic_data.rb', line 7 def start_time @start_time end |
#trip_guid ⇒ Object (readonly)
Returns the value of attribute trip_guid.
7 8 9 |
# File 'lib/one_apm/transaction/event_analytic_data.rb', line 7 def trip_guid @trip_guid end |
Instance Method Details
#error_times(txn_metrics) ⇒ Object
27 28 29 30 |
# File 'lib/one_apm/transaction/event_analytic_data.rb', line 27 def error_times(txn_metrics) return txn_metrics[OA_ERROR_ALL_KEY].call_count if txn_metrics.has_key?(OA_ERROR_ALL_KEY) rescue 0 return 0 end |
#to_collector_array(encoder = nil) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/one_apm/transaction/event_analytic_data.rb', line 32 def to_collector_array(encoder = nil) [ start_time, guid, refer_guid, trip_guid, call_count, duration, errors, apdex, request_url, bytes_sent, bytes_rec, has_trace, exec_time, call_type ] end |