sidekiq-datadog-monitor 1.1.0 → 1.2.0

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: cc1c08fcbeb8b6c537ba978f1cefd6fa9bcdd51603033c9dab842454521b3f68
4
- data.tar.gz: 882d91a2df184e5ac834e065f7a4cb9c1fa4ce6cb0d78ce458d4127cc9b91cae
3
+ metadata.gz: 3ffdc90ec0ce3e0974c9f88441a9833ab8a6b89cb0dbfe9921a86862dce745df
4
+ data.tar.gz: f7a217613ae31312d06c45f025809b5abc089a167746fdc71775dc9dac10ca1b
5
5
  SHA512:
6
- metadata.gz: 89840dff563a53de966bf6364b2179a81a5225379ed9aecb0d946f56d226ea846060eb9bec50366824474890b6a2e455c319722ccdd459966867956a72c0fd73
7
- data.tar.gz: 9a5487c643e2a9214d4a8b96f477a438a313be3cdbeca3d3bd428c48a1f12fe97ed0c9b94828bd7748c4b30e611fc871983445e8811594b9e122343d77233066
6
+ metadata.gz: 85e961f2083945bd2536a7306bcfe18fa3ff166327782d3b169a5adde96fabd541300aace9ccbccc9f1acf0a1c4f0b4565757eb0b6c2370963051e36aa4f9e16
7
+ data.tar.gz: bb68509cd620964117ce95b6dd6227f9f6727211a1b8cf7ded6eb7d89ba6cb9ffdf0f8d0330923262b2661673146e65d906223a295ef8f8f6d9c68b55aec4f37
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "sidekiq/datadog/monitor"
3
+ require 'bundler/setup'
4
+ require 'sidekiq/datadog/monitor'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +10,5 @@ require "sidekiq/datadog/monitor"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start(__FILE__)
@@ -34,4 +34,4 @@ module Sidekiq
34
34
  end
35
35
  end
36
36
  end
37
- end
37
+ end
@@ -18,6 +18,7 @@ module Sidekiq
18
18
  post_process_stats(process)
19
19
  end
20
20
  post_scheduled_stats
21
+ post_deadset_stats
21
22
  end
22
23
 
23
24
  protected
@@ -38,7 +39,11 @@ module Sidekiq
38
39
 
39
40
  def post_scheduled_stats
40
41
  scheduled_size = Sidekiq::Stats.new.scheduled_size
41
- statsd.gauge('sidekiq.scheduled.size', scheduled_size, tags: tags_builder.build({}))
42
+ statsd.gauge('sidekiq.scheduled.size', scheduled_size, tags: tags_builder.build)
43
+ end
44
+
45
+ def post_deadset_stats
46
+ statsd.gauge('sidekiq.dead_set.size', Sidekiq::DeadSet.new.size, tags: tags_builder.build)
42
47
  end
43
48
  end
44
49
  end
@@ -2,12 +2,12 @@ module Sidekiq
2
2
  module Datadog
3
3
  module Monitor
4
4
  class TagBuilder
5
- SPECIAL_SYMBOLS = /[\/\.:]/i.freeze
5
+ SPECIAL_SYMBOLS = %r{[/.:]}i.freeze
6
6
  def initialize(common_tags)
7
7
  @common_tags = common_tags
8
8
  end
9
9
 
10
- def build(tags_hash)
10
+ def build(tags_hash = {})
11
11
  custom_tags = tags_hash.map { |key, value| [key, value] if value.to_s != '' }.compact
12
12
  custom_tags = custom_tags.map { |key, value| "#{key}:#{normalize_value(value)}" }
13
13
  custom_tags + @common_tags
@@ -1,7 +1,7 @@
1
1
  module Sidekiq
2
2
  module Datadog
3
3
  module Monitor
4
- VERSION = '1.1.0'.freeze
4
+ VERSION = '1.2.0'.freeze
5
5
  end
6
6
  end
7
7
  end
@@ -34,6 +34,11 @@ module Sidekiq
34
34
 
35
35
  def send_metrics
36
36
  sender&.send_metrics
37
+ rescue ArgumentError => e
38
+ # Ignore this error. Sometimes sender hasn't yet started when we send metrics for the first time on boot
39
+ return if sender && e.message == 'Start sender first'
40
+
41
+ raise
37
42
  end
38
43
 
39
44
  def shutdown!
@@ -54,15 +59,9 @@ module Sidekiq
54
59
  Sidekiq.configure_server do |config|
55
60
  patch_sidekiq_heartbeat(config)
56
61
 
57
- config.on(:startup) do
58
- Sidekiq::Datadog::Monitor.initialize!
59
- end
60
- config.on(:beat) do
61
- Sidekiq::Datadog::Monitor.send_metrics
62
- end
63
- config.on(:shutdown) do
64
- Sidekiq::Datadog::Monitor.shutdown!
65
- end
62
+ config.on(:startup) { Sidekiq::Datadog::Monitor.initialize! }
63
+ config.on(:beat) { Sidekiq::Datadog::Monitor.send_metrics }
64
+ config.on(:shutdown) { Sidekiq::Datadog::Monitor.shutdown! }
66
65
  end
67
66
  end
68
67
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-datadog-monitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - aleksa_castle
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-31 00:00:00.000000000 Z
11
+ date: 2025-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -95,33 +95,33 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: 1.38.1
97
97
  - !ruby/object:Gem::Dependency
98
- name: sidekiq
98
+ name: dogstatsd-ruby
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '5'
103
+ version: '5.0'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '5'
110
+ version: '5.0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: dogstatsd-ruby
112
+ name: sidekiq
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: '5.0'
117
+ version: '5'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: '5.0'
124
+ version: '5'
125
125
  description:
126
126
  email:
127
127
  - oleksandra.k@matic.com