Class: HeimdallApm::Vault
- Inherits:
-
Object
- Object
- HeimdallApm::Vault
- Defined in:
- lib/heimdall_apm/vault.rb
Overview
Keeps in RAM one or more minute’s worth of metrics. When informed to by the background thread, it pushes the in-RAM metrics off to InfluxDB.
Instance Method Summary collapse
- #current_span ⇒ Object
- #current_timestamp ⇒ Object
-
#initialize(context) ⇒ Vault
constructor
A new instance of Vault.
- #retrieve_and_delete_previous_span ⇒ Object
- #store_transaction_metrics(txn, metrics) ⇒ Object
Constructor Details
Instance Method Details
#current_span ⇒ Object
15 16 17 |
# File 'lib/heimdall_apm/vault.rb', line 15 def current_span @spans[] end |
#current_timestamp ⇒ Object
28 29 30 31 |
# File 'lib/heimdall_apm/vault.rb', line 28 def time = Time.now.utc time.to_i - time.sec end |
#retrieve_and_delete_previous_span ⇒ Object
19 20 21 22 |
# File 'lib/heimdall_apm/vault.rb', line 19 def retrieve_and_delete_previous_span = - 60 @lock.synchronize { @spans.delete() } end |
#store_transaction_metrics(txn, metrics) ⇒ Object
24 25 26 |
# File 'lib/heimdall_apm/vault.rb', line 24 def store_transaction_metrics(txn, metrics) @lock.synchronize { current_span.add_point(txn, metrics) } end |