sidekiq-datadog-monitor 0.0.0.5 → 0.0.1

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: 7465b128d6d438118a8d64e3ce288f35c128e7442f1e0fc7e58f20960c6dc6a1
4
- data.tar.gz: 79b460c74b8e795eb66dceefeb43ab1f7a902599ba089bd09438f2e1cba780bd
3
+ metadata.gz: 8d84d08e0320ca9b9e399bb8eff1efd74af038a534fe9936c8cfcfb3e169dc40
4
+ data.tar.gz: f7cedc8a2816f04c886a2a0c8f841d7cd2819bbb916cd59737208ceff35043c1
5
5
  SHA512:
6
- metadata.gz: 1ab63b86d1abba345dd6ebc265d833e439ab3b8920982a8309c5a6f358088d21c57ccdffceda70f1443b61f03d9783b8412064f548e9d4df56ee11fbd62d46a0
7
- data.tar.gz: 3fde4c5e786a6732691ab65a192098b4db5327fd803be0716e5e9aa8c1afa7915a8bdd7695827d5d1b3708eb83c8eef106eb90747cabbe26d727b0f8c91027e8
6
+ metadata.gz: 6f1384e84c750d8510cc1102c9f4286276c8a6fdefa050e2576ce0baebde5da806859c8d4e34e316921260814fd4a251d8f20bd652073bb5bdee9a0af6fdbbda
7
+ data.tar.gz: 489cf5542ec468a81eb8e0c218b5f34babb3a23699e444e1702cf65cd105e8326f4667d01ab5765a599564600dba8c9e4a6564dd0a4a838766f9ece447b9e707
data/README.md CHANGED
@@ -1,14 +1,15 @@
1
1
  # Sidekiq::Datadog::Monitor
2
2
 
3
- Library that gather sidekiq jobs metrics (currently, only size and latency)
4
- and send it to datadog
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/sidekiq/datadog/monitor`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
5
6
 
6
7
  ## Installation
7
8
 
8
9
  Add this line to your application's Gemfile:
9
10
 
10
11
  ```ruby
11
- gem 'sidekiq-datadog-monitor', '0.0.1'
12
+ gem 'sidekiq-datadog-monitor'
12
13
  ```
13
14
 
14
15
  And then execute:
@@ -21,31 +22,7 @@ Or install it yourself as:
21
22
 
22
23
  ## Usage
23
24
 
24
- To start sending metrics
25
-
26
- ```ruby
27
- # Import the library
28
- require 'sidekiq/datadog/monitor/data'
29
-
30
- # Initiate a Sidekiq::Datadog::Monitor client instance.
31
- Sidekiq::Datadog::Monitor::Data.initialize!(
32
- {agent_host: 'localhost',
33
- agent_port: 8125,
34
- env: 'production', # optional
35
- tag: 'tag', # optional
36
- queue: 'queue name', # optional
37
- cron: "*/30 * * * *" # default: "*/1 * * * *"
38
- }
39
- )
40
-
41
- ```
42
- `agent_host` and `agent_port` instantiate DogStatsD client
43
-
44
- `env`, `tag`, `queue` settings for background job that will gather and send Sidekiq metrics
45
-
46
- `cron` - schedule settings for background job that will gather and send Sidekiq metrics
47
-
48
-
25
+ TODO: Write usage instructions here
49
26
 
50
27
  ## Development
51
28
 
@@ -2,7 +2,7 @@ require "sidekiq/datadog/monitor/version"
2
2
 
3
3
  module Sidekiq
4
4
  module Datadog
5
- module Monitor
5
+ module Monitor
6
6
  class Error < StandardError; end
7
7
  end
8
8
  end
@@ -1,9 +1,5 @@
1
- require "sidekiq/datadog/monitor"
2
- require "sidekiq/datadog/config"
1
+ require 'datadog/statsd'
3
2
  require 'sidekiq/datadog/monitor/metrics_worker'
4
- require 'sidekiq-scheduler'
5
- require 'sidekiq/api'
6
-
7
3
  module Sidekiq
8
4
  module Datadog
9
5
  module Monitor
@@ -12,22 +8,16 @@ module Sidekiq
12
8
  attr_reader :agent_port, :agent_host, :tag, :env, :queue, :cron
13
9
 
14
10
  def initialize!(options)
15
- @agent_port, @agent_host = options.fetch_values(:agent_port, :agent_host)
11
+ @agent_port = options[:agent_port]
12
+ @agent_host = options[:agent_host]
16
13
  @tag = options[:tag] || ''
17
14
  @env = options[:env] || ''
18
15
  @queue = options[:queue] || ''
19
16
  @cron = options[:cron] || "*/1 * * * *"
20
17
 
21
- Sidekiq::Datadog::Config.reload_schedule
22
-
23
18
  start
24
-
25
- rescue StandardError => e
26
- raise Sidekiq::Datadog::Monitor::Error.new(e.message)
27
19
  end
28
20
 
29
- private
30
-
31
21
  def start
32
22
  Sidekiq.set_schedule('send_metrics',
33
23
  { "cron"=> cron, 'class' => 'Sidekiq::Datadog::Monitor::MetricsWorker', 'queue' => queue })
@@ -1,5 +1,5 @@
1
- require "sidekiq/datadog/monitor/data"
2
1
  require 'datadog/statsd'
2
+ require 'sidekiq'
3
3
 
4
4
  module Sidekiq
5
5
  module Datadog
@@ -23,13 +23,13 @@ module Sidekiq
23
23
 
24
24
  def post_queue_size(queue_name, size)
25
25
  statsd.gauge('sidekiq.queue.size', size,
26
- tags: ["queue_name:#{queue_name}", "env:#{Data.env}", Data.tag])
26
+ tags: ["queue_name:#{queue_name}", "environment:#{Data.env}", Data.tag])
27
27
  end
28
28
 
29
29
  def post_queue_latency(queue_name)
30
30
  latency = Sidekiq::Queue.new(queue_name).latency
31
31
  statsd.gauge('sidekiq.queue.latency', latency,
32
- tags: ["queue_name:#{queue_name}", "env:#{Data.env}", Data.tag])
32
+ tags: ["queue_name:#{queue_name}", "environment:#{Data.env}", Data.tag])
33
33
  end
34
34
  end
35
35
  end
@@ -1,7 +1,7 @@
1
1
  module Sidekiq
2
2
  module Datadog
3
3
  module Monitor
4
- VERSION = "0.0.0.5"
4
+ VERSION = "0.0.1"
5
5
  end
6
6
  end
7
7
  end
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: 0.0.0.5
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - aleksa_castle
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-20 00:00:00.000000000 Z
11
+ date: 2020-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: 2.2.1
69
- - !ruby/object:Gem::Dependency
70
- name: sidekiq-scheduler
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: 3.0.1
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: 3.0.1
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: dogstatsd-ruby
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -105,7 +91,6 @@ files:
105
91
  - README.md
106
92
  - bin/console
107
93
  - bin/setup
108
- - lib/sidekiq/datadog/config.rb
109
94
  - lib/sidekiq/datadog/monitor.rb
110
95
  - lib/sidekiq/datadog/monitor/data.rb
111
96
  - lib/sidekiq/datadog/monitor/metrics_worker.rb
@@ -1,13 +0,0 @@
1
- module Sidekiq
2
- module Datadog
3
- class Config
4
- class << self
5
- def reload_schedule
6
- Sidekiq.configure_server do |config|
7
- Sidekiq::Scheduler.dynamic = true
8
- end
9
- end
10
- end
11
- end
12
- end
13
- end