Class: Cassanity::Instrumentation::Subscriber
- Inherits:
-
Object
- Object
- Cassanity::Instrumentation::Subscriber
- Defined in:
- lib/cassanity/instrumentation/subscriber.rb
Direct Known Subclasses
Class Method Summary collapse
-
.call(name, start, ending, transaction_id, payload) ⇒ Object
Public: Use this as the subscribed block.
Instance Method Summary collapse
-
#column_family_name? ⇒ Boolean
Private: Returns true if column family name present else false.
-
#command_name? ⇒ Boolean
Private: Returns true if command name present else false.
-
#initialize(name, start, ending, transaction_id, payload) ⇒ Subscriber
constructor
Private: Initializes a new event processing instance.
-
#update ⇒ Object
Public: Actually update all the metriks timers for the event.
-
#update_timer(metric) ⇒ Object
Internal: Override in subclass.
Constructor Details
#initialize(name, start, ending, transaction_id, payload) ⇒ Subscriber
Private: Initializes a new event processing instance.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/cassanity/instrumentation/subscriber.rb', line 10 def initialize(name, start, ending, transaction_id, payload) @name = name @start = start @ending = ending @payload = payload @duration = ending - start @transaction_id = transaction_id @command_name = @payload[:command] @keyspace_name = @payload[:keyspace_name] @column_family_name = @payload[:column_family_name] end |
Class Method Details
.call(name, start, ending, transaction_id, payload) ⇒ Object
Public: Use this as the subscribed block.
5 6 7 |
# File 'lib/cassanity/instrumentation/subscriber.rb', line 5 def self.call(name, start, ending, transaction_id, payload) new(name, start, ending, transaction_id, payload).update end |
Instance Method Details
#column_family_name? ⇒ Boolean
Private: Returns true if column family name present else false.
53 54 55 |
# File 'lib/cassanity/instrumentation/subscriber.rb', line 53 def column_family_name? @column_family_name_present ||= !@column_family_name.nil? && !@column_family_name.empty? end |
#command_name? ⇒ Boolean
Private: Returns true if command name present else false.
48 49 50 |
# File 'lib/cassanity/instrumentation/subscriber.rb', line 48 def command_name? @command_name_present ||= !@command_name.nil? && !@command_name.empty? end |
#update ⇒ Object
Public: Actually update all the metriks timers for the event.
Returns nothing.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/cassanity/instrumentation/subscriber.rb', line 26 def update update_timer 'cassanity.cql' if command_name? update_timer "cassanity.command.#{@command_name}.cql" end if column_family_name? update_timer "cassanity.column_family.#{@column_family_name}.cql" end if column_family_name? && command_name? update_timer "cassanity.column_family.#{@column_family_name}.#{@command_name}.cql" end end |
#update_timer(metric) ⇒ Object
Internal: Override in subclass.
43 44 45 |
# File 'lib/cassanity/instrumentation/subscriber.rb', line 43 def update_timer(metric) raise 'not implemented' end |