datadog-notifications 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/datadog/notifications/config.rb +2 -6
- data/lib/datadog/notifications/version.rb +1 -1
- data/spec/datadog/notifications/config_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3d668af2da1cc25472d44d939c5da4dfba44d70
|
4
|
+
data.tar.gz: 6b7460e6c592e56d9a6e40be585fe906937cd747
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d735a792588b792d58b5b4ce1bae1ccb4dc078b8d309196cdd2e2681436c3f6514989bb2946a124adc8837bc1377de0658c9b1b591dc365798c318d557cf9515
|
7
|
+
data.tar.gz: f2682eda37b015a12c8605f1d924a6b1d09e2080201e0eff4f18858b4f1d3ad208f8b4da4649f6fdaff224eb56f58ae8a9be54c63c873f473b261124bdbfcadc
|
data/README.md
CHANGED
@@ -25,6 +25,10 @@ Configure it in an initializer:
|
|
25
25
|
|
26
26
|
For full configuration options, please see the [Documentation](http://www.rubydoc.info/gems/datadog-notifications).
|
27
27
|
|
28
|
+
## Plugins
|
29
|
+
|
30
|
+
For a list of bundled plugins, please visit the [repository](https://github.com/bsm/datadog-notifications/tree/master/lib/datadog/notifications/plugins) page.
|
31
|
+
|
28
32
|
## Contributing
|
29
33
|
|
30
34
|
1. Fork it
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Datadog
|
2
2
|
class Notifications
|
3
3
|
class Config
|
4
|
-
attr_accessor :hostname, :namespace, :tags, :statsd_host, :statsd_port, :reporter
|
4
|
+
attr_accessor :hostname, :namespace, :tags, :statsd_host, :statsd_port, :reporter, :plugins
|
5
5
|
|
6
6
|
def initialize
|
7
7
|
@hostname = ENV['INSTRUMENTATION_HOSTNAME'] || Socket.gethostname
|
@@ -14,14 +14,10 @@ module Datadog
|
|
14
14
|
|
15
15
|
# Use a plugin
|
16
16
|
def use(klass, opts = {})
|
17
|
-
@plugins.push
|
17
|
+
@plugins.push klass.new(opts)
|
18
18
|
end
|
19
19
|
|
20
20
|
def connect!
|
21
|
-
@plugins.each do |klass, opts|
|
22
|
-
klass.new(opts)
|
23
|
-
end
|
24
|
-
|
25
21
|
env = ENV['RACK_ENV'] || ENV['RAILS_ENV']
|
26
22
|
tags.push("env:#{env}") if env && tags.none? {|t| t =~ /^env\:/ }
|
27
23
|
tags.push("host:#{hostname}") if tags.none? {|t| t =~ /^host\:/ }
|
@@ -12,4 +12,10 @@ describe Datadog::Notifications::Config do
|
|
12
12
|
expect(subject.tags).to eq(["custom:tag", "env:test", "host:test.host"])
|
13
13
|
end
|
14
14
|
|
15
|
+
it 'should instantiate plugins on use' do
|
16
|
+
subject.use Datadog::Notifications::Plugins::ActionController
|
17
|
+
expect(subject.plugins.size).to eq(1)
|
18
|
+
expect(subject.plugins.first).to be_instance_of(Datadog::Notifications::Plugins::ActionController)
|
19
|
+
end
|
20
|
+
|
15
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datadog-notifications
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimitrij Denissenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|