newrelic_sidekiq_plugin 0.0.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 +15 -0
- data/Gemfile +2 -0
- data/README.md +18 -0
- data/bin/newrelic_sidekiq_agent +22 -0
- data/config/newrelic_plugin.yml.example +21 -0
- data/lib/newrelic_sidekiq_agent.rb +57 -0
- data/newrelic_sidekiq_plugin.gemspec +71 -0
- metadata +82 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MmY3YmE0MTViZjkwYTZlYjk0Yzg3Y2JkN2FjZWQ3YTcxNGNiZGEzZg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YWRhYTVkM2IyMGViNzliZjMzMWIyNmJmY2Y0ODRjNDYwZDRjMmNiOA==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZDEzZGQ2NmNiYWI5NDUzZjI0OTg4Mjc4ZWNiNGQ3YTQ2YTExMzE4ODc0Njg5
|
10
|
+
MGY2OTIxZTZkZjFiOTA2MWNiOGM1YjE3OWJjMzNkNzA5ODA1ZGYxZDExZWFi
|
11
|
+
YTM3YTczOTRhNmU4NjdjN2M5ODE3MzMzMzI4YmY0NzRkNzE3MjA=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MzFiOWUyYzQwNzQyZTNmYTRjYzU0MzkwNzhkZTgyNzY1NTAwMTk5Y2Y1N2Rm
|
14
|
+
YTA4NWYyN2UwODg2MGNkNjMwMDdmOWIzYjdjYjlhMzc3NWFhNzdlM2EwNjQ2
|
15
|
+
MzZmOTFhNzhmZmI0YTE2ZDUyOGI5YTE4MjgwMTEwOWQxODBlNzk=
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
## NewRelic Sidekiq plugin
|
2
|
+
|
3
|
+
This plugin reports back metrics to the NewRelic plugin dashboard.
|
4
|
+
|
5
|
+
## Requirements
|
6
|
+
|
7
|
+
Ruby 1.9.3
|
8
|
+
Sidekiq 2.13.0
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
gem install newrelic_sidekiq_plugin
|
13
|
+
|
14
|
+
## Getting Started
|
15
|
+
|
16
|
+
1. Copy `config/newrelic_plugin.yml.example` to `config/newrelic_plugin.yml`
|
17
|
+
2. Edit `config/newrelic_plugin.yml` and replace "YOUR_LICENSE_KEY_HERE" with your New Relic license key
|
18
|
+
3. run `./bin/newrelic_example_agent`
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
require "rubygems"
|
4
|
+
require "bundler/setup"
|
5
|
+
require "#{File.expand_path('../../',__FILE__)}/lib/newrelic_sidekiq_agent"
|
6
|
+
|
7
|
+
module SidekiqAgent
|
8
|
+
|
9
|
+
#
|
10
|
+
# Register this agent with the component.
|
11
|
+
# The ExampleAgent is the name of the module that defines this
|
12
|
+
# driver (the module must contain at least three classes - a
|
13
|
+
# PollCycle, a Metric and an Agent class, as defined above).
|
14
|
+
#
|
15
|
+
NewRelic::Plugin::Setup.install_agent :sidekiq, SidekiqAgent
|
16
|
+
|
17
|
+
#
|
18
|
+
# Launch the agent; this never returns.
|
19
|
+
#
|
20
|
+
NewRelic::Plugin::Run.setup_and_run
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Please make sure to update the license_key information with the license key for your New Relic
|
2
|
+
# account.
|
3
|
+
#
|
4
|
+
#
|
5
|
+
newrelic:
|
6
|
+
#
|
7
|
+
# Update with your New Relic account license key:
|
8
|
+
#
|
9
|
+
license_key: 'YOUR_LICENSE_KEY_HERE'
|
10
|
+
#
|
11
|
+
# Set to '1' for verbose output, remove for normal output.
|
12
|
+
# All output goes to stdout/stderr.
|
13
|
+
#
|
14
|
+
# verbose: 1
|
15
|
+
#
|
16
|
+
# Agent Configuration:
|
17
|
+
#
|
18
|
+
agents:
|
19
|
+
# this is where configuration for agents belongs
|
20
|
+
sidekiq:
|
21
|
+
# No configuration options
|
@@ -0,0 +1,57 @@
|
|
1
|
+
#
|
2
|
+
# This is a NewRelic Plugin Agent for monitoring Sidekiq
|
3
|
+
#
|
4
|
+
require "newrelic_plugin"
|
5
|
+
require "sidekiq"
|
6
|
+
|
7
|
+
module SidekiqAgent
|
8
|
+
class Agent < NewRelic::Plugin::Agent::Base
|
9
|
+
|
10
|
+
agent_guid "com.getdropstream.sidekiq"
|
11
|
+
agent_version "0.0.2"
|
12
|
+
agent_config_options :queue
|
13
|
+
agent_human_labels("Sidekiq Agent") { ident }
|
14
|
+
|
15
|
+
attr_reader :ident
|
16
|
+
|
17
|
+
def setup_metrics
|
18
|
+
@total_failed = NewRelic::Processor::EpochCounter.new
|
19
|
+
@processed = NewRelic::Processor::EpochCounter.new
|
20
|
+
end
|
21
|
+
|
22
|
+
def poll_cycle
|
23
|
+
stats = Sidekiq::Stats.new
|
24
|
+
|
25
|
+
#
|
26
|
+
# The # of worker executing a job
|
27
|
+
#
|
28
|
+
report_metric "Workers/Working", "Workers", Sidekiq::Workers.new.size
|
29
|
+
|
30
|
+
#
|
31
|
+
# The # of queued jobs
|
32
|
+
#
|
33
|
+
report_metric "Jobs/Pending", "Jobs", stats.enqueued
|
34
|
+
|
35
|
+
#
|
36
|
+
# Total # of jobs failed
|
37
|
+
#
|
38
|
+
report_metric "Jobs/Failed", "Jobs", stats.failed
|
39
|
+
|
40
|
+
#
|
41
|
+
# Total # of jobs processed
|
42
|
+
#
|
43
|
+
report_metric 'Jobs/Processed', "Jobs", stats.processed
|
44
|
+
|
45
|
+
#
|
46
|
+
# The rate at which jobs are processed per second
|
47
|
+
#
|
48
|
+
report_metric "Jobs/Rate/Processed", "Jobs/Second", @processed.process(stats.processed)
|
49
|
+
|
50
|
+
#
|
51
|
+
# The rate at which jobs failed per second
|
52
|
+
#
|
53
|
+
report_metric "Jobs/Rate/Failed", "Jobs/Second", @total_failed.process(stats.failed)
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
## This is the rakegem gemspec template. Make sure you read and understand
|
2
|
+
## all of the comments. Some sections require modification, and others can
|
3
|
+
## be deleted if you don't need them. Once you understand the contents of
|
4
|
+
## this file, feel free to delete any comments that begin with two hash marks.
|
5
|
+
## You can find comprehensive Gem::Specification documentation, at
|
6
|
+
## http://docs.rubygems.org/read/chapter/20
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.specification_version = 2 if s.respond_to? :specification_version=
|
9
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
10
|
+
s.rubygems_version = '1.3.5'
|
11
|
+
|
12
|
+
## Leave these as is they will be modified for you by the rake gemspec task.
|
13
|
+
## If your rubyforge_project name is different, then edit it and comment out
|
14
|
+
## the sub! line in the Rakefile
|
15
|
+
s.name = 'newrelic_sidekiq_plugin'
|
16
|
+
s.version = '0.0.2'
|
17
|
+
s.date = '2013-08-03'
|
18
|
+
|
19
|
+
## Make sure your summary is short. The description may be as long
|
20
|
+
## as you like.
|
21
|
+
s.summary = "New Relic Sidekiq monitoring plugin"
|
22
|
+
s.description = <<-EOF
|
23
|
+
This is the New Relic plugin for monitoring Sidekiq developed by Falconer Development, LLC
|
24
|
+
EOF
|
25
|
+
|
26
|
+
## List the primary authors. If there are a bunch of authors, it's probably
|
27
|
+
## better to set the email to an email list or something. If you don't have
|
28
|
+
## a custom homepage, consider using your GitHub URL or the like.
|
29
|
+
s.authors = ["Karl Falconer"]
|
30
|
+
s.email = 'karl@falconerdevelopment.com'
|
31
|
+
s.homepage = 'https://github.com/dropstream/newrelic_sidekiq_plugin'
|
32
|
+
|
33
|
+
## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as
|
34
|
+
## require 'NAME.rb' or'/lib/NAME/file.rb' can be as require 'NAME/file.rb'
|
35
|
+
s.require_paths = %w[lib]
|
36
|
+
|
37
|
+
## This sections is only necessary if you have C extensions.
|
38
|
+
#s.require_paths << 'ext'
|
39
|
+
#s.extensions = %w[ext/extconf.rb]
|
40
|
+
|
41
|
+
## If your gem includes any executables, list them here.
|
42
|
+
s.executables = ["newrelic_sidekiq_agent"]
|
43
|
+
|
44
|
+
## Specify any RDoc options here. You'll want to add your README and
|
45
|
+
## LICENSE files to the extra_rdoc_files list.
|
46
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
47
|
+
s.extra_rdoc_files = %w[README.md]
|
48
|
+
|
49
|
+
## List your runtime dependencies here. Runtime dependencies are those
|
50
|
+
## that are needed for an end user to actually USE your code.
|
51
|
+
s.add_dependency('newrelic_plugin', "1.0.3")
|
52
|
+
s.add_dependency('sidekiq', ">= 2.13.0")
|
53
|
+
|
54
|
+
## Leave this section as-is. It will be automatically generated from the
|
55
|
+
## contents of your Git repository via the gemspec task. DO NOT REMOVE
|
56
|
+
## THE MANIFEST COMMENTS, they are used as delimiters by the task.
|
57
|
+
# = MANIFEST =
|
58
|
+
s.files = %w[
|
59
|
+
Gemfile
|
60
|
+
README.md
|
61
|
+
bin/newrelic_sidekiq_agent
|
62
|
+
config/newrelic_plugin.yml.example
|
63
|
+
lib/newrelic_sidekiq_agent.rb
|
64
|
+
newrelic_sidekiq_plugin.gemspec
|
65
|
+
]
|
66
|
+
# = MANIFEST =
|
67
|
+
|
68
|
+
## Test files will be grabbed from the file list. Make sure the path glob
|
69
|
+
## matches what you actually use.
|
70
|
+
s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
|
71
|
+
end
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: newrelic_sidekiq_plugin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Karl Falconer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-08-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: newrelic_plugin
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.0.3
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.3
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sidekiq
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.13.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.13.0
|
41
|
+
description: ! 'This is the New Relic plugin for monitoring Sidekiq developed by Falconer
|
42
|
+
Development, LLC
|
43
|
+
|
44
|
+
'
|
45
|
+
email: karl@falconerdevelopment.com
|
46
|
+
executables:
|
47
|
+
- newrelic_sidekiq_agent
|
48
|
+
extensions: []
|
49
|
+
extra_rdoc_files:
|
50
|
+
- README.md
|
51
|
+
files:
|
52
|
+
- Gemfile
|
53
|
+
- README.md
|
54
|
+
- bin/newrelic_sidekiq_agent
|
55
|
+
- config/newrelic_plugin.yml.example
|
56
|
+
- lib/newrelic_sidekiq_agent.rb
|
57
|
+
- newrelic_sidekiq_plugin.gemspec
|
58
|
+
homepage: https://github.com/dropstream/newrelic_sidekiq_plugin
|
59
|
+
licenses: []
|
60
|
+
metadata: {}
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options:
|
63
|
+
- --charset=UTF-8
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 2.0.6
|
79
|
+
signing_key:
|
80
|
+
specification_version: 2
|
81
|
+
summary: New Relic Sidekiq monitoring plugin
|
82
|
+
test_files: []
|