newrelic-hanami 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8460fdeec351ca1b536d70ef1801c3525f53dfb1
4
+ data.tar.gz: f74d28eb7c98124db8e43ccab8177fbfeb7b8439
5
+ SHA512:
6
+ metadata.gz: ae223945b86ab7ec4e38e7d1f9e385241b409916d87c535853c17df57223ef4f16fea0c57f04fbd792a43493ab0eca05bd0130f4725fb00ffa795e7248c72bac
7
+ data.tar.gz: 1c3f665b7e9d8224069c51abfc42b21b30808d36247a722e77a6155498352cdb141dde2cd937fee64025435bc7da02f545a722f88c0698e3bbfb11ea3af945b3
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.1
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Yuri Artemev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,47 @@
1
+ ### NewRelic Hanami
2
+
3
+ ---
4
+
5
+ [![Travis](https://img.shields.io/travis/artemeff/newrelic-hanami.svg)]() [![Code Climate](https://codeclimate.com/github/artemeff/newrelic-hanami/badges/gpa.svg)](https://codeclimate.com/github/artemeff/newrelic-hanami)
6
+
7
+ ---
8
+
9
+ This gem ingrates in hanami-controller and can be used in full-featured hanami framework and with controller only.
10
+
11
+ ```ruby
12
+ gem 'newrelic-hanami'
13
+ ```
14
+
15
+ Add it to your `config.ru`:
16
+
17
+ ```ruby
18
+ require 'newrelic_rpm'
19
+ require 'newrelic-hanami'
20
+
21
+ NewRelic::Agent.manual_start
22
+ ```
23
+
24
+ It should looks like:
25
+
26
+ ```ruby
27
+ require './config/environment'
28
+ require 'newrelic_rpm'
29
+ require 'newrelic-hanami'
30
+
31
+ NewRelic::Agent.manual_start
32
+
33
+ run Hanami::Container.new
34
+
35
+ ```
36
+
37
+ Then add `newrelic.yml` to `config` folder.
38
+
39
+ ---
40
+
41
+ ### Contributing
42
+
43
+ 1. Fork it
44
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
45
+ 3. Commit your changes (`git commit -am 'add some feature'`)
46
+ 4. Push to the branch (`git push origin my-new-feature`)
47
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1,55 @@
1
+ require 'new_relic/agent/instrumentation'
2
+ require 'new_relic/agent/instrumentation/controller_instrumentation'
3
+ require 'hanami/controller'
4
+ require 'rack'
5
+
6
+ module NewRelic
7
+ module Agent
8
+ module Instrumentation
9
+ module Hanami
10
+ include ControllerInstrumentation
11
+
12
+ protected
13
+
14
+ def finish
15
+ perform_action_with_newrelic_trace(_trace_options) do
16
+ super
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def _trace_options
23
+ {
24
+ category: :controller,
25
+ path: "#{request.request_method} #{request.path}",
26
+ request: request,
27
+ params: params.to_h
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+
35
+ DependencyDetection.defer do
36
+ @name = :hanami
37
+
38
+ depends_on do
39
+ defined?(::Hanami) &&
40
+ !::NewRelic::Control.instance['disable_hanami'] &&
41
+ !ENV['DISABLE_NEW_RELIC_HANAMI']
42
+ end
43
+
44
+ executes do
45
+ NewRelic::Agent.logger.info 'Installing Hanami instrumentation'
46
+ end
47
+
48
+ executes do
49
+ ::Hanami::Controller.configure do
50
+ prepare do
51
+ include ::NewRelic::Agent::Instrumentation::Hanami
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,5 @@
1
+ module NewRelic
2
+ module Hanami
3
+ VERSION = '0.4.1'
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require 'newrelic-hanami/version'
2
+ require 'newrelic-hanami/instrument'
@@ -0,0 +1,23 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'newrelic-hanami/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'newrelic-hanami'
7
+ spec.version = NewRelic::Hanami::VERSION
8
+ spec.authors = ['Yuri Artemev']
9
+ spec.email = ['i@artemeff.com']
10
+
11
+ spec.summary = %q{Gem for connecting NewRelic and Hanami}
12
+ spec.homepage = 'https://github.com/artemeff/newrelic-hanami'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.require_paths = ['lib']
17
+
18
+ spec.add_runtime_dependency 'newrelic_rpm'
19
+ spec.add_runtime_dependency 'hanami-controller', '> 0.4.0', '< 0.7.0'
20
+
21
+ spec.add_development_dependency 'rake', '~> 10.0'
22
+ spec.add_development_dependency 'rspec'
23
+ end
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: newrelic-hanami
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.1
5
+ platform: ruby
6
+ authors:
7
+ - Yuri Artemev
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: newrelic_rpm
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: hanami-controller
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.4.0
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: 0.7.0
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">"
42
+ - !ruby/object:Gem::Version
43
+ version: 0.4.0
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: 0.7.0
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '10.0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '10.0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rspec
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ description:
76
+ email:
77
+ - i@artemeff.com
78
+ executables: []
79
+ extensions: []
80
+ extra_rdoc_files: []
81
+ files:
82
+ - ".gitignore"
83
+ - ".rspec"
84
+ - ".travis.yml"
85
+ - Gemfile
86
+ - LICENSE.txt
87
+ - README.md
88
+ - Rakefile
89
+ - lib/newrelic-hanami.rb
90
+ - lib/newrelic-hanami/instrument.rb
91
+ - lib/newrelic-hanami/version.rb
92
+ - newrelic-hanami.gemspec
93
+ homepage: https://github.com/artemeff/newrelic-hanami
94
+ licenses:
95
+ - MIT
96
+ metadata: {}
97
+ post_install_message:
98
+ rdoc_options: []
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ requirements: []
112
+ rubyforge_project:
113
+ rubygems_version: 2.5.1
114
+ signing_key:
115
+ specification_version: 4
116
+ summary: Gem for connecting NewRelic and Hanami
117
+ test_files: []