padrino-rpm 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2011 Florian Gilcher <florian.gilcher@asquera.de>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,14 @@
1
+ ## padrino-rpm: Padrino instrumentation for New Relic RPM
2
+
3
+ Still in the works, but easy to install if you want to try. Add the following to your Gemfile:
4
+
5
+ gem 'padrino' # Padrino needs to be loaded first!
6
+ gem 'padrino-rpm'
7
+
8
+ Run `bundle install` and add a newrelic config to your project:
9
+
10
+ newrelic install "my-app-name"
11
+
12
+ ## Word of warning
13
+
14
+ At the moment, this works for me. Any additions are welcome.
@@ -0,0 +1,11 @@
1
+ # NewRelics standard metric parser turns the controller
2
+ # name test into TestController. This fixes this behaviour.
3
+ module NewRelic
4
+ module MetricParser
5
+ class Controller < NewRelic::MetricParser::MetricParser
6
+ def controller_name
7
+ segments[1..-2].join('/')
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ require 'new_relic/control/frameworks/ruby'
2
+
3
+ module NewRelic::Control::Frameworks #:nodoc:
4
+ class Padrino < NewRelic::Control::Frameworks::Ruby
5
+ def init_config(options)
6
+ super
7
+ self['app_name'] ||= 'Padrino Application'
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,43 @@
1
+ puts "Warning! The padrino-rpm gem should be loaded before the newrelic_rpm gem." if defined?(::NewRelic) && defined?(::NewRelic::Control)
2
+
3
+ module NewRelic #:nodoc:
4
+ class LocalEnvironment #:nodoc:
5
+ module Padrino
6
+ def discover_framework
7
+ if defined?(::Padrino)
8
+ @framework = 'padrino'
9
+ else
10
+ super
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+
17
+ module PadrinoRpm
18
+ VERSION = "0.4.0"
19
+
20
+ def self.init!
21
+ NewRelic::Agent.add_instrumentation(
22
+ File.join(
23
+ File.dirname(__FILE__),
24
+ 'padrino-rpm/instrumentation/**/*.rb'
25
+ )
26
+ )
27
+
28
+ require "ext/metric_parser"
29
+ end
30
+ end
31
+
32
+ Padrino.after_load do
33
+ PadrinoRpm.init!
34
+ end
35
+
36
+ Padrino.before_load do
37
+ require 'new_relic/rack_app'
38
+
39
+ if Padrino.env == :development
40
+ Padrino.use NewRelic::Rack::DeveloperMode
41
+ end
42
+ end
43
+
@@ -0,0 +1,33 @@
1
+ require 'new_relic/agent/instrumentation/controller_instrumentation'
2
+
3
+ DependencyDetection.defer do
4
+ depends_on do
5
+ defined?(::Padrino)
6
+ end
7
+
8
+ executes do
9
+ Padrino::Application.class_eval do
10
+ include PadrinoRpm::Instrumentation::Padrino
11
+ end
12
+ end
13
+ end
14
+
15
+ module PadrinoRpm
16
+ module Instrumentation
17
+ module Padrino
18
+ include NewRelic::Agent::Instrumentation::ControllerInstrumentation
19
+
20
+ def route_eval(*args, &block)
21
+ name = @route.as_options[:name]
22
+ short_name = name.to_s.split(/_/).last
23
+
24
+ perform_action_with_newrelic_trace(:category => :controller, :name => short_name, :params => request.params, :class_name => @route.controller) do
25
+ route_eval_without_newrelic(*args, &block) # RPM loads the sinatra plugin to eagerly
26
+ end
27
+ end
28
+
29
+ end #PadrinoRpm::Instrumentation::Padrino
30
+ end
31
+ end
32
+
33
+ DependencyDetection.detect!
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{padrino-rpm}
5
+
6
+ s.version = "0.4.0"
7
+
8
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
+ s.authors = ["Florian Gilcher"]
10
+ s.date = %q{2011-05-17}
11
+ s.description = %q{A gem for monitoring Padrino with newrelic rpm}
12
+ s.email = %q{florian.gilcher@asquera.de}
13
+
14
+ s.homepage = %q{http://github.com/Asquera/padrino-rpm}
15
+ s.require_paths = ["lib"]
16
+ s.summary = %q{Padrino Instrumentation for New Relic RPM}
17
+ s.files = `git ls-files`.split("\n")
18
+
19
+ s.add_dependency(%q<newrelic_rpm>, [">= 3.0.0"])
20
+ end
21
+
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: padrino-rpm
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Florian Gilcher
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-05-17 00:00:00.000000000 +02:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: newrelic_rpm
17
+ requirement: &2165545140 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 3.0.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *2165545140
26
+ description: A gem for monitoring Padrino with newrelic rpm
27
+ email: florian.gilcher@asquera.de
28
+ executables: []
29
+ extensions: []
30
+ extra_rdoc_files: []
31
+ files:
32
+ - LICENSE
33
+ - README.md
34
+ - lib/ext/metric_parser.rb
35
+ - lib/new_relic/control/frameworks/padrino.rb
36
+ - lib/padrino-rpm.rb
37
+ - lib/padrino-rpm/instrumentation/padrino.rb
38
+ - padrino-rpm.gemspec
39
+ has_rdoc: true
40
+ homepage: http://github.com/Asquera/padrino-rpm
41
+ licenses: []
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubyforge_project:
60
+ rubygems_version: 1.6.2
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: Padrino Instrumentation for New Relic RPM
64
+ test_files: []