Class: OneApm::EventAnalyticSample
- Inherits:
-
Object
- Object
- OneApm::EventAnalyticSample
- Includes:
- Coerce
- Defined in:
- lib/one_apm/transaction/event_analytic_sample.rb
Instance Attribute Summary collapse
-
#event_analytic_data ⇒ Object
Returns the value of attribute event_analytic_data.
-
#guid ⇒ Object
Returns the value of attribute guid.
-
#metric_id ⇒ Object
readonly
Returns the value of attribute metric_id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Instance Method Summary collapse
-
#initialize(payload = {}) ⇒ EventAnalyticSample
constructor
A new instance of EventAnalyticSample.
- #metrir_id_from(metric_ids) ⇒ Object
- #spec_name ⇒ Object
- #to_collector_array(encoder = nil) ⇒ Object
Methods included from Coerce
#event_params, #float, #int, #int_or_nil, #log_failure, #string
Constructor Details
#initialize(payload = {}) ⇒ EventAnalyticSample
Returns a new instance of EventAnalyticSample.
10 11 12 13 14 15 16 |
# File 'lib/one_apm/transaction/event_analytic_sample.rb', line 10 def initialize(payload = {}) @name = payload[:name] @scope = payload[:scope] || '' @metric_id = metrir_id_from(payload[:metric_ids] || {}) @guid = payload[:guid] @event_analytic_data = [ OneApm::EventAnalyticData.new(payload) ] end |
Instance Attribute Details
#event_analytic_data ⇒ Object
Returns the value of attribute event_analytic_data.
7 8 9 |
# File 'lib/one_apm/transaction/event_analytic_sample.rb', line 7 def event_analytic_data @event_analytic_data end |
#guid ⇒ Object
Returns the value of attribute guid.
7 8 9 |
# File 'lib/one_apm/transaction/event_analytic_sample.rb', line 7 def guid @guid end |
#metric_id ⇒ Object (readonly)
Returns the value of attribute metric_id.
8 9 10 |
# File 'lib/one_apm/transaction/event_analytic_sample.rb', line 8 def metric_id @metric_id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/one_apm/transaction/event_analytic_sample.rb', line 8 def name @name end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
8 9 10 |
# File 'lib/one_apm/transaction/event_analytic_sample.rb', line 8 def scope @scope end |
Instance Method Details
#metrir_id_from(metric_ids) ⇒ Object
23 24 25 26 |
# File 'lib/one_apm/transaction/event_analytic_sample.rb', line 23 def metrir_id_from(metric_ids) metric_spec = OneApm::MetricSpec.new(name, scope) metric_ids[metric_spec] end |
#spec_name ⇒ Object
18 19 20 21 |
# File 'lib/one_apm/transaction/event_analytic_sample.rb', line 18 def spec_name return [metric_id] if metric_id [-1, name, scope] end |
#to_collector_array(encoder = nil) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/one_apm/transaction/event_analytic_sample.rb', line 28 def to_collector_array(encoder = nil) [ spec_name, event_analytic_data.map(&:to_collector_array) ] end |