flapjack 1.4.0 → 1.5.0rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/features/notification_rules.feature +16 -4
- data/features/steps/events_steps.rb +7 -5
- data/lib/flapjack.rb +2 -2
- data/lib/flapjack/data/entity.rb +4 -4
- data/lib/flapjack/data/notification.rb +20 -15
- data/lib/flapjack/gateways/jsonapi/check_presenter.rb +2 -0
- data/lib/flapjack/gateways/jsonapi/metrics_methods.rb +37 -6
- data/lib/flapjack/version.rb +1 -1
- data/spec/service_consumers/pact_helper.rb +1 -1
- data/spec/service_consumers/pacts/flapjack-diner_v1.0.json +2004 -1817
- data/spec/service_consumers/provider_states_for_flapjack-diner.rb +68 -1
- metadata +4 -4
@@ -353,4 +353,71 @@ Pact.provider_states_for "flapjack-diner" do
|
|
353
353
|
end
|
354
354
|
end
|
355
355
|
|
356
|
-
|
356
|
+
provider_state "flapjack has a simplistic check freshness distribution" do
|
357
|
+
set_up do
|
358
|
+
redis = Flapjack::Gateways::JSONAPI.instance_variable_get('@redis')
|
359
|
+
check_freshness_data = {
|
360
|
+
:from_0_to_60 => 0,
|
361
|
+
:from_60_to_300 => 1,
|
362
|
+
:from_300_to_900 => 2,
|
363
|
+
:from_900_to_3600 => 3,
|
364
|
+
:from_3600_to_∞ => 4
|
365
|
+
}
|
366
|
+
entity = Flapjack::Data::Entity.find_by_name('sally', :create => true, :redis => redis)
|
367
|
+
|
368
|
+
checks = {
|
369
|
+
"check 1" => 61,
|
370
|
+
"check 2" => 301,
|
371
|
+
"check 3" => 301,
|
372
|
+
"check 4" => 901,
|
373
|
+
"check 5" => 901,
|
374
|
+
"check 6" => 901,
|
375
|
+
"check 7" => 3601,
|
376
|
+
"check 8" => 3601,
|
377
|
+
"check 9" => 3601,
|
378
|
+
"check 10" => 3601,
|
379
|
+
}
|
380
|
+
checks.each_pair {|check_name, age|
|
381
|
+
check = Flapjack::Data::EntityCheck.new(entity, check_name, :redis => redis)
|
382
|
+
check.update_state(Flapjack::Data::EntityCheck::STATE_OK, :timestamp => Time.new.to_i - age)
|
383
|
+
}
|
384
|
+
end
|
385
|
+
|
386
|
+
tear_down do
|
387
|
+
Flapjack::Gateways::JSONAPI.instance_variable_get('@logger').messages.clear
|
388
|
+
redis = Flapjack::Gateways::JSONAPI.instance_variable_get('@redis')
|
389
|
+
redis.flushdb
|
390
|
+
end
|
391
|
+
end
|
392
|
+
|
393
|
+
provider_state "flapjack has processed 0 ok, 1 failure, 2 ack, and 3 invalid events with 4 on the queue" do
|
394
|
+
set_up do
|
395
|
+
redis = Flapjack::Gateways::JSONAPI.instance_variable_get('@redis')
|
396
|
+
failure_event = {
|
397
|
+
'type' => 'service',
|
398
|
+
'state' => 'critical',
|
399
|
+
'summary' => '50% packet loss',
|
400
|
+
'entity' => 'foo-app-01.example',
|
401
|
+
'check' => 'ping'
|
402
|
+
}
|
403
|
+
|
404
|
+
# fake out the metrics
|
405
|
+
redis.hmset('event_counters',
|
406
|
+
'all' , 6,
|
407
|
+
'ok' , 0,
|
408
|
+
'failure' , 1,
|
409
|
+
'action' , 2,
|
410
|
+
'invalid' , 3
|
411
|
+
)
|
412
|
+
|
413
|
+
4.times{ redis.lpush('events', Flapjack.dump_json(failure_event)) }
|
414
|
+
end
|
415
|
+
|
416
|
+
tear_down do
|
417
|
+
Flapjack::Gateways::JSONAPI.instance_variable_get('@logger').messages.clear
|
418
|
+
redis = Flapjack::Gateways::JSONAPI.instance_variable_get('@redis')
|
419
|
+
redis.flushdb
|
420
|
+
end
|
421
|
+
end
|
422
|
+
|
423
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flapjack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lindsay Holmwood
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2015-03-
|
14
|
+
date: 2015-03-30 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: dante
|
@@ -635,9 +635,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
635
635
|
version: '0'
|
636
636
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
637
637
|
requirements:
|
638
|
-
- - "
|
638
|
+
- - ">"
|
639
639
|
- !ruby/object:Gem::Version
|
640
|
-
version:
|
640
|
+
version: 1.3.1
|
641
641
|
requirements: []
|
642
642
|
rubyforge_project:
|
643
643
|
rubygems_version: 2.4.5
|