interferon 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/.gitignore +2 -0
  2. data/.travis.yml +8 -0
  3. data/README.md +2 -0
  4. data/lib/interferon/destinations/datadog.rb +1 -1
  5. data/lib/interferon/host_sources/optica.rb +13 -9
  6. data/lib/interferon/host_sources/optica_services.rb +12 -8
  7. data/lib/interferon/host_sources/test_host_source.rb +6 -0
  8. data/lib/interferon/version.rb +1 -1
  9. data/spec/fixtures/loaders/host_sources/test_host_source.rb +5 -0
  10. data/spec/fixtures/loaders/test_sources/order_test_source.rb +5 -0
  11. data/spec/fixtures/loaders/test_sources/test_source.rb +5 -0
  12. data/spec/fixtures/loaders2/test_sources/order_test_source.rb +5 -0
  13. data/spec/fixtures/loaders2/test_sources/secondary_source.rb +11 -0
  14. data/spec/fixtures/loaders2/test_sources/test_source.rb +11 -0
  15. data/spec/helpers/loader_helper.rb +13 -0
  16. data/spec/helpers/logging_helper.rb +12 -0
  17. data/spec/helpers/optica_helper.rb +110 -0
  18. data/spec/lib/interferon/host_sources/optica_services_spec.rb +60 -0
  19. data/spec/lib/interferon/host_sources/optica_spec.rb +30 -0
  20. data/spec/lib/interferon/loaders_spec.rb +96 -0
  21. data/spec/spec_helper.rb +7 -0
  22. metadata +43 -27
  23. checksums.yaml +0 -15
  24. data/groups/data.yaml +0 -11
  25. data/groups/dataeng.yaml +0 -4
  26. data/groups/datainfra.yaml +0 -10
  27. data/groups/devhap.yaml +0 -6
  28. data/groups/discover.yaml +0 -13
  29. data/groups/growth.yaml +0 -17
  30. data/groups/host.yaml +0 -12
  31. data/groups/internalproducts.yml +0 -13
  32. data/groups/logstash.yaml +0 -4
  33. data/groups/mobile.yaml +0 -17
  34. data/groups/pagerduty_sysops.yaml +0 -5
  35. data/groups/panda.yaml +0 -10
  36. data/groups/payments.yaml +0 -16
  37. data/groups/payments_finance.yaml +0 -8
  38. data/groups/prodinfra.yaml +0 -15
  39. data/groups/search.yaml +0 -10
  40. data/groups/security.yaml +0 -8
  41. data/groups/sre.yaml +0 -16
  42. data/groups/teamx.yaml +0 -8
  43. data/groups/tns.yaml +0 -14
  44. data/groups/tools.yml +0 -11
  45. data/script/convert.rb +0 -29
data/.gitignore CHANGED
@@ -4,6 +4,8 @@ config.yaml
4
4
  .*sw?
5
5
  .DS_Store
6
6
 
7
+ *.gem
8
+
7
9
  # Ruby env control
8
10
  .rvmrc*
9
11
  .ruby-version*
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ cache: bundler
3
+ script: bundle exec rspec
4
+ rvm:
5
+ - 1.9.3
6
+ - 2.1.5
7
+ - 2.2.1
8
+
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Interferon #
2
2
 
