eye-patch 0.4.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a4a4c2194571cd788cba6650db44580fdf47ee6
4
- data.tar.gz: ae65616ae36a62d09af62d105311f9d9e014ec90
3
+ metadata.gz: 16d29dc2372ba20e07bfd7eea3f1c6ae3005bc2f
4
+ data.tar.gz: b38447b91f606f2f63e5f2996f65936772e557b3
5
5
  SHA512:
6
- metadata.gz: 75797f8fbd012a2a988b0ff9e8f0d824024de72fc94bb21f411c2a0f9ee4b01649f2a825b74834f22050d39d4c188afb824da9c2c6433f2d0914d23db07efb30
7
- data.tar.gz: b22cfb202162b8ec5dd920db77ac6029560f0277cc5c180eae08ebc516e9c0edfa5828ba158d838181b3bbdb4d078c4a5d85c524e1abf7fafc878eb15bdf21d4
6
+ metadata.gz: c22c2b8998fe150e7e723db157856f560864879ff13f3dac629f5f8b1c3c27d9705bb76b336b8afa95af1d2134281b0a2bc85c883a72005d83bd6433381b4e9a
7
+ data.tar.gz: 401018a19d34a3638d94af72f34a906a8a8abd69fefd383c4a7888cbf66488a8ba805c2cfe5e63c727379b7fc21ae8ba6acec21ea836e0acac32d0e5c55a9af7
data/README.md CHANGED
@@ -30,9 +30,9 @@ Or install it yourself as:
30
30
 
31
31
  Note that SES support will only be provided if a necessary gem is installed on the system.
32
32
 
33
- `Eye::Patch` supports 2 different SES-backed gems:
33
+ `Eye::Patch` supports 2 different SES-backed gems, and also the datadog gem:
34
34
 
35
- 1. aws-ses
35
+ 1. aws-ses gem
36
36
 
37
37
  **Deprecated**: The `aws-sdk-ses` gem is recommended in place of aws-ses, as aws-ses hasn't been maintained in years.
38
38
 
@@ -50,7 +50,7 @@ If the [`aws-ses`](https://github.com/drewblas/aws-ses) gem is available on the
50
50
  access_key_id: Your+AWS+Access+Key+ID
51
51
  secret_access_key: Your+AWS+Secret+Access+Key
52
52
 
53
- 2. aws-sdk/aws-sdk-ses
53
+ 2. aws-sdk/aws-sdk-ses gems
54
54
 
55
55
  If either of the [`aws-sdk`](https://github.com/aws/aws-sdk-ruby/) or [`aws-sdk-ses`](https://github.com/aws/aws-sdk-ruby/) gems are available on the system, use the `type: aws_sdk` setting. (Note: usually one of these gems are installed as a consequence of installing [aws-sdk-rails](https://github.com/aws/aws-sdk-rails)).
56
56
 
@@ -58,7 +58,6 @@ Note: As of version 2.x of `aws-sdk-rails`, it only includes `aws-sdk-ses`.
58
58
 
59
59
  Note: As of version 3.x of `aws-sdk`, you can instead use `aws-sdk-ses` in order to only load the SES portion of the libraries. Before version 2.x of `aws-sdk`, the gem included all of the AWS libraries.
60
60
 
61
-
62
61
  Example configuration:
63
62
 
64
63
  notifications:
@@ -74,7 +73,24 @@ Note: As of version 3.x of `aws-sdk`, you can instead use `aws-sdk-ses` in order
74
73
  secret_access_key: Your+AWS+Secret+Access+Key # optional
75
74
 
76
75
 
77
- In either case above, an example notification block for monitored process:
76
+ 3. datadog (dogapi gem)
77
+
78
+ If you want to send crash notifications through datadag, you can do that by specifying the api_key for datadog. You must include the `dogapi` gem in your project Gemfile, so that the DataDog Ruby bindings are available.
79
+
80
+ [To retrieve your api_key](https://github.com/DataDog/dogapi-rb#how-to-find-your-api-and-application-keys)
81
+
82
+ Example configuration:
83
+
84
+ notifications:
85
+ - name: crash # this name must match the "notify" target of the process.
86
+ type: datadog # for datadog
87
+ level: error
88
+ config:
89
+ api_key: You+Datadog+API+Key
90
+
91
+ ##### Example block for monitored processes:
92
+
93
+ In any case above, an example notification block for monitored process:
78
94
 
79
95
  processes:
80
96
  - name: unicorn
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "aws-sdk-core"
2
3
 
3
4
  begin
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dogapi"
4
+
5
+ module Eye
6
+ class Notify
7
+ class DataDog < Eye::Notify
8
+ param :aggregation_key, String
9
+ param :alert_type, String
10
+ param :api_key, String, true
11
+ param :source_type, String
12
+ param :tags, Array
13
+
14
+ def execute
15
+ options = {
16
+ alert_type: "error",
17
+ aggregation_key: msg_host + msg_full_name,
18
+ source_type: "None",
19
+ tags: ["eye"]
20
+ }
21
+
22
+ options[:alert_type] = alert_type if alert_type
23
+ options[:aggregation_key] = aggregation_key if aggregation_key
24
+ options[:source_type] = source_type if source_type
25
+ options[:tags] = tags if tags
26
+
27
+ dog = Dogapi::Client.new(api_key)
28
+
29
+ dog.emit_event(
30
+ Dogapi::Event.new(
31
+ message_body,
32
+ aggregation_key: options[:aggregation_key],
33
+ alert_type: options[:alert_type],
34
+ msg_title: message_subject,
35
+ host: msg_host,
36
+ source_type: options[:source_type],
37
+ tags: options[:tags]
38
+ )
39
+ )
40
+ end
41
+ end
42
+ end
43
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "aws/ses"
2
3
 
3
4
  class Eye::Notify::SES < Eye::Notify
@@ -3,11 +3,13 @@ require "eye/patch/overrides"
3
3
 
4
4
  Eye::Notify::TYPES[:ses] = "SES"
5
5
  Eye::Notify::TYPES[:aws_sdk] = "AWSSDK"
6
+ Eye::Notify::TYPES[:datadog] = "DATADOG"
6
7
 
7
8
  module Eye
8
9
  class Notify
9
10
  autoload :SES, "eye/notify/ses"
10
11
  autoload :AWSSDK, "eye/notify/awssdk"
12
+ autoload :DATADOG, "eye/notify/datadog"
11
13
  end
12
14
  end
13
15
 
@@ -1,5 +1,5 @@
1
1
  module Eye
2
2
  module Patch
3
- VERSION = "0.4.2"
3
+ VERSION = "0.5.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eye-patch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Horner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-07 00:00:00.000000000 Z
11
+ date: 2018-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eye
@@ -117,6 +117,7 @@ files:
117
117
  - examples/unicorn.yml
118
118
  - eye-patch.gemspec
119
119
  - lib/eye/notify/awssdk.rb
120
+ - lib/eye/notify/datadog.rb
120
121
  - lib/eye/notify/ses.rb
121
122
  - lib/eye/patch.rb
122
123
  - lib/eye/patch/application.rb