Class: Telltale::Data
- Inherits:
-
Object
- Object
- Telltale::Data
- Defined in:
- lib/telltale/data.rb
Instance Attribute Summary collapse
-
#finished ⇒ Object
readonly
Returns the value of attribute finished.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#started ⇒ Object
readonly
Returns the value of attribute started.
Class Method Summary collapse
Instance Method Summary collapse
- #all ⇒ Object
-
#initialize(started, finished, payload) ⇒ Data
constructor
A new instance of Data.
- #request_count ⇒ Object
- #total_time ⇒ Object
Constructor Details
#initialize(started, finished, payload) ⇒ Data
Returns a new instance of Data.
9 10 11 12 13 |
# File 'lib/telltale/data.rb', line 9 def initialize(started, finished, payload) @started = started @finished = finished @payload = payload end |
Instance Attribute Details
#finished ⇒ Object (readonly)
Returns the value of attribute finished.
3 4 5 |
# File 'lib/telltale/data.rb', line 3 def finished @finished end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
3 4 5 |
# File 'lib/telltale/data.rb', line 3 def payload @payload end |
#started ⇒ Object (readonly)
Returns the value of attribute started.
3 4 5 |
# File 'lib/telltale/data.rb', line 3 def started @started end |
Class Method Details
.compile(started, finished, payload) ⇒ Object
5 6 7 |
# File 'lib/telltale/data.rb', line 5 def self.compile(started, finished, payload) new(started, finished, payload).all end |
Instance Method Details
#all ⇒ Object
15 16 17 |
# File 'lib/telltale/data.rb', line 15 def all [total_time, request_count] end |
#request_count ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/telltale/data.rb', line 28 def request_count { metric: "#{metric_prefix}.rails.request_count", value: 1, timestamp: Time.now.to_i, tags: , } end |
#total_time ⇒ Object
19 20 21 22 23 24 25 26 |
# 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: , } end |