class Telltale::Data
Attributes
finished[R]
payload[R]
started[R]
Public Class Methods
compile(started, finished, payload)
click to toggle source
# File lib/telltale/data.rb, line 5 def self.compile(started, finished, payload) new(started, finished, payload).all end
new(started, finished, payload)
click to toggle source
# File lib/telltale/data.rb, line 9 def initialize(started, finished, payload) @started = started @finished = finished @payload = payload end
Public Instance Methods
all()
click to toggle source
# File lib/telltale/data.rb, line 15 def all [total_time, request_count] end
request_count()
click to toggle source
# File lib/telltale/data.rb, line 28 def request_count { metric: "#{metric_prefix}.rails.request_count", value: 1, timestamp: Time.now.to_i, tags: tags, } end
total_time()
click to toggle source
# File lib/telltale/data.rb, line 19 def total_time { metric: "#{metric_prefix}.rails.total_time", value: ((finished - started) * 1000).ceil, timestamp: Time.now.to_i, tags: tags, } end
Private Instance Methods
http_status()
click to toggle source
# File lib/telltale/data.rb, line 54 def http_status return payload[:status] if payload[:status] return 500 if payload[:exception].present? end
metric_prefix()
click to toggle source
# File lib/telltale/data.rb, line 39 def metric_prefix ENV['TELLTALE_PREFIX'] || 'telltale' end