Class: NewRelic::Agent::SpanEventAggregator
- Inherits:
-
EventAggregator
- Object
- EventAggregator
- NewRelic::Agent::SpanEventAggregator
- Defined in:
- lib/new_relic/agent/span_event_aggregator.rb
Constant Summary collapse
- SUPPORTABILITY_TOTAL_SEEN =
'Supportability/SpanEvent/TotalEventsSeen'.freeze
- SUPPORTABILITY_TOTAL_SENT =
'Supportability/SpanEvent/TotalEventsSent'.freeze
- SUPPORTABILITY_DISCARDED =
'Supportability/SpanEvent/Discarded'.freeze
Instance Method Summary collapse
Methods inherited from EventAggregator
#after_initialize, buffer_class, capacity_key, #enabled?, enabled_fn, enabled_keys, #harvest!, #has_metadata?, #initialize, #merge!, named, #reset!
Constructor Details
This class inherits a constructor from NewRelic::Agent::EventAggregator
Instance Method Details
#after_harvest(metadata) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/new_relic/agent/span_event_aggregator.rb', line 36 def after_harvest() seen = [:seen] sent = [:captured] discarded = seen - sent ::NewRelic::Agent.record_metric(SUPPORTABILITY_TOTAL_SEEN, count: seen) ::NewRelic::Agent.record_metric(SUPPORTABILITY_TOTAL_SENT, count: sent) ::NewRelic::Agent.record_metric(SUPPORTABILITY_DISCARDED, count: discarded) super end |
#record(priority: nil, event: nil, &blk) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/new_relic/agent/span_event_aggregator.rb', line 19 def record(priority: nil, event: nil, &blk) unless event || priority && blk raise ArgumentError, 'Expected priority and block, or event' end return unless enabled? @lock.synchronize do @buffer.append(priority: priority, event: event, &blk) notify_if_full end end |