Class: NexposeTicketing::TicketMetrics
- Inherits:
-
Object
- Object
- NexposeTicketing::TicketMetrics
- Defined in:
- lib/nexpose_ticketing/ticket_metrics.rb
Constant Summary collapse
- @@ticket_counts =
Create the specific metric collecting methods
{}
Instance Attribute Summary collapse
-
#ticket_counts ⇒ Object
Returns the value of attribute ticket_counts.
Instance Method Summary collapse
- #finish ⇒ Object
-
#initialize ⇒ TicketMetrics
constructor
A new instance of TicketMetrics.
- #start ⇒ Object
Constructor Details
#initialize ⇒ TicketMetrics
Returns a new instance of TicketMetrics.
18 19 20 21 |
# File 'lib/nexpose_ticketing/ticket_metrics.rb', line 18 def initialize @start_time = nil @log = NexposeTicketing::NxLogger.instance end |
Instance Attribute Details
#ticket_counts ⇒ Object
Returns the value of attribute ticket_counts.
3 4 5 |
# File 'lib/nexpose_ticketing/ticket_metrics.rb', line 3 def ticket_counts @ticket_counts end |
Instance Method Details
#finish ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/nexpose_ticketing/ticket_metrics.rb', line 28 def finish return if @start_time == nil @time_taken = Time.at(Time.now - @start_time).utc.strftime('%H:%M:%S') @start_time = nil @log.("Ticket processing took #{@time_taken} to complete.") @@ticket_counts.keys.each do |action| @log.("Metrics: #{@@ticket_counts[action]} tickets were #{action}.") end end |
#start ⇒ Object
23 24 25 26 |
# File 'lib/nexpose_ticketing/ticket_metrics.rb', line 23 def start return if @start_time != nil @start_time = Time.now end |