Class: ExoLogging::IntegrationFailure
- Inherits:
-
Object
- Object
- ExoLogging::IntegrationFailure
- Includes:
- Mongoid::Document, Mongoid::Timestamps
- Defined in:
- lib/exologging/integration_failure.rb
Constant Summary collapse
- @@app_name =
'Untitled'
Class Method Summary collapse
- .mk!(integration_id, url) ⇒ Object
- .mtbf(url, from = 0, mtbf_type = 'decaying') ⇒ Object
- .set_app_name(appname) ⇒ Object
Class Method Details
.mk!(integration_id, url) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/exologging/integration_failure.rb', line 21 def self.mk!(integration_id, url) x = IntegrationFailure.new x.name = @@app_name x.integration_id = integration_id x.url = url x.save! x end |
.mtbf(url, from = 0, mtbf_type = 'decaying') ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/exologging/integration_failure.rb', line 31 def self.mtbf(url, from=0, mtbf_type='decaying') from_time = ExoBasic::Timer.from_epoch(from).to_datetime failed_ts = IntegrationFailure.where(name: @@app_name, url: url, :created_at.gte => from_time) .map { |i| ExoBasic::Timer.to_epoch(i.created_at) } .to_a .sort ProviderFailure.mtbf_helper(failed_ts, mtbf_type) end |
.set_app_name(appname) ⇒ Object
17 18 19 |
# File 'lib/exologging/integration_failure.rb', line 17 def self.set_app_name(appname) @@app_name = appname end |