datadog-notifications 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2257233489d7e6bc50b0e9a88e111d2ad44137f1cd0c88b03a98d8a9ab6d76b0
4
- data.tar.gz: fdc4b3eb8f0e94024793a0d0d6c2b9820050a3a0e7aa3501db4427579b23a5d9
3
+ metadata.gz: 89b0d05d17eb685b11111b4e51f084cd06c38be7260cd59b4ea1658acb5b370c
4
+ data.tar.gz: f909fcf6911e90ef1f8edc4b52623eab019dda46e71d89be08ef9dbdd7270054
5
5
  SHA512:
6
- metadata.gz: 5aeb2e55053f293e7f590607466953ff4eceba1d6fd534d9c7925813d09799a1a88af1b3cb1c61e6d77ef625e9c4e5a0d95a7e4e9bbb07554601e12612d8cb83
7
- data.tar.gz: 97a00586b27ff4ae6f2fd98ba5e7b054f0b7be1f644fa0567fa164417446703fc64f398ece8313efa30391689babdd496caaf268ac4456febd9b52b036a1261c
6
+ metadata.gz: 2c9992a90617646fa85892acbba126395d378c052ee8250b16a02f0133fdaee6894c9c4ecbbb5043984f32b973b1fa5ba27d6dcb5a7573663569855abc3d97df
7
+ data.tar.gz: eba72a1ee4d04b105666402ca7573a542197d4b58b062f41527590f46732651d04b5f18fa7c591862de2c88cbe08424f33a1114ad7e1ca65101bd7ae608779bb
@@ -1,7 +1,6 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.5
5
4
  - 2.4
6
5
  - 2.3
7
6
  - 2.2
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- datadog-notifications (0.5.1)
4
+ datadog-notifications (0.5.2)
5
5
  activesupport
6
6
  dogstatsd-ruby (~> 3.1)
7
7
 
@@ -106,4 +106,4 @@ DEPENDENCIES
106
106
  sqlite3
107
107
 
108
108
  BUNDLED WITH
109
- 1.16.1
109
+ 1.16.3
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.version = Datadog::Notifications::VERSION.dup
9
9
  s.authors = ["Dimitrij Denissenko"]
10
10
  s.email = ["dimitrij@blacksquaremedia.com"]
11
- s.description = 'Datadog instrumnetation for ActiveSupport::Notifications'
11
+ s.description = 'Datadog instrumentation for ActiveSupport::Notifications'
12
12
  s.summary = 'Generic ActiveSupport::Notifications Datadog handler'
13
13
  s.homepage = "https://github.com/bsm/datadog-notifications"
14
14
 
@@ -1,10 +1,12 @@
1
1
  module Datadog
2
2
  class Notifications
3
3
  module Plugins
4
+ autoload :Base, 'datadog/notifications/plugins/base'
5
+ autoload :Grape, 'datadog/notifications/plugins/grape'
6
+ autoload :ActiveRecord, 'datadog/notifications/plugins/active_record'
7
+ autoload :ActiveJob, 'datadog/notifications/plugins/active_job'
8
+ autoload :ActionController, 'datadog/notifications/plugins/action_controller'
9
+ autoload :GRPC, 'datadog/notifications/plugins/grpc'
4
10
  end
5
11
  end
6
12
  end
7
-
8
- %w[base grape active_record active_job action_controller].each do |name|
9
- require "datadog/notifications/plugins/#{name}"
10
- end
@@ -0,0 +1,38 @@
1
+ module Datadog::Notifications::Plugins
2
+ class GRPC < Base
3
+
4
+ # Options:
5
+ #
6
+ # *<tt>:metric_name</tt> - the metric name, defaults to 'grpc.request'
7
+ # *<tt>:tags</tt> - additional tags
8
+ #
9
+ # It expects ActiveSupport instrumented notifications named 'process_action.grpc'.
10
+ # Each such notification should have an :action key with gRPC action (method) name.
11
+ #
12
+ # Compatible instrumentation is implemented in grpcx gem: https://github.com/bsm/grpcx
13
+ def initialize(opts={})
14
+ super
15
+ @metric_name = opts[:metric_name] || 'grpc.request'
16
+
17
+ Datadog::Notifications.subscribe 'process_action.grpc' do |reporter, event|
18
+ record reporter, event
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ def record(reporter, event)
25
+ payload = event.payload
26
+ action = payload[:action]
27
+ status = payload[:exception] ? 'error' : 'ok'
28
+
29
+ tags = self.tags + %W[action:#{action} status:#{status}]
30
+
31
+ reporter.batch do
32
+ reporter.increment metric_name, tags: tags
33
+ reporter.timing "#{metric_name}.time", event.duration, tags: tags
34
+ end
35
+ end
36
+
37
+ end
38
+ end
@@ -1,5 +1,5 @@
1
1
  module Datadog
2
2
  class Notifications
3
- VERSION = '0.5.1'.freeze
3
+ VERSION = '0.5.2'.freeze
4
4
  end
5
5
  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.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitrij Denissenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-05 00:00:00.000000000 Z
11
+ date: 2018-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -150,7 +150,7 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
- description: Datadog instrumnetation for ActiveSupport::Notifications
153
+ description: Datadog instrumentation for ActiveSupport::Notifications
154
154
  email:
155
155
  - dimitrij@blacksquaremedia.com
156
156
  executables: []
@@ -176,6 +176,7 @@ files:
176
176
  - lib/datadog/notifications/plugins/active_record.rb
177
177
  - lib/datadog/notifications/plugins/base.rb
178
178
  - lib/datadog/notifications/plugins/grape.rb
179
+ - lib/datadog/notifications/plugins/grpc.rb
179
180
  - lib/datadog/notifications/reporter.rb
180
181
  - lib/datadog/notifications/version.rb
181
182
  - spec/datadog/notifications/config_spec.rb
@@ -202,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
203
  version: '0'
203
204
  requirements: []
204
205
  rubyforge_project:
205
- rubygems_version: 2.7.3
206
+ rubygems_version: 2.7.7
206
207
  signing_key:
207
208
  specification_version: 4
208
209
  summary: Generic ActiveSupport::Notifications Datadog handler