datadog-notifications 0.6.3 → 0.6.4

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
  SHA256:
3
- metadata.gz: c2373f5f441b07227d05a8b6835726b0ce9df3eaf7b3329019814ad2b389dc0f
4
- data.tar.gz: 52973ed82c2720bc02da8c6337de4efa242ac91f5021dad4913cef1842203b45
3
+ metadata.gz: ede59e0920fe8b3286a6dbdd1d7394f20dedbc717129687c8df47710801d8e89
4
+ data.tar.gz: 651f6ec0b74eaf6d567e51fecd34020e49ac6133791b201f7e9d687f5a90d7bb
5
5
  SHA512:
6
- metadata.gz: c0603c9150fbd6ec40ed62c0b4ea1261e81b869c803a34531bdca51f19df41379fb908d3c2ddfa3661e458e3ae34f9ba01305ce4e4d9dba3cfab972334a29284
7
- data.tar.gz: 8c5902469f500ffe2dbe7c245fdbb530d97e7b4f3f50123aa91d0e80c9ebb56c68e93d91cee25b2cfdaad5bdf94a8fa2057e5dac6e8a3339ca207f89d5a919c6
6
+ metadata.gz: 6c50c413279f628ea36ee6f6cfac010bbd669d49127294345b55ac41ff33b3156b2f3ab65c03f57ea24648de25326465db8aa3fb07247e6a16fb53b21a20f935
7
+ data.tar.gz: ab61d42c16380a51e45b37e983386b4d84605af90797296bab7627b0105dc3631b52cbe410abc7fa29ec57956475f26ce4b784126efd2c4899e431e94b32deb3
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- datadog-notifications (0.6.3)
4
+ datadog-notifications (0.6.4)
5
5
  activesupport
6
6
  dogstatsd-ruby (>= 4.2, < 5.0)
7
7
 
@@ -53,7 +53,7 @@ GEM
53
53
  mustermann-grape (~> 1.0.0)
54
54
  rack (>= 1.3.0)
55
55
  rack-accept
56
- i18n (1.8.2)
56
+ i18n (1.8.3)
57
57
  concurrent-ruby (~> 1.0)
58
58
  minitest (5.14.1)
59
59
  mustermann (1.1.1)
@@ -70,6 +70,7 @@ GEM
70
70
  rack (>= 1.0, < 3)
71
71
  rainbow (3.0.0)
72
72
  rake (13.0.1)
73
+ regexp_parser (1.7.0)
73
74
  rexml (3.2.4)
74
75
  rspec (3.9.0)
75
76
  rspec-core (~> 3.9.0)
@@ -84,10 +85,11 @@ GEM
84
85
  diff-lcs (>= 1.2.0, < 2.0)
85
86
  rspec-support (~> 3.9.0)
86
87
  rspec-support (3.9.3)
87
- rubocop (0.84.0)
88
+ rubocop (0.85.0)
88
89
  parallel (~> 1.10)
89
90
  parser (>= 2.7.0.1)
90
91
  rainbow (>= 2.2.2, < 4.0)
92
+ regexp_parser (>= 1.7)
91
93
  rexml
92
94
  rubocop-ast (>= 0.0.3)
93
95
  ruby-progressbar (~> 1.7)
@@ -118,4 +120,4 @@ DEPENDENCIES
118
120
  sqlite3
119
121
 
120
122
  BUNDLED WITH
121
- 2.1.2
123
+ 2.1.4
@@ -22,10 +22,10 @@ module Datadog
22
22
 
23
23
  def connect!
24
24
  env = ENV['RAILS_ENV'] || ENV['RACK_ENV']
25
- tags.push("env:#{env}") if env && tags.none? {|t| t =~ /^env\:/ }
25
+ tags.push("env:#{env}") if env && tags.none? {|t| t =~ /^env:/ }
26
26
 
27
27
  enable_hostname = hostname && hostname != 'false'
28
- tags.push("host:#{hostname}") if enable_hostname && tags.none? {|t| t =~ /^host\:/ }
28
+ tags.push("host:#{hostname}") if enable_hostname && tags.none? {|t| t =~ /^host:/ }
29
29
 
30
30
  reporter.new statsd_host, statsd_port, namespace: namespace, tags: tags, socket_path: socket_path
31
31
  end
@@ -1,5 +1,7 @@
1
1
  module Datadog::Notifications::Plugins
2
2
  class Grape < Base
3
+ DEFAULT_EXCEPTION_HANDLER = ->(e) { self.class.exception_status(e) }
4
+
3
5
  def self.exception_status(err)
4
6
  err.respond_to?(:status) ? err.status : 500
5
7
  end
@@ -11,11 +13,11 @@ module Datadog::Notifications::Plugins
11
13
  # *<tt>:metric_name</tt> - the metric name, defaults to "grape.request"
12
14
  # *<tt>:exception_handler</tt> - a custom exception handler proc which accepts an exception object and returns a status
13
15
  # *<tt>:tags</tt> - additional tags
14
- def initialize(metric_name: 'grape.request', exception_handler:, **opts)
16
+ def initialize(metric_name: 'grape.request', exception_handler: DEFAULT_EXCEPTION_HANDLER, **opts)
15
17
  super
16
18
 
17
19
  @metric_name = metric_name
18
- @exception_handler = exception_handler || ->(e) { self.class.exception_status(e) }
20
+ @exception_handler = exception_handler
19
21
 
20
22
  Datadog::Notifications.subscribe 'endpoint_run.grape' do |reporter, event|
21
23
  record reporter, event
@@ -33,7 +35,7 @@ module Datadog::Notifications::Plugins
33
35
  status = exception_handler.call(payload[:exception_object]) if payload[:exception_object]
34
36
 
35
37
  path = extract_path(endpoint)
36
- path.gsub!(%r{[^\w\/\-]+}, '_')
38
+ path.gsub!(%r{[^\w/\-]+}, '_')
37
39
 
38
40
  tags = self.tags + %W[method:#{method} status:#{status}]
39
41
  tags.push "path:#{path}" if path
@@ -54,7 +56,7 @@ module Datadog::Notifications::Plugins
54
56
  return endpoint.request.path unless route
55
57
 
56
58
  path = endpoint.route.path.dup
57
- path.sub!(/\(\.\:format\)$/, '')
59
+ path.sub!(/\(\.:format\)$/, '')
58
60
  path.sub!(':version/', '') if endpoint.version
59
61
  path.gsub!(/:(\w+)/) {|m| m[1..-1].upcase }
60
62
  path
@@ -1,5 +1,5 @@
1
1
  module Datadog
2
2
  class Notifications
3
- VERSION = '0.6.3'.freeze
3
+ VERSION = '0.6.4'.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.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitrij Denissenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-29 00:00:00.000000000 Z
11
+ date: 2020-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -209,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
209
  - !ruby/object:Gem::Version
210
210
  version: '0'
211
211
  requirements: []
212
- rubygems_version: 3.1.2
212
+ rubygems_version: 3.1.4
213
213
  signing_key:
214
214
  specification_version: 4
215
215
  summary: Generic ActiveSupport::Notifications Datadog handler