3
+ [![Build Status](https://travis-ci.org/airbnb/interferon.svg?branch=master)](https://travis-ci.org/airbnb/interferon)
4
+
3
5
  This repo contains the interferon gem.
4
6
  This gem enables you to store your alerts configuration in code.
5
7
  You should create your own repository, with a `Gemfile` which imports the interferon gem.
@@ -3,7 +3,7 @@ require 'set'
3
3
 
4
4
  module Interferon::Destinations
5
5
  class Datadog
6
- include Interferon::Logging
6
+ include ::Interferon::Logging
7
7
 
8
8
  attr_accessor :concurrency
9
9
  ALERT_KEY = 'This alert was created via the alerts framework'
@@ -3,7 +3,7 @@ require 'json'
3
3
 
4
4
  module Interferon::HostSources
5
5
  class Optica
6
- include Logging
6
+ include ::Interferon::Logging
7
7
 
8
8
  def initialize(options)
9
9
  raise ArgumentError, "missing host for optica source" \
@@ -14,14 +14,7 @@ module Interferon::HostSources
14
14
  end
15
15
 
16
16
  def list_hosts
17
- con = Net::HTTP.new(@host, @port)
18
- con.read_timeout = 60
19
- con.open_timeout = 60
20
-
21
- response = con.get('/')
22
- data = JSON::parse(response.body)
23
-
24
- return data['nodes'].map{|ip, host| {
17
+ return optica_data['nodes'].map{|ip, host| {
25
18
  :source => 'optica',
26
19
  :hostname => host['hostname'],
27
20
  :role => host['role'],
@@ -31,5 +24,16 @@ module Interferon::HostSources
31
24
  :owner_groups => host['ownership'] && host['ownership']['groups'] || [],
32
25
  }}
33
26
  end
27
+
28
+ def optica_data
29
+ @optica_data ||= begin
30
+ con = Net::HTTP.new(@host, @port)
31
+ con.read_timeout = 60
32
+ con.open_timeout = 60
33
+
34
+ response = con.get('/')
35
+ JSON::parse(response.body)
36
+ end
37
+ end
34
38
  end
35
39
  end
@@ -4,7 +4,7 @@ require 'set'
4
4
 
5
5
  module Interferon::HostSources
6
6
  class OpticaServices
7
- include Logging
7
+ include ::Interferon::Logging
8
8
 
9
9
  def initialize(options)
10
10
  raise ArgumentError, "missing host for optica source" \
@@ -15,14 +15,18 @@ module Interferon::HostSources
15
15
  @envs = options['environments'] || []
16
16
  end
17
17
 
18
- def list_hosts
19
- con = Net::HTTP.new(@host, @port)
20
- con.read_timeout = 60
21
- con.open_timeout = 60
18
+ def optica_data
19
+ @optica_data ||= begin
20
+ con = Net::HTTP.new(@host, @port)
21
+ con.read_timeout = 60
22
+ con.open_timeout = 60
22
23
 
23
- response = con.get('/')
24
- data = JSON::parse(response.body)
24
+ response = con.get('/')
25
+ JSON::parse(response.body)
26
+ end
27
+ end
25
28
 
29
+ def list_hosts
26
30
  services = Hash.new{ |h,service| h[service] = {
27
31
  :source => 'optica_services',
28
32
  :service => service,
@@ -34,7 +38,7 @@ module Interferon::HostSources
34
38
  :provider_machine_count => 0,
35
39
  }}
36
40
 
37
- data['nodes'].each do |ip, host|
41
+ optica_data['nodes'].each do |ip, host|
38
42
  next unless @envs.empty? or @envs.include?(host['environment'])
39
43
 
40
44
  # make it easier by initializing possibly-missing data to sane defaults
@@ -0,0 +1,6 @@
1
+ # we use this class to test dynamic loading in specs
2
+ module Interferon::HostSources
3
+ class TestHostSource
4
+ DIR = 'interferon'
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module Interferon
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,5 @@
1
+ module ::Interferon::HostSources
2
+ class TestHostSource
3
+ DIR = 'loaders'
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Interferon::TestSources
2
+ class OrderTestSource
3
+ DIR = 'loaders'
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Interferon::TestSources
2
+ class TestSource
3
+ DIR = 'loaders'
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Interferon::TestSources
2
+ class OrderTestSource
3
+ DIR = 'loaders2'
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+
2
+ module Interferon::TestSources
3
+ class SecondarySource
4
+ DIR = 'loaders2'
5
+
6
+ attr_accessor :testval
7
+ def initialize(options)
8
+ @testval = options['testval']
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Interferon::TestSources
2
+ class TestSource
3
+ DIR = 'loaders2'
4
+
5
+ attr_accessor :testval
6
+ def initialize(options)
7
+ @testval = options['testval']
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+
2
+ ### some helpers to make this work ###
3
+ # define the module we're working in
4
+ module ::Interferon::TestSources; end
5
+
6
+ # define a test loader we'll be using
7
+ class TestLoader < Interferon::DynamicLoader
8
+ def initialize_attributes
9
+ @loader_for = 'test fixtures'
10
+ @type_path = 'test_sources'
11
+ @module = ::Interferon::TestSources
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ # disable logging during spec runs
2
+ module Interferon::Logging
3
+ class EmptyLogger < StringIO
4
+ def write(input)
5
+ # do nothing
6
+ end
7
+ end
8
+
9
+ def self.configure_logger_for(clasname)
10
+ return Logger.new(EmptyLogger.new)
11
+ end
12
+ end
@@ -0,0 +1,110 @@
1
+ class OpticaHelper
2
+ def self.example_node_1
3
+ {
4
+ "ip" => "10.1.1.1",
5
+ "environment" => "production",
6
+ "role" => "role1",
7
+ "hostname" => "box1",
8
+ "uptime" => 37335310,
9
+ "az" => "us-east-1a",
10
+ "security_groups" => ["internal"],
11
+ "instance_type" => "m1.large",
12
+ "ami_id" => "ami-d9d6a6b0",
13
+ "failed" => false,
14
+ "roles" => ["role1"],
15
+ "recipes" => ["airbnb-base","cookbook1"],
16
+ "synapse_services" => ["service1","service2"],
17
+ "nerve_services" => [],
18
+ "ownership" => {
19
+ "people" => ["test_user@example.com"],
20
+ "groups" => ["admins"]
21
+ },
22
+ "converger" => "ben_hughes"
23
+ }
24
+ end
25
+
26
+ def self.example_node_2
27
+ {
28
+ "ip" => "10.1.1.2",
29
+ "environment" => "production",
30
+ "role" => "role2",
31
+ "hostname" => "box2",
32
+ "uptime" => 37335310,
33
+ "az" => "us-east-1b",
34
+ "security_groups" => ["internal"],
35
+ "instance_type" => "m1.large",
36
+ "ami_id" => "ami-d9d6a6b0",
37
+ "failed" => false,
38
+ "roles" => ["role2"],
39
+ "recipes" => ["airbnb-base","cookbook2"],
40
+ "synapse_services" => [],
41
+ "nerve_services" => ["service1"],
42
+ "ownership" => {
43
+ "people" => ["test_user@example.com"],
44
+ "groups" => ["admins"]
45
+ },
46
+ "converger" => "ben_hughes"
47
+ }
48
+ end
49
+
50
+ def self.example_node_3
51
+ {
52
+ "ip" => "10.1.1.3",
53
+ "environment" => "production",
54
+ "role" => "role3",
55
+ "hostname" => "box3",
56
+ "uptime" => 37335310,
57
+ "az" => "us-east-1b",
58
+ "security_groups" => ["internal"],
59
+ "instance_type" => "m1.large",
60
+ "ami_id" => "ami-d9d6a6b0",
61
+ "failed" => false,
62
+ "roles" => ["role3"],
63
+ "recipes" => ["airbnb-base","cookbook3"],
64
+ "synapse_services" => [],
65
+ "nerve_services" => ["service2"],
66
+ "converger" => "ben_hughes"
67
+ }
68
+ end
69
+
70
+ def self.example_node_4
71
+ {
72
+ "ip" => "10.1.1.4",
73
+ "environment" => "production",
74
+ "role" => "role4",
75
+ "hostname" => "box4",
76
+ "uptime" => 37335310,
77
+ "az" => "us-east-1e",
78
+ "security_groups" => ["internal"],
79
+ "instance_type" => "m1.large",
80
+ "ami_id" => "ami-d9d6a6b0",
81
+ "failed" => false,
82
+ "roles" => ["role4"],
83
+ "recipes" => ["airbnb-base","cookbook4"],
84
+ "synapse_services" => [],
85
+ "nerve_services" => ["service1"],
86
+ "ownership" => {
87
+ "people" => ["test_user2@example.com"],
88
+ "groups" => ["engineers"]
89
+ },
90
+ "converger" => "ben_hughes"
91
+ }
92
+ end
93
+
94
+ def self.example_nodes
95
+ {
96
+ example_node_1['ip'] => example_node_1,
97
+ example_node_2['ip'] => example_node_2,
98
+ example_node_3['ip'] => example_node_3,
99
+ example_node_4['ip'] => example_node_4,
100
+ }
101
+ end
102
+
103
+ def self.example_output
104
+ {
105
+ 'examined' => 3,
106
+ 'returned' => 3,
107
+ 'nodes' => example_nodes
108
+ }
109
+ end
110
+ end
@@ -0,0 +1,60 @@
1
+ require 'spec_helper'
2
+ require 'helpers/optica_helper'
3
+ require 'interferon/host_sources/optica_services'
4
+
5
+ describe Interferon::HostSources::OpticaServices do
6
+ let(:optica_services) { Interferon::HostSources::OpticaServices.new({'host'=>'127.0.0.1'}) }
7
+
8
+ describe '.list_hosts' do
9
+ before do
10
+ expect(optica_services).to receive(:optica_data).and_return(OpticaHelper.example_output)
11
+ end
12
+
13
+ let(:list) { optica_services.list_hosts }
14
+ let(:service1) { list.select{|s| s[:service] == 'service1'}[0] }
15
+ let(:service2) { list.select{|s| s[:service] == 'service2'}[0] }
16
+
17
+ it 'returns both of the services we know about' do
18
+ expect(list.length).to eq(2)
19
+ end
20
+
21
+ it 'includes all required attributes with each hostinfo' do
22
+ list.each do |service|
23
+ expect(service).to include(
24
+ :source,
25
+ :service,
26
+ :owners,
27
+ :owner_groups,
28
+ :consumer_roles,
29
+ :consumer_machine_count,
30
+ :provider_machine_count,
31
+ )
32
+ end
33
+ end
34
+
35
+ it 'does not barf if ownership info is missing' do
36
+ expect(service2[:owners]).to be_empty
37
+ expect(service2[:owner_groups]).to be_empty
38
+ end
39
+
40
+ it 'knows that box1 is using both of the services' do
41
+ expect(list).to satisfy{|l| l.all?{
42
+ |s| s[:consumer_machine_count] == 1 && s[:consumer_roles] == ['role1']}}
43
+ end
44
+
45
+ it 'knows that service1 is provided by two machines' do
46
+ expect(service1[:provider_machine_count]).to eq(2)
47
+ end
48
+
49
+ it 'merges the ownership for all machines that provide service1' do
50
+ all_owners = OpticaHelper.example_node_2['ownership']['people'] +
51
+ OpticaHelper.example_node_4['ownership']['people']
52
+ all_owner_groups = OpticaHelper.example_node_2['ownership']['groups'] +
53
+ OpticaHelper.example_node_4['ownership']['groups']
54
+
55
+ expect(service1[:owners]).to contain_exactly(*all_owners)
56
+ expect(service1[:owner_groups]).to contain_exactly(*all_owner_groups)
57
+ end
58
+ end
59
+ end
60
+
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+ require 'helpers/optica_helper'
3
+ require 'interferon/host_sources/optica'
4
+
5
+ describe Interferon::HostSources::Optica do
6
+ let(:optica) { Interferon::HostSources::Optica.new({'host'=>'127.0.0.1'}) }
7
+
8
+ describe '.list_hosts' do
9
+ before do
10
+ expect(optica).to receive(:optica_data).and_return(OpticaHelper.example_output)
11
+ end
12
+
13
+ let(:list) { optica.list_hosts }
14
+
15
+ it 'returns all of the hosts that optica provides' do
16
+ expect(list.length).to eq(OpticaHelper.example_nodes.length)
17
+ end
18
+
19
+ it 'includes all required attributes with each hostinfo' do
20
+ list.each do |host|
21
+ expect(host).to include(:source, :hostname, :role, :environment, :owners, :owner_groups)
22
+ end
23
+ end
24
+
25
+ it 'does not barf if ownership info is missing' do
26
+ expect(list).to satisfy{|l| l.one?{|h| h[:owners].empty? && h[:owner_groups].empty?}}
27
+ end
28
+ end
29
+ end
30
+
@@ -0,0 +1,96 @@
1
+ require "spec_helper"
2
+ require "helpers/loader_helper"
3
+
4
+ describe 'DynamicLoader' do
5
+ describe 'custom class retrieval' do
6
+ it 'properly loads a custom test source of given type' do
7
+ test_loader = TestLoader.new(['./spec/fixtures/loaders'])
8
+ expect(test_loader.get_klass('test_source')).to be_a(Class)
9
+ end
10
+
11
+ it 'throws an ArgumentError when the type cannot be found' do
12
+ test_loader = TestLoader.new(['./spec/fixtures/loaders'])
13
+ expect{test_loader.get_klass('unknown_source')}.to raise_error(ArgumentError)
14
+ end
15
+
16
+ it 'looks at custom paths in order' do
17
+ test_loader = TestLoader.new(['./spec/fixtures/loaders', '/spec/fixtures/loaders2'])
18
+ expect(test_loader.get_klass('order_test_source')::DIR).to eq('loaders')
19
+
20
+ test_loader = TestLoader.new(['./spec/fixtures/loaders2', '/spec/fixtures/loaders'])
21
+ expect(test_loader.get_klass('order_test_source')::DIR).to eq('loaders2')
22
+ end
23
+
24
+ it 'eventually looks at all paths' do
25
+ test_loader = TestLoader.new(['./spec/fixtures/loaders', './spec/fixtures/loaders2'])
26
+ expect(test_loader.get_klass('secondary_source')::DIR).to eq('loaders2')
27
+ end
28
+ end
29
+
30
+ describe 'standard class retrieval' do
31
+ it 'loads a class from a specified location when possible' do
32
+ loader = Interferon::HostSourcesLoader.new(['./spec/fixtures/loaders'])
33
+ klass = loader.get_klass('test_host_source')
34
+
35
+ expect(klass::DIR).to eq('loaders')
36
+ end
37
+
38
+ it 'falls back to internal classes' do
39
+ loader = Interferon::HostSourcesLoader.new(['./spec/fixtures/loaders2'])
40
+ klass = loader.get_klass('test_host_source')
41
+
42
+ expect(klass::DIR).to eq('interferon')
43
+ end
44
+ end
45
+
46
+ describe 'get_all' do
47
+ let(:loader) { TestLoader.new(['./spec/fixtures/loaders2']) }
48
+ before do
49
+ require './spec/fixtures/loaders2/test_sources/test_source'
50
+ require './spec/fixtures/loaders2/test_sources/secondary_source'
51
+ end
52
+
53
+ it 'returns an instance for each enabled source' do
54
+ instances = loader.get_all(
55
+ [
56
+ {'type' => 'test_source', 'enabled' => true, 'options' => {}},
57
+ {'type' => 'secondary_source', 'enabled' => true, 'options' => {}},
58
+ ])
59
+
60
+ expect(instances.count).to eq(2)
61
+ expect(instances).to contain_exactly(
62
+ an_instance_of(Interferon::TestSources::TestSource),
63
+ an_instance_of(Interferon::TestSources::SecondarySource))
64
+ end
65
+
66
+ it 'ignores non-enabled sources' do
67
+ instances = loader.get_all(
68
+ [
69
+ {'type' => 'test_source', 'enabled' => true, 'options' => {}},
70
+ {'type' => 'secondary_source', 'enabled' => false, 'options' => {}},
71
+ ])
72
+
73
+ expect(instances.count).to eq(1)
74
+ expect(instances).to contain_exactly(an_instance_of(Interferon::TestSources::TestSource))
75
+ end
76
+
77
+ it 'ignores sources with no type set' do
78
+ instances = loader.get_all(
79
+ [
80
+ {'type' => 'test_source', 'enabled' => true, 'options' => {}},
81
+ {'enabled' => true, 'options' => {}},
82
+ ])
83
+
84
+ expect(instances.count).to eq(1)
85
+ expect(instances).to contain_exactly(an_instance_of(Interferon::TestSources::TestSource))
86
+ end
87
+
88
+ it 'properly sets options on classes it instantiates' do
89
+ instances = loader.get_all(
90
+ [{'type' => 'test_source', 'enabled' => true, 'options' => {'testval' => 5}}])
91
+
92
+ expect(instances[0].testval).to eq(5)
93
+ end
94
+ end
95
+
96
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,9 @@
1
1
  # This file was generated by the `rspec --init` command.
2
2
 
3
+ # require the thing we're testing
4
+ require 'interferon'
5
+ require 'helpers/logging_helper.rb'
6
+
3
7
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
4
8
  RSpec.configure do |config|
5
9
  config.expect_with :rspec do |expectations|
@@ -59,4 +63,7 @@ RSpec.configure do |config|
59
63
  # test failures related to randomization by passing the same `--seed` value
60
64
  # as the one that triggered the failure.
61
65
  Kernel.srand config.seed
66
+
67
+ # allow using the DSL without prefacing `Rspec` to everything
68
+ config.expose_dsl_globally = true
62
69
  end
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: interferon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Igor Serebryany
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-03-16 00:00:00.000000000 Z
12
+ date: 2015-05-07 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: dogapi
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
@@ -23,6 +25,7 @@ dependencies:
23
25
  type: :runtime
24
26
  prerelease: false
25
27
  version_requirements: !ruby/object:Gem::Requirement
28
+ none: false
26
29
  requirements:
27
30
  - - ~>
28
31
  - !ruby/object:Gem::Version
@@ -33,6 +36,7 @@ dependencies:
33
36
  - !ruby/object:Gem::Dependency
34
37
  name: aws-sdk
35
38
  requirement: !ruby/object:Gem::Requirement
39
+ none: false
36
40
  requirements:
37
41
  - - ~>
38
42
  - !ruby/object:Gem::Version
@@ -43,6 +47,7 @@ dependencies:
43
47
  type: :runtime
44
48
  prerelease: false
45
49
  version_requirements: !ruby/object:Gem::Requirement
50
+ none: false
46
51
  requirements:
47
52
  - - ~>
48
53
  - !ruby/object:Gem::Version
@@ -53,6 +58,7 @@ dependencies:
53
58
  - !ruby/object:Gem::Dependency
54
59
  name: dogstatsd-ruby
55
60
  requirement: !ruby/object:Gem::Requirement
61
+ none: false
56
62
  requirements:
57
63
  - - ~>
58
64
  - !ruby/object:Gem::Version
@@ -63,6 +69,7 @@ dependencies:
63
69
  type: :runtime
64
70
  prerelease: false
65
71
  version_requirements: !ruby/object:Gem::Requirement
72
+ none: false
66
73
  requirements:
67
74
  - - ~>
68
75
  - !ruby/object:Gem::Version
@@ -73,6 +80,7 @@ dependencies:
73
80
  - !ruby/object:Gem::Dependency
74
81
  name: rspec
75
82
  requirement: !ruby/object:Gem::Requirement
83
+ none: false
76
84
  requirements:
77
85
  - - ~>
78
86
  - !ruby/object:Gem::Version
@@ -80,6 +88,7 @@ dependencies:
80
88
  type: :development
81
89
  prerelease: false
82
90
  version_requirements: !ruby/object:Gem::Requirement
91
+ none: false
83
92
  requirements:
84
93
  - - ~>
85
94
  - !ruby/object:Gem::Version
@@ -87,6 +96,7 @@ dependencies:
87
96
  - !ruby/object:Gem::Dependency
88
97
  name: pry
89
98
  requirement: !ruby/object:Gem::Requirement
99
+ none: false
90
100
  requirements:
91
101
  - - ~>
92
102
  - !ruby/object:Gem::Version
@@ -94,6 +104,7 @@ dependencies:
94
104
  type: :development
95
105
  prerelease: false
96
106
  version_requirements: !ruby/object:Gem::Requirement
107
+ none: false
97
108
  requirements:
98
109
  - - ~>
99
110
  - !ruby/object:Gem::Version
@@ -107,33 +118,13 @@ extensions: []
107
118
  extra_rdoc_files: []
108
119
  files:
109
120
  - .gitignore
121
+ - .travis.yml
110
122
  - Gemfile
111
123
  - Gemfile.lock
112
124
  - LICENSE
113
125
  - README.md
114
126
  - bin/interferon
115
127
  - config.example.yaml
116
- - groups/data.yaml
117
- - groups/dataeng.yaml
118
- - groups/datainfra.yaml
119
- - groups/devhap.yaml
120
- - groups/discover.yaml
121
- - groups/growth.yaml
122
- - groups/host.yaml
123
- - groups/internalproducts.yml
124
- - groups/logstash.yaml
125
- - groups/mobile.yaml
126
- - groups/pagerduty_sysops.yaml
127
- - groups/panda.yaml
128
- - groups/payments.yaml
129
- - groups/payments_finance.yaml
130
- - groups/prodinfra.yaml
131
- - groups/search.yaml
132
- - groups/security.yaml
133
- - groups/sre.yaml
134
- - groups/teamx.yaml
135
- - groups/tns.yaml
136
- - groups/tools.yml
137
128
  - interferon.gemspec
138
129
  - lib/interferon.rb
139
130
  - lib/interferon/alert.rb
@@ -145,35 +136,60 @@ files:
145
136
  - lib/interferon/host_sources/aws_rds.rb
146
137
  - lib/interferon/host_sources/optica.rb
147
138
  - lib/interferon/host_sources/optica_services.rb
139
+ - lib/interferon/host_sources/test_host_source.rb
148
140
  - lib/interferon/loaders.rb
149
141
  - lib/interferon/logging.rb
150
142
  - lib/interferon/version.rb
151
- - script/convert.rb
152
143
  - script/pre-commit
144
+ - spec/fixtures/loaders/host_sources/test_host_source.rb
145
+ - spec/fixtures/loaders/test_sources/order_test_source.rb
146
+ - spec/fixtures/loaders/test_sources/test_source.rb
147
+ - spec/fixtures/loaders2/test_sources/order_test_source.rb
148
+ - spec/fixtures/loaders2/test_sources/secondary_source.rb
149
+ - spec/fixtures/loaders2/test_sources/test_source.rb
150
+ - spec/helpers/loader_helper.rb
151
+ - spec/helpers/logging_helper.rb
152
+ - spec/helpers/optica_helper.rb
153
+ - spec/lib/interferon/host_sources/optica_services_spec.rb
154
+ - spec/lib/interferon/host_sources/optica_spec.rb
155
+ - spec/lib/interferon/loaders_spec.rb
153
156
  - spec/spec_helper.rb
154
157
  homepage: https://www.github.com/airbnb/interferon
155
158
  licenses:
156
159
  - MIT
157
- metadata: {}
158
160
  post_install_message:
159
161
  rdoc_options: []
160
162
  require_paths:
161
163
  - lib
162
164
  required_ruby_version: !ruby/object:Gem::Requirement
165
+ none: false
163
166
  requirements:
164
167
  - - ! '>='
165
168
  - !ruby/object:Gem::Version
166
169
  version: '0'
167
170
  required_rubygems_version: !ruby/object:Gem::Requirement
171
+ none: false
168
172
  requirements:
169
173
  - - ! '>='
170
174
  - !ruby/object:Gem::Version
171
175
  version: '0'
172
176
  requirements: []
173
177
  rubyforge_project:
174
- rubygems_version: 2.4.6
178
+ rubygems_version: 1.8.23.2
175
179
  signing_key:
176
- specification_version: 4
180
+ specification_version: 3
177
181
  summary: ': Store metrics alerts in code!'
178
182
  test_files:
183
+ - spec/fixtures/loaders/host_sources/test_host_source.rb
184
+ - spec/fixtures/loaders/test_sources/order_test_source.rb
185
+ - spec/fixtures/loaders/test_sources/test_source.rb
186
+ - spec/fixtures/loaders2/test_sources/order_test_source.rb
187
+ - spec/fixtures/loaders2/test_sources/secondary_source.rb
188
+ - spec/fixtures/loaders2/test_sources/test_source.rb
189
+ - spec/helpers/loader_helper.rb
190
+ - spec/helpers/logging_helper.rb
191
+ - spec/helpers/optica_helper.rb
192
+ - spec/lib/interferon/host_sources/optica_services_spec.rb
193
+ - spec/lib/interferon/host_sources/optica_spec.rb
194
+ - spec/lib/interferon/loaders_spec.rb
179
195
  - spec/spec_helper.rb
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZjQ3ZDE1ZGY2YjRkYTQ1NjU4NDhjNjlhNTc5NzgwMTQzNmQ5MTJmYg==
5
- data.tar.gz: !binary |-
6
- YzNiZjUwMGU0NjNjMGQwN2U3YTNkOGUxYTRlZjkwNDE5ODk0ZWZjMg==
7
- SHA512:
8
- metadata.gz: !binary |-
9
- ZmFkMDI4YjQ3NjQxYTU3MGQ5ZTZhYzZiMjE0MjEwMTFlMTMzMGJhMWEwM2Iw
10
- YzcxYjUwMDk3YTI4ZTI0MWY4NTg0MmYzOWYwODViNzRmNzk5MTgxNThmMjY3
11
- N2FlOTE0YTQ2M2M1ZThhNTEzYzhkZGNlMWNiODlmYWI3ZGEzYzc=
12
- data.tar.gz: !binary |-
13
- OGU0NDM3ZjU1NmNlNTNiMTliZDcyN2RiZTM5MzBhY2MxZDliZTJiMzAyYjhk
14
- N2E0ZjI2MWRiYmEyZDk2YzdiY2RlN2FiNDlhNzU1OThiYTdmNDM3YWUwZjFj
15
- ZWMxN2VmYjYxOGVlODM4NDRlOGIzNzViZDEwMWM3ZTQyYjYzYjQ=
data/groups/data.yaml DELETED
@@ -1,11 +0,0 @@
1
- ---
2
- # deprecated; use datainfra
3
- name: data
4
- people:
5
- - andy.kram@airbnb.com
6
- - brenden.matthews@airbnb.com
7
- - james.mayfield@airbnb.com
8
- - paul.yang@airbnb.com
9
- - krishna.puttaswamy@airbnb.com
10
- - swaroop.jagadish@airbnb.com
11
- - wensheng.hua@airbnb.com
data/groups/dataeng.yaml DELETED
@@ -1,4 +0,0 @@
1
- ---
2
- name: dataeng
3
- people:
4
- - maxime.beauchemin@airbnb.com
@@ -1,10 +0,0 @@
1
- ---
2
- name: datainfra
3
- people:
4
- - andy.kram@airbnb.com
5
- - brenden.matthews@airbnb.com
6
- - james.mayfield@airbnb.com
7
- - paul.yang@airbnb.com
8
- - krishna.puttaswamy@airbnb.com
9
- - swaroop.jagadish@airbnb.com
10
- - wensheng.hua@airbnb.com
data/groups/devhap.yaml DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- name: devhap
3
- people:
4
- - topher@airbnb.com
5
- - igor.serebryany@airbnb.com
6
- - matt.baker@airbnb.com
data/groups/discover.yaml DELETED
@@ -1,13 +0,0 @@
1
- ---
2
- name: discover
3
- people:
4
- - frank.lin@airbnb.com
5
- - lu.cheng@airbnb.com
6
- - naseem@airbnb.com
7
- - phillippe.siclait@airbnb.com
8
- - surabhi.gupta@airbnb.com
9
- - horace.ko@airbnb.com
10
- - tao.xu@airbnb.com
11
- - josh.perez@airbnb.com
12
- - yanxin.shi@airbnb.com
13
- - tao.tao@airbnb.com
data/groups/growth.yaml DELETED
@@ -1,17 +0,0 @@
1
- ---
2
- name: growth
3
- people:
4
- - tanya.breshears@airbnb.com
5
- - amy.wibowo@airbnb.com
6
- - jimmy.tang@airbnb.com
7
- - mona@airbnb.com
8
- - roman.fuchs@airbnb.com
9
- - jason@airbnb.com
10
- - jason.bosinoff@airbnb.com
11
- - henry.cai@airbnb.com
12
- - rahul.agrawal@airbnb.com
13
- - song.xie@airbnb.com
14
- - yanxin.shi@airbnb.com
15
- - nathaniel.weinman@airbnb.com
16
- - fengming.wang@airbnb.com
17
- - winnie.wang@airbnb.com
data/groups/host.yaml DELETED
@@ -1,12 +0,0 @@
1
- ---
2
- name: host
3
- people:
4
- - alanna.scott@airbnb.com
5
- - james.ostrowski@airbnb.com
6
- - barbara.raitz@airbnb.com
7
- - yat.choi@airbnb.com
8
- - edmund.ye@airbnb.com
9
- - spike@airbnb.com
10
- - raph@airbnb.com
11
- - jessica.ho@airbnb.com
12
- - trunal.bhanse@airbnb.com
@@ -1,13 +0,0 @@
1
- ---
2
- name: internalproducts
3
- people:
4
- - alvin.sng@airbnb.com
5
- - emre.ozdemir@airbnb.com
6
- - phil.busby@airbnb.com
7
- - adrian.wisernig@airbnb.com
8
- - bekki.jam@airbnb.com
9
- - jujhaar.singh@airbnb.com
10
- - jessica.toy@airbnb.com
11
- - james.nichols@airbnb.com
12
- - harry@airbnb.com
13
- - davide.cerri@airbnb.com
data/groups/logstash.yaml DELETED
@@ -1,4 +0,0 @@
1
- ---
2
- name: logstash
3
- people:
4
- - jon.tai@airbnb.com
data/groups/mobile.yaml DELETED
@@ -1,17 +0,0 @@
1
- ---
2
- name: mobile
3
- people:
4
- - arthur.pang@airbnb.com
5
- - brandon.withrow@airbnb.com
6
- - youssef.francis@airbnb.com
7
- - zane.claes@airbnb.com
8
- - ian.pappas@airbnb.com
9
- - xiao.pan@airbnb.com
10
- - alex.davis@airbnb.com
11
- - nick.adams@airbnb.com
12
- - carol.leung@airbnb.com
13
- - geobio.boo@airbnb.com
14
- - eric.petzel@airbnb.com
15
- - christian.deonier@airbnb.com
16
- - michael.potter@airbnb.com
17
- - sean.abraham@airbnb.com
@@ -1,5 +0,0 @@
1
- ---
2
- name: pagerduty_sysops
3
- people:
4
- - pagerduty-sysops
5
- - sysops@airbnb.com
data/groups/panda.yaml DELETED
@@ -1,10 +0,0 @@
1
- # PandA is Pricing and Availability team under marketplace.
2
- ---
3
- name: panda
4
- people:
5
- - fenglin.liao@airbnb.com
6
- - li.zhang@airbnb.com
7
- - spencer.demars@airbnb.com
8
- - kim.pham@airbnb.com
9
- - shao.liu@airbnb.com
10
- - hector.yee@airbnb.com
data/groups/payments.yaml DELETED
@@ -1,16 +0,0 @@
1
- ---
2
- name: payments
3
- people:
4
- - allen.kerr@airbnb.com
5
- - ian@airbnb.com
6
- - john.terenzio@airbnb.com
7
- - joseph.sofaer@airbnb.com
8
- - josh.lee@airbnb.com
9
- - juliusz.gonera@airbnb.com
10
- - karen.kim@airbnb.com
11
- - kevin.sun@airbnb.com
12
- - lou.kosak@airbnb.com
13
- - michel.weksler@airbnb.com
14
- - mike.lewis@airbnb.com
15
- - tao.cui@airbnb.com
16
- - varun.pai@airbnb.com
@@ -1,8 +0,0 @@
1
- ---
2
- name: payments_finance
3
- people:
4
- - alice.liang@airbnb.com
5
- - allen.kerr@airbnb.com
6
- - josh.lee@airbnb.com
7
- - mike.lewis@airbnb.com
8
- - tao.cui@airbnb.com
@@ -1,15 +0,0 @@
1
- ---
2
- name: prodinfra
3
- people:
4
- - alexis.midon@airbnb.com
5
- - ben.hughes@airbnb.com
6
- - jon.tai@airbnb.com
7
- - joseph.sofaer@airbnb.com
8
- - kai.liu@airbnb.com
9
- - kevin.rice@airbnb.com
10
- - nija.mashruwala@airbnb.com
11
- - philip.snowberger@airbnb.com
12
- - rahul.iyer@airbnb.com
13
- - sonic.wang@airbnb.com
14
- - willie.yao@airbnb.com
15
-
data/groups/search.yaml DELETED
@@ -1,10 +0,0 @@
1
- ---
2
- name: search
3
- people:
4
- - maxim.charkov@airbnb.com
5
- - fenglin.liao@airbnb.com
6
- - li.zhang@airbnb.com
7
- - mousom.gupta@airbnb.com
8
- - spencer.demars@airbnb.com
9
- - xiang.xiao@airbnb.com
10
- - will.moss@airbnb.com
data/groups/security.yaml DELETED
@@ -1,8 +0,0 @@
1
- ---
2
- name: security
3
- people:
4
- - jeff@airbnb.com
5
- - jennifer.rice@airbnb.com
6
- - kevin.nguyen@airbnb.com
7
- - philip.snowberger@airbnb.com
8
- - samuel.zhu@airbnb.com
data/groups/sre.yaml DELETED
@@ -1,16 +0,0 @@
1
- ---
2
- # deprecated; use prodinfra
3
- name: sre
4
- people:
5
- - alexis.midon@airbnb.com
6
- - ben.hughes@airbnb.com
7
- - jon.tai@airbnb.com
8
- - joseph.sofaer@airbnb.com
9
- - kai.liu@airbnb.com
10
- - kevin.rice@airbnb.com
11
- - nija.mashruwala@airbnb.com
12
- - philip.snowberger@airbnb.com
13
- - rahul.iyer@airbnb.com
14
- - sonic.wang@airbnb.com
15
- - willie.yao@airbnb.com
16
-
data/groups/teamx.yaml DELETED
@@ -1,8 +0,0 @@
1
- ---
2
- name: teamx
3
- people:
4
- - lu.cheng@airbnb.com
5
- - surabhi.gupta@airbnb.com
6
- - naseem@airbnb.com
7
- - phillippe.siclait@airbnb.com
8
-
data/groups/tns.yaml DELETED
@@ -1,14 +0,0 @@
1
- ---
2
- name: tns
3
- people:
4
- - alok.gupta@airbnb.com
5
- - anish.muppalaneni@airbnb.com
6
- - dmitry.alexeenko@airbnb.com
7
- - eric.levine@airbnb.com
8
- - freddy.chen@airbnb.com
9
- - jerry.luan@airbnb.com
10
- - justin.chen@airbnb.com
11
- - sean.albito@airbnb.com
12
- - siddharth.kar@airbnb.com
13
- - tony.wen@airbnb.com
14
- - lee.zhang@airbnb.com
data/groups/tools.yml DELETED
@@ -1,11 +0,0 @@
1
- ---
2
- # deprecated; use internalproducts
3
- name: tools
4
- people:
5
- - alvin.sng@airbnb.com
6
- - emre.ozdemir@airbnb.com
7
- - phil.busby@airbnb.com
8
- - adrian.wisernig@airbnb.com
9
- - bekki.jam@airbnb.com
10
- - jujhaar.singh@airbnb.com
11
- - jessica.toy@airbnb.com
data/script/convert.rb DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'json'
4
- require 'yaml'
5
-
6
- script_dir = File.dirname(File.expand_path __FILE__)
7
- alerts_dir = File.join(script_dir, '..', 'alerts')
8
-
9
- Dir.glob(File.join(alerts_dir, '*.json')) do |alert_file|
10
- alert = JSON::parse(File.read(alert_file))
11
-
12
- # convert old to new filters
13
- alert['filter'] ||= {}
14
- %w{role host}.each do |field|
15
- %w{included excluded}.each do |type|
16
- old_field = "#{type}_#{field}s"
17
- if alert['filter'].include?(old_field)
18
- alert['filter'][field] ||= {}
19
- alert['filter'][field][type] = alert['filter'][old_field]
20
- alert['filter'].delete(old_field)
21
- end
22
- end
23
- end
24
-
25
- # write out new filter file
26
- new_name = alert_file.chomp(File.extname(alert_file)) + ".yaml"
27
- File.write(new_name, YAML.dump(alert))
28
- File.delete(alert_file)
29
- end