datadog-notifications 0.5.1 → 0.5.2
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 +4 -4
- data/.travis.yml +0 -1
- data/Gemfile.lock +2 -2
- data/datadog-notifications.gemspec +1 -1
- data/lib/datadog/notifications/plugins.rb +6 -4
- data/lib/datadog/notifications/plugins/grpc.rb +38 -0
- data/lib/datadog/notifications/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89b0d05d17eb685b11111b4e51f084cd06c38be7260cd59b4ea1658acb5b370c
|
4
|
+
data.tar.gz: f909fcf6911e90ef1f8edc4b52623eab019dda46e71d89be08ef9dbdd7270054
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c9992a90617646fa85892acbba126395d378c052ee8250b16a02f0133fdaee6894c9c4ecbbb5043984f32b973b1fa5ba27d6dcb5a7573663569855abc3d97df
|
7
|
+
data.tar.gz: eba72a1ee4d04b105666402ca7573a542197d4b58b062f41527590f46732651d04b5f18fa7c591862de2c88cbe08424f33a1114ad7e1ca65101bd7ae608779bb
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -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
|
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
|
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.
|
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-
|
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
|
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.
|
206
|
+
rubygems_version: 2.7.7
|
206
207
|
signing_key:
|
207
208
|
specification_version: 4
|
208
209
|
summary: Generic ActiveSupport::Notifications Datadog handler
|