newrelic-moped 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'newrelic_rpm'
4
+ gem 'moped'
5
+
6
+ group :development, :test do
7
+ gem 'jeweler', '~> 1.8.3'
8
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,23 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ jeweler (1.8.4)
6
+ bundler (~> 1.0)
7
+ git (>= 1.2.5)
8
+ rake
9
+ rdoc
10
+ json (1.7.3)
11
+ moped (1.1.5)
12
+ newrelic_rpm (3.4.0.1)
13
+ rake (0.9.2.2)
14
+ rdoc (3.12)
15
+ json (~> 1.4)
16
+
17
+ PLATFORMS
18
+ ruby
19
+
20
+ DEPENDENCIES
21
+ jeweler (~> 1.8.3)
22
+ moped
23
+ newrelic_rpm
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Pipewise, Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,7 @@
1
+ newrelic-moped
2
+ ==============
3
+
4
+ Adds New Relic instrumentation to Moped
5
+
6
+ Adds support for recording database operations as part of the New Relic web transactions. It does not add data to the
7
+ Database view in New Relic, or instrument Active Record activity.
data/Rakefile ADDED
@@ -0,0 +1,39 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ require './lib/newrelic-moped/version.rb'
6
+
7
+ begin
8
+ Bundler.setup(:default, :development)
9
+ rescue Bundler::BundlerError => e
10
+ $stderr.puts e.message
11
+ $stderr.puts "Run `bundle install` to install missing gems"
12
+ exit e.status_code
13
+ end
14
+ require 'rake'
15
+
16
+ require 'jeweler'
17
+ Jeweler::Tasks.new do |gem|
18
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
19
+ gem.name = "newrelic-moped"
20
+ gem.homepage = "http://github.com/joinwire/newrelic-moped"
21
+ gem.license = "MIT"
22
+ gem.summary = %Q{New Relic instrumentation for Moped}
23
+ gem.description = %Q{Adds support for recording database operations in your web transactions. It does not add data
24
+ to the Database view in New Relic, nor instrument Active Record activity. }
25
+ gem.email = "daren@pipewise.com"
26
+ gem.authors = ["Daren Desjardins"]
27
+ # dependencies defined in Gemfile
28
+ end
29
+ Jeweler::RubygemsDotOrgTasks.new
30
+
31
+ require 'rdoc/task'
32
+ Rake::RDocTask.new do |rdoc|
33
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
34
+
35
+ rdoc.rdoc_dir = 'rdoc'
36
+ rdoc.title = "newrelic-moped #{version}"
37
+ rdoc.rdoc_files.include('README*')
38
+ rdoc.rdoc_files.include('lib/**/*.rb')
39
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.2
@@ -0,0 +1,41 @@
1
+ require 'newrelic_rpm'
2
+ require 'new_relic/agent/method_tracer'
3
+
4
+ DependencyDetection.defer do
5
+ @name = :moped
6
+
7
+ depends_on do
8
+ defined?(::Moped) and not NewRelic::Control.instance['disable_moped']
9
+ end
10
+
11
+ executes do
12
+ NewRelic::Agent.logger.debug 'Installing Moped instrumentation'
13
+ end
14
+
15
+ executes do
16
+ Moped::Node.class_eval do
17
+ def logging_with_newrelic_trace(operations, &blk)
18
+ log_statement = operations.first.log_inspect
19
+ collection = "Unknown"
20
+ if operations.first.respond_to?(:collection)
21
+ collection = operations.first.collection
22
+ end
23
+ operation_name = log_statement.split[0]
24
+ if operation_name == 'COMMAND' && log_statement.include?(":mapreduce")
25
+ operation_name = 'MAPREDUCE'
26
+ collection = log_statement[/:mapreduce=>"([^"]+)/,1]
27
+ end
28
+
29
+ self.class.trace_execution_scoped("Database/#{collection}/#{operation_name}") do
30
+ t0 = Time.now
31
+ res = logging_without_newrelic_trace(operations, &blk)
32
+ NewRelic::Agent.instance.transaction_sampler.notice_sql(log_statement, nil, (Time.now - t0).to_f)
33
+ res
34
+ end
35
+ end
36
+
37
+ alias_method :logging_without_newrelic_trace, :logging
38
+ alias_method :logging, :logging_with_newrelic_trace
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,10 @@
1
+ module NewrelicMoped
2
+ module Version
3
+ MAJOR = 0
4
+ MINOR = 3
5
+ PATCH = 1
6
+ BUILD = nil
7
+
8
+ STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
9
+ end
10
+ end
@@ -0,0 +1,2 @@
1
+ require "newrelic-moped/instrument"
2
+ require "newrelic-moped/version"
@@ -0,0 +1,55 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "newrelic-moped"
8
+ s.version = "0.0.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Daren Desjardins"]
12
+ s.date = "2012-07-24"
13
+ s.description = "Adds support for recording database operations in your web transactions. It does not add data\n to the Database view in New Relic, nor instrument Active Record activity. "
14
+ s.email = "daren@pipewise.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.md"
18
+ ]
19
+ s.files = [
20
+ "Gemfile",
21
+ "Gemfile.lock",
22
+ "LICENSE",
23
+ "README.md",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "lib/newrelic-moped.rb",
27
+ "lib/newrelic-moped/instrument.rb",
28
+ "lib/newrelic-moped/version.rb",
29
+ "newrelic-moped.gemspec"
30
+ ]
31
+ s.homepage = "http://github.com/joinwire/newrelic-moped"
32
+ s.licenses = ["MIT"]
33
+ s.require_paths = ["lib"]
34
+ s.rubygems_version = "1.8.24"
35
+ s.summary = "New Relic instrumentation for Moped"
36
+
37
+ if s.respond_to? :specification_version then
38
+ s.specification_version = 3
39
+
40
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
41
+ s.add_runtime_dependency(%q<newrelic_rpm>, [">= 0"])
42
+ s.add_runtime_dependency(%q<moped>, [">= 0"])
43
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
44
+ else
45
+ s.add_dependency(%q<newrelic_rpm>, [">= 0"])
46
+ s.add_dependency(%q<moped>, [">= 0"])
47
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
48
+ end
49
+ else
50
+ s.add_dependency(%q<newrelic_rpm>, [">= 0"])
51
+ s.add_dependency(%q<moped>, [">= 0"])
52
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
53
+ end
54
+ end
55
+
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: newrelic-moped
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Daren Desjardins
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-07-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: newrelic_rpm
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: moped
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: jeweler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 1.8.3
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.8.3
62
+ description: ! "Adds support for recording database operations in your web transactions.
63
+ It does not add data\n to the Database view in New Relic, nor instrument Active
64
+ Record activity. "
65
+ email: daren@pipewise.com
66
+ executables: []
67
+ extensions: []
68
+ extra_rdoc_files:
69
+ - LICENSE
70
+ - README.md
71
+ files:
72
+ - Gemfile
73
+ - Gemfile.lock
74
+ - LICENSE
75
+ - README.md
76
+ - Rakefile
77
+ - VERSION
78
+ - lib/newrelic-moped.rb
79
+ - lib/newrelic-moped/instrument.rb
80
+ - lib/newrelic-moped/version.rb
81
+ - newrelic-moped.gemspec
82
+ homepage: http://github.com/joinwire/newrelic-moped
83
+ licenses:
84
+ - MIT
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ segments:
96
+ - 0
97
+ hash: -2819576568409640662
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 1.8.24
107
+ signing_key:
108
+ specification_version: 3
109
+ summary: New Relic instrumentation for Moped
110
+ test_files: []