liebre-newrelic 0.0.4

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b8a4d27cceaecb01d787d4dfa789ee5d51edfa0d
4
+ data.tar.gz: 2308a96fb98167a39a6068f03b483745ad36702c
5
+ SHA512:
6
+ metadata.gz: c90a9496581fe71086b34d6e98d14c686899a1a6decc719553cf7623077c078e400d87cee23a399070170f2b708e6393f05ed5d0e0726ae6806f61eedc452f6a
7
+ data.tar.gz: 9a30aa9585bdcfb0b6ef01bd890a24f4ebc8b955c7da2210aef6ae98aeb38b8c344dbad350a803bb37e78d802ab2471f6e499f11ceddfcfed5a0a310e90cf09b
data/.gitignore ADDED
@@ -0,0 +1,51 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ .ruby-version
47
+ .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
51
+ /nbproject
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in liebre.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,56 @@
1
+ PATH
2
+ remote: ../liebre
3
+ specs:
4
+ liebre (0.1.20)
5
+ bunny (~> 2.5, >= 2.5.1)
6
+
7
+ PATH
8
+ remote: .
9
+ specs:
10
+ liebre-newrelic (0.0.1)
11
+ liebre (~> 0.1, >= 0.1.20)
12
+ newrelic_rpm (~> 3.8, >= 3.8.0)
13
+
14
+ GEM
15
+ remote: https://rubygems.org/
16
+ specs:
17
+ amq-protocol (2.1.0)
18
+ bunny (2.6.3)
19
+ amq-protocol (>= 2.0.1)
20
+ coderay (1.1.1)
21
+ diff-lcs (1.3)
22
+ method_source (0.8.2)
23
+ newrelic_rpm (3.18.1.330)
24
+ pry (0.10.4)
25
+ coderay (~> 1.1.0)
26
+ method_source (~> 0.8.1)
27
+ slop (~> 3.4)
28
+ rake (12.0.0)
29
+ rspec (3.5.0)
30
+ rspec-core (~> 3.5.0)
31
+ rspec-expectations (~> 3.5.0)
32
+ rspec-mocks (~> 3.5.0)
33
+ rspec-core (3.5.4)
34
+ rspec-support (~> 3.5.0)
35
+ rspec-expectations (3.5.0)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.5.0)
38
+ rspec-mocks (3.5.0)
39
+ diff-lcs (>= 1.2.0, < 2.0)
40
+ rspec-support (~> 3.5.0)
41
+ rspec-support (3.5.0)
42
+ slop (3.6.0)
43
+
44
+ PLATFORMS
45
+ ruby
46
+
47
+ DEPENDENCIES
48
+ bundler (~> 1.6)
49
+ liebre!
50
+ liebre-newrelic!
51
+ pry
52
+ rake
53
+ rspec
54
+
55
+ BUNDLED WITH
56
+ 1.12.5
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 THE MOBILE TECHNOLOGY COMPANY LIMITED
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # Liebre NewRelic
2
+
3
+ ## Intro
4
+
5
+ Adds NewRelic instrumentation to Liebre consumers and publishers
@@ -0,0 +1,28 @@
1
+ require 'new_relic/agent/method_tracer'
2
+
3
+ module LiebreNewRelic
4
+ module Instrumentation
5
+ module Consumer
6
+
7
+ def self.included(base)
8
+
9
+ base.class_eval do
10
+ include NewRelic::Agent::Instrumentation::ControllerInstrumentation
11
+
12
+ alias_method :orig_call_consumer, :call_consumer
13
+
14
+ def call_consumer payload, meta
15
+ NewRelic::Agent.set_transaction_name "#{klass.name}/consume"
16
+ orig_call_consumer payload, meta
17
+ end
18
+ add_transaction_tracer :call_consumer, :category => :task
19
+
20
+ end
21
+
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ Liebre::Runner::Starter::RPC.send :include, LiebreNewRelic::Instrumentation::Consumer
28
+ Liebre::Runner::Starter::Consumer.send :include, LiebreNewRelic::Instrumentation::Consumer
@@ -0,0 +1,22 @@
1
+ require 'new_relic/agent/method_tracer'
2
+
3
+ module LiebreNewRelic
4
+ module Instrumentation
5
+
6
+ module Publisher
7
+ def self.included(base)
8
+
9
+ base.class_eval do
10
+ include ::NewRelic::Agent::MethodTracer
11
+
12
+ add_method_tracer :enqueue
13
+ add_method_tracer :enqueue_and_wait
14
+ end
15
+
16
+ end
17
+ end
18
+
19
+ end
20
+ end
21
+
22
+ Liebre::Publisher.send :include, LiebreNewRelic::Instrumentation::Publisher
@@ -0,0 +1,8 @@
1
+ module LiebreNewRelic
2
+ module Instrumentation
3
+
4
+ autoload :Consumer, 'liebre_newrelic/instrumentation/consumer'
5
+ autoload :Publisher, 'liebre_newrelic/instrumentation/publisher'
6
+
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ module LiebreNewRelic
2
+
3
+ VERSION = "0.0.4"
4
+
5
+ end
@@ -0,0 +1,12 @@
1
+ require "liebre_newrelic/version"
2
+ require "liebre"
3
+ require "newrelic_rpm"
4
+
5
+ module LiebreNewRelic
6
+
7
+ autoload :Instrumentation, 'liebre_newrelic/instrumentation'
8
+
9
+ end
10
+
11
+ require 'liebre_newrelic/instrumentation/consumer'
12
+ require 'liebre_newrelic/instrumentation/publisher'
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'liebre_newrelic/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "liebre-newrelic"
8
+ spec.version = LiebreNewRelic::VERSION
9
+ spec.authors = ["graimon"]
10
+ spec.email = ["graimon@gmail.com"]
11
+ spec.summary = %q{A gem to add newrelic instrumentation to liebre}
12
+ spec.homepage = "https://github.com/iadbox/liebre-newrelic"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_runtime_dependency "liebre", '~> 0.1', '>= 0.1.21'
21
+ spec.add_runtime_dependency "newrelic_rpm", '~> 3.8', '>= 3.8.0'
22
+
23
+ spec.add_development_dependency "bundler", '~> 1.6'
24
+ spec.add_development_dependency "rspec"
25
+ spec.add_development_dependency "pry"
26
+ spec.add_development_dependency "rake"
27
+ end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe "Integration" do
4
+
5
+ it do
6
+ binding.pry
7
+
8
+ expect(Liebre::Runner::Starter::Consumer.ancestors).to include LiebreNewRelic::Instrumentation::Consumer
9
+
10
+ expect(Liebre::Publisher.ancestors).to include LiebreNewRelic::Instrumentation::Publisher
11
+
12
+ end
13
+
14
+ end
@@ -0,0 +1,19 @@
1
+ require 'pry'
2
+ require 'liebre_newrelic'
3
+
4
+ RSpec.configure do |config|
5
+
6
+ config.expect_with :rspec do |expectations|
7
+ # Best error messages on chained expectations
8
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
9
+ end
10
+
11
+ config.mock_with :rspec do |mocks|
12
+ # Prevents you from stubbing a method that does not exist on a real object
13
+ mocks.verify_partial_doubles = true
14
+ end
15
+
16
+ config.disable_monkey_patching!
17
+ config.order = :random
18
+
19
+ end
metadata ADDED
@@ -0,0 +1,155 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: liebre-newrelic
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
+ platform: ruby
6
+ authors:
7
+ - graimon
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-02-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: liebre
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.1.21
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.1'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.1.21
33
+ - !ruby/object:Gem::Dependency
34
+ name: newrelic_rpm
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '3.8'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 3.8.0
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '3.8'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 3.8.0
53
+ - !ruby/object:Gem::Dependency
54
+ name: bundler
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '1.6'
60
+ type: :development
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '1.6'
67
+ - !ruby/object:Gem::Dependency
68
+ name: rspec
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ type: :development
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ - !ruby/object:Gem::Dependency
82
+ name: pry
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ - !ruby/object:Gem::Dependency
96
+ name: rake
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ description:
110
+ email:
111
+ - graimon@gmail.com
112
+ executables: []
113
+ extensions: []
114
+ extra_rdoc_files: []
115
+ files:
116
+ - ".gitignore"
117
+ - Gemfile
118
+ - Gemfile.lock
119
+ - LICENSE
120
+ - README.md
121
+ - lib/liebre_newrelic.rb
122
+ - lib/liebre_newrelic/instrumentation.rb
123
+ - lib/liebre_newrelic/instrumentation/consumer.rb
124
+ - lib/liebre_newrelic/instrumentation/publisher.rb
125
+ - lib/liebre_newrelic/version.rb
126
+ - liebre-newrelic.gemspec
127
+ - spec/integration_spec.rb
128
+ - spec/spec_helper.rb
129
+ homepage: https://github.com/iadbox/liebre-newrelic
130
+ licenses:
131
+ - MIT
132
+ metadata: {}
133
+ post_install_message:
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubyforge_project:
149
+ rubygems_version: 2.4.5.1
150
+ signing_key:
151
+ specification_version: 4
152
+ summary: A gem to add newrelic instrumentation to liebre
153
+ test_files:
154
+ - spec/integration_spec.rb
155
+ - spec/spec_helper.rb