newrelic-zookeeper 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OWFmMzljZDcyYWJkYzEzYWNjZjk1YjljMjU3MWQ1MmEyZmZkNzgyMA==
5
+ data.tar.gz: !binary |-
6
+ YjQxNTU2ODlkOTgyNjU0ZmZiNDBiNTlhOTRkNzdkNDRmZTgzZWFkNA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZTgzYTgyNWQ5MWQ4MGRiY2E4YTE5YzA1ZDM5NDMzZjg2NWRiNGM4ZjY5MmU4
10
+ ZmRkN2U0MzkzNWI4YWVkMTQxMzM2YWJhZjE3Y2VmYjViMzk4NTdlNTk2YTU3
11
+ Mjk0NmYxZmM0ZTViODE3ZWE5OWM3MzhjZGJkODBhYmQ3YjkyYjI=
12
+ data.tar.gz: !binary |-
13
+ ZDZkMzIzN2YwNTBjN2I3NjdhODAzNjY1YjEwODQ1YjU1ZTM0NGFhZTVhYjM4
14
+ OGYyZDZhMTQyMTJlY2U2ZTFkYzFmNjBkYTQ2YTMzMGMxZWFlNGVlY2Y5ZWRj
15
+ YWVkY2RmNWMwMWRkYmNjZmY5ZDk3OWQ4ZTliNDY5MzAwODc1NjA=
@@ -0,0 +1,4 @@
1
+ === 1.0.0 / 2015-11-02
2
+
3
+ * First release!
4
+
@@ -0,0 +1,8 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.md
4
+ Rakefile
5
+ lib/newrelic-zookeeper.rb
6
+ lib/newrelic_zookeeper/instrumentation.rb
7
+ lib/newrelic_zookeeper/version.rb
8
+ newrelic-zookeeper.gemspec
@@ -0,0 +1,49 @@
1
+ # newrelic-zookeeper
2
+
3
+ * http://github.com/jcmfernandes/newrelic-zookeeper
4
+
5
+ ## DESCRIPTION:
6
+
7
+ ZooKeeper instrumentation for New Relic.
8
+
9
+ ## FEATURES/PROBLEMS:
10
+
11
+ * Allows transactions to show time spent inside ZooKeeper requests
12
+
13
+ ## SYNOPSIS:
14
+
15
+ Just add the gem to your project!
16
+
17
+ ## REQUIREMENTS:
18
+
19
+ * newrelic_rpm
20
+ * zookeeper
21
+
22
+ ## INSTALL:
23
+
24
+ $ gem install newrelic-zookeeper
25
+
26
+ ## LICENSE:
27
+
28
+ (The MIT License)
29
+
30
+ Copyright (c) 2015 João Fernandes
31
+
32
+ Permission is hereby granted, free of charge, to any person obtaining
33
+ a copy of this software and associated documentation files (the
34
+ 'Software'), to deal in the Software without restriction, including
35
+ without limitation the rights to use, copy, modify, merge, publish,
36
+ distribute, sublicense, and/or sell copies of the Software, and to
37
+ permit persons to whom the Software is furnished to do so, subject to
38
+ the following conditions:
39
+
40
+ The above copyright notice and this permission notice shall be
41
+ included in all copies or substantial portions of the Software.
42
+
43
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
44
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
45
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
46
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
47
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
48
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
49
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,28 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+
6
+ Hoe.plugin :bundler
7
+ Hoe.plugin :gemspec
8
+ Hoe.plugin :git
9
+
10
+ HOE = Hoe.spec 'newrelic-zookeeper' do
11
+ developer 'Joao Fernandes', 'joao.fernandes@ist.utl.pt'
12
+ license "MIT"
13
+
14
+ dependency "zookeeper", "~> 1.4.0"
15
+ dependency "newrelic_rpm", "~> 3.11"
16
+
17
+ self.readme_file = "README.md"
18
+ end
19
+
20
+ file "#{HOE.spec.name}.gemspec" => ['Rakefile'] do |t|
21
+ puts "Generating #{t.name}"
22
+ File.open(t.name, 'wb') { |f| f.write HOE.spec.to_ruby }
23
+ end
24
+
25
+ desc "Generate or update the standalone gemspec file for the project"
26
+ task :gemspec => ["#{HOE.spec.name}.gemspec"]
27
+
28
+ # vim: syntax=ruby
@@ -0,0 +1 @@
1
+ require 'newrelic_zookeeper/instrumentation'
@@ -0,0 +1,62 @@
1
+ require 'new_relic/agent/method_tracer'
2
+
3
+ DependencyDetection.defer do
4
+ @name = :zookeeper
5
+
6
+ depends_on do
7
+ defined?(::Zookeeper) &&
8
+ !NewRelic::Control.instance['disable_zookeeper'] &&
9
+ ENV['NEWRELIC_ENABLE'].to_s !~ /false|off|no/i
10
+ end
11
+
12
+ executes do
13
+ NewRelic::Agent.logger.info 'Installing ZooKeeper Instrumentation'
14
+ end
15
+
16
+ executes do
17
+ require 'new_relic/agent/datastores'
18
+
19
+ ::Zookeeper::Client.class_eval do
20
+ def _send_to_new_relic(args, elapsed)
21
+ if NewRelic::Control.instance["transaction_tracer.record_sql"] == "obfuscated"
22
+ args = _obfuscate_args(args)
23
+ end
24
+ NewRelic::Agent::Datastores.notice_statement(args.inspect, elapsed)
25
+ end
26
+
27
+ def _obfuscate_args(args)
28
+ args.inject({}) do |r, (k, _)|
29
+ r.update(k => '?')
30
+ end
31
+ end
32
+ end
33
+
34
+ methods = [
35
+ 'get',
36
+ 'set',
37
+ 'get_children',
38
+ 'stat',
39
+ 'create',
40
+ 'delete',
41
+ 'get_acl',
42
+ 'set_acl'
43
+ ]
44
+
45
+ methods.each do |method_name|
46
+ ::Zookeeper::Client.class_eval %Q{
47
+ def call_#{method_name}_with_newrelic_trace(options = {})
48
+ callback = proc do |result, metric, elapsed|
49
+ _send_to_new_relic(options, elapsed)
50
+ end
51
+
52
+ NewRelic::Agent::Datastores.wrap('ZooKeeper', '#{method_name}', nil, callback) do
53
+ call_#{method_name}_without_newrelic_trace options
54
+ end
55
+ end
56
+
57
+ alias_method :call_#{method_name}_without_newrelic_trace, :#{method_name}
58
+ alias_method :#{method_name}, :call_#{method_name}_with_newrelic_trace
59
+ }
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,3 @@
1
+ class NewRelicZookeeper
2
+ VERSION = '1.0.0'
3
+ end
@@ -0,0 +1,42 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # stub: newrelic-zookeeper 1.0.0 ruby lib
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "newrelic-zookeeper"
6
+ s.version = "1.0.0"
7
+
8
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
+ s.require_paths = ["lib"]
10
+ s.authors = ["Joao Fernandes"]
11
+ s.date = "2015-11-03"
12
+ s.description = "ZooKeeper instrumentation for New Relic."
13
+ s.email = ["joao.fernandes@ist.utl.pt"]
14
+ s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.md"]
15
+ s.files = ["History.txt", "Manifest.txt", "README.md", "Rakefile", "lib/newrelic-zookeeper.rb", "lib/newrelic_zookeeper/instrumentation.rb", "lib/newrelic_zookeeper/version.rb", "newrelic-zookeeper.gemspec"]
16
+ s.homepage = "http://github.com/jcmfernandes/newrelic-zookeeper"
17
+ s.licenses = ["MIT"]
18
+ s.rdoc_options = ["--main", "README.md"]
19
+ s.rubygems_version = "2.4.6"
20
+ s.summary = "ZooKeeper instrumentation for New Relic."
21
+
22
+ if s.respond_to? :specification_version then
23
+ s.specification_version = 4
24
+
25
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
+ s.add_runtime_dependency(%q<zookeeper>, ["~> 1.4.0"])
27
+ s.add_runtime_dependency(%q<newrelic_rpm>, ["~> 3.11"])
28
+ s.add_development_dependency(%q<rdoc>, ["~> 4.0"])
29
+ s.add_development_dependency(%q<hoe>, ["~> 3.14"])
30
+ else
31
+ s.add_dependency(%q<zookeeper>, ["~> 1.4.0"])
32
+ s.add_dependency(%q<newrelic_rpm>, ["~> 3.11"])
33
+ s.add_dependency(%q<rdoc>, ["~> 4.0"])
34
+ s.add_dependency(%q<hoe>, ["~> 3.14"])
35
+ end
36
+ else
37
+ s.add_dependency(%q<zookeeper>, ["~> 1.4.0"])
38
+ s.add_dependency(%q<newrelic_rpm>, ["~> 3.11"])
39
+ s.add_dependency(%q<rdoc>, ["~> 4.0"])
40
+ s.add_dependency(%q<hoe>, ["~> 3.14"])
41
+ end
42
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: newrelic-zookeeper
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Joao Fernandes
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-11-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: zookeeper
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 1.4.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 1.4.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: newrelic_rpm
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '3.11'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '3.11'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rdoc
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '4.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '4.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: hoe
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '3.14'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '3.14'
69
+ description: ZooKeeper instrumentation for New Relic.
70
+ email:
71
+ - joao.fernandes@ist.utl.pt
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files:
75
+ - History.txt
76
+ - Manifest.txt
77
+ - README.md
78
+ files:
79
+ - History.txt
80
+ - Manifest.txt
81
+ - README.md
82
+ - Rakefile
83
+ - lib/newrelic-zookeeper.rb
84
+ - lib/newrelic_zookeeper/instrumentation.rb
85
+ - lib/newrelic_zookeeper/version.rb
86
+ - newrelic-zookeeper.gemspec
87
+ homepage: http://github.com/jcmfernandes/newrelic-zookeeper
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options:
93
+ - --main
94
+ - README.md
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.4.6
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: ZooKeeper instrumentation for New Relic.
113
+ test_files: []
114
+ has_rdoc: