nine_one_one 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +3 -3
- data/lib/nine_one_one/log_service.rb +2 -2
- data/lib/nine_one_one/notifier.rb +2 -3
- data/lib/nine_one_one/slack_service.rb +2 -2
- data/lib/nine_one_one/version.rb +1 -1
- data/lib/nine_one_one.rb +1 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ba4ec764772f241f23b6377c0fe39a1de964bbfa
|
4
|
+
data.tar.gz: 2b907c93c2ea597ddd46c2f677e077db4c2d2117
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f89b54ead1e9a4bc6cb7420fdd50d30579a4584d65c4ff410f8e2d0a11c55776accc2f3cadddfb7418687154b5af1fd0e69bad4035b25f17fb603ab954be8b0
|
7
|
+
data.tar.gz: 82cda078425b07e0526a270c1e8ee1175d2efad7f49caac7bd1f67bf784e50a7ddf8a122bdbd04b91cfdcfd728655d816d2a0707e2f5c6737b1b476548ada6e3
|
data/README.md
CHANGED
@@ -77,14 +77,14 @@ NineOneOne.notify('Something happened!')
|
|
77
77
|
NineOneOne.notify({attachments: [{title: 'Something happened!', text: 'More info'}]})
|
78
78
|
|
79
79
|
# Send pager or log emergency using logger depending on the `send_pagers` config parameter
|
80
|
-
NineOneOne.emergency('Emergency message!',
|
80
|
+
NineOneOne.emergency('Emergency message!', details_hash: { optional_hash: 'with details' })
|
81
81
|
|
82
82
|
# Send multiple pagers that will be grouped into one incident
|
83
|
-
NineOneOne.emergency('Emergency message!',
|
83
|
+
NineOneOne.emergency('Emergency message!', dedup_key: 'Kinda unique key')
|
84
84
|
|
85
85
|
# same for custom configurations
|
86
86
|
NineOneOne.use(:my_custom_configuration).notify('Something happened!')
|
87
|
-
NineOneOne.use(:my_custom_configuration).emergency('Emergency message!',
|
87
|
+
NineOneOne.use(:my_custom_configuration).emergency('Emergency message!', details_hash: { optional_hash: 'with details' })
|
88
88
|
```
|
89
89
|
|
90
90
|
## Development
|
@@ -4,8 +4,8 @@ module NineOneOne
|
|
4
4
|
@logger = logger
|
5
5
|
end
|
6
6
|
|
7
|
-
def trigger_event(description,
|
8
|
-
logger.error
|
7
|
+
def trigger_event(description, details_hash)
|
8
|
+
logger.error("TRIGGERED INCIDENT: #{description} (#{details_hash})")
|
9
9
|
end
|
10
10
|
|
11
11
|
def notify(message)
|
@@ -7,7 +7,7 @@ module NineOneOne
|
|
7
7
|
def emergency(description, source: Socket.gethostname, dedup_key: nil,
|
8
8
|
severity: PagerDutyService::HIGH_URGENCY_ERROR, details_hash: nil)
|
9
9
|
emergency_service.trigger_event(description, source: source, dedup_key: dedup_key, severity: severity,
|
10
|
-
|
10
|
+
details_hash: details_hash)
|
11
11
|
end
|
12
12
|
|
13
13
|
def notify(message)
|
@@ -24,8 +24,7 @@ module NineOneOne
|
|
24
24
|
|
25
25
|
def notification_service
|
26
26
|
if config.slack_enabled
|
27
|
-
SlackService.new(config.slack_webhook_url, username: config.slack_username,
|
28
|
-
channel: config.slack_channel)
|
27
|
+
SlackService.new(config.slack_webhook_url, username: config.slack_username, channel: config.slack_channel)
|
29
28
|
else
|
30
29
|
LogService.new(config.logger)
|
31
30
|
end
|
@@ -11,7 +11,7 @@ module NineOneOne
|
|
11
11
|
|
12
12
|
def notify(message)
|
13
13
|
body = request_body(message)
|
14
|
-
headers = {'Content-Type' => 'application/json'}
|
14
|
+
headers = { 'Content-Type' => 'application/json' }
|
15
15
|
http.post(path, body, headers)
|
16
16
|
end
|
17
17
|
|
@@ -20,7 +20,7 @@ module NineOneOne
|
|
20
20
|
attr_reader :channel, :http, :path, :username
|
21
21
|
|
22
22
|
def request_body(message)
|
23
|
-
body = message.is_a?(Hash) ? message : {text: message}
|
23
|
+
body = message.is_a?(Hash) ? message : { text: message }
|
24
24
|
body[:channel] = channel unless channel.nil?
|
25
25
|
body[:username] = username unless username.nil?
|
26
26
|
|
data/lib/nine_one_one/version.rb
CHANGED
data/lib/nine_one_one.rb
CHANGED
@@ -30,8 +30,7 @@ module NineOneOne
|
|
30
30
|
def self.emergency(description, source: Socket.gethostname, dedup_key: nil,
|
31
31
|
severity: PagerDutyService::HIGH_URGENCY_ERROR, details_hash: nil)
|
32
32
|
use(:default).emergency(description, source: source, dedup_key: dedup_key, severity: severity,
|
33
|
-
|
34
|
-
|
33
|
+
details_hash: details_hash)
|
35
34
|
end
|
36
35
|
|
37
36
|
def self.notify(message)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nine_one_one
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kacper Madej
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-08-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -214,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
214
|
version: '0'
|
215
215
|
requirements: []
|
216
216
|
rubyforge_project:
|
217
|
-
rubygems_version: 2.
|
217
|
+
rubygems_version: 2.6.11
|
218
218
|
signing_key:
|
219
219
|
specification_version: 4
|
220
220
|
summary: Alerts and notifications via PagerDuty and Slack for Ruby apps
|