newrelic-faraday 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2010 Viximo, Inc.
2
+
3
+ The MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,11 @@
1
+ = newrelic-faraday
2
+
3
+ * http://github.com/Viximo/newrelic-faraday
4
+
5
+ == DESCRIPTION:
6
+
7
+ Faraday instrumentation for Newrelic.
8
+
9
+ == INSTALL:
10
+
11
+ * gem install newrelic-faraday
@@ -0,0 +1 @@
1
+ require 'newrelic_faraday/instrumentation'
@@ -0,0 +1,27 @@
1
+ if defined?(::Faraday) and not NewRelic::Control.instance['disable_faraday']
2
+ Faraday::Connection.class_eval do
3
+ def run_request_with_newrelic_trace(method, url, params, headers, &block)
4
+ newrelic_host = parse_host_for_newrelic url
5
+ metrics = ["External/#{newrelic_host}/Faraday::Connection/#{method}", "External/#{newrelic_host}/all", "External/all"]
6
+ if NewRelic::Agent::Instrumentation::MetricFrame.recording_web_transaction?
7
+ metrics << "External/allWeb"
8
+ else
9
+ metrics << "External/allOther"
10
+ end
11
+ self.class.trace_execution_scoped metrics do
12
+ run_request_without_newrelic_trace(method, url, params, headers, &block)
13
+ end
14
+ end
15
+ alias run_request_without_newrelic_trace run_request
16
+ alias run_request run_request_with_newrelic_trace
17
+
18
+ def parse_host_for_newrelic(url)
19
+ begin
20
+ return host if host
21
+ URI(url).host.to_s
22
+ rescue
23
+ ''
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,8 @@
1
+ module NewrelicFaraday
2
+ module VERSION
3
+ MAJOR = '0'
4
+ MINOR = '6'
5
+ PATCH = '1'
6
+ STRING = [MAJOR, MINOR, PATCH].join('.')
7
+ end
8
+ end
@@ -0,0 +1,43 @@
1
+ $LOAD_PATH.unshift 'lib'
2
+ require "newrelic_faraday/version"
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "newrelic-faraday"
6
+ s.version = NewrelicFaraday::VERSION::STRING
7
+
8
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
+ s.authors = ["Eric Abbott"]
10
+ s.date = "2012-03-22"
11
+ s.description = "Faraday instrumentation for Newrelic."
12
+ s.email = ["eric.abbott@viximo.com"]
13
+ s.has_rdoc = false
14
+ s.files = %w( README.rdoc LICENSE newrelic-faraday.gemspec )
15
+ s.files += Dir.glob("lib/**/*")
16
+ s.homepage = "http://github.com/Viximo/newrelic-faraday"
17
+ s.require_paths = ["lib"]
18
+ s.rubyforge_project = "newrelic-faraday"
19
+ s.rubygems_version = "1.5.3"
20
+ s.summary = "Faraday instrumentation for Newrelic."
21
+ s.license = "MIT"
22
+
23
+ if s.respond_to? :specification_version then
24
+ s.specification_version = 3
25
+
26
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
27
+ s.add_runtime_dependency(%q<faraday>, ["< 0.8"])
28
+ s.add_runtime_dependency(%q<faraday>, [">= 0.6"])
29
+ s.add_runtime_dependency(%q<newrelic_rpm>, ["~> 3.0"])
30
+ s.add_development_dependency(%q<rdoc>, ["~> 3.10"])
31
+ else
32
+ s.add_dependency(%q<faraday>, ["< 0.8"])
33
+ s.add_dependency(%q<faraday>, [">= 0.6"])
34
+ s.add_dependency(%q<newrelic_rpm>, ["~> 3.0"])
35
+ s.add_dependency(%q<rdoc>, ["~> 3.10"])
36
+ end
37
+ else
38
+ s.add_dependency(%q<faraday>, ["< 0.8"])
39
+ s.add_dependency(%q<faraday>, [">= 0.6"])
40
+ s.add_dependency(%q<newrelic_rpm>, ["~> 3.0"])
41
+ s.add_dependency(%q<rdoc>, ["~> 3.10"])
42
+ end
43
+ end
metadata ADDED
@@ -0,0 +1,132 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: newrelic-faraday
3
+ version: !ruby/object:Gem::Version
4
+ hash: 5
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 6
9
+ - 1
10
+ version: 0.6.1
11
+ platform: ruby
12
+ authors:
13
+ - Eric Abbott
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-03-22 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: faraday
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - <
28
+ - !ruby/object:Gem::Version
29
+ hash: 27
30
+ segments:
31
+ - 0
32
+ - 8
33
+ version: "0.8"
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: faraday
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 7
45
+ segments:
46
+ - 0
47
+ - 6
48
+ version: "0.6"
49
+ type: :runtime
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: newrelic_rpm
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ~>
58
+ - !ruby/object:Gem::Version
59
+ hash: 7
60
+ segments:
61
+ - 3
62
+ - 0
63
+ version: "3.0"
64
+ type: :runtime
65
+ version_requirements: *id003
66
+ - !ruby/object:Gem::Dependency
67
+ name: rdoc
68
+ prerelease: false
69
+ requirement: &id004 !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ~>
73
+ - !ruby/object:Gem::Version
74
+ hash: 19
75
+ segments:
76
+ - 3
77
+ - 10
78
+ version: "3.10"
79
+ type: :development
80
+ version_requirements: *id004
81
+ description: Faraday instrumentation for Newrelic.
82
+ email:
83
+ - eric.abbott@viximo.com
84
+ executables: []
85
+
86
+ extensions: []
87
+
88
+ extra_rdoc_files: []
89
+
90
+ files:
91
+ - README.rdoc
92
+ - LICENSE
93
+ - newrelic-faraday.gemspec
94
+ - lib/newrelic-faraday.rb
95
+ - lib/newrelic_faraday/version.rb
96
+ - lib/newrelic_faraday/instrumentation.rb
97
+ has_rdoc: true
98
+ homepage: http://github.com/Viximo/newrelic-faraday
99
+ licenses:
100
+ - MIT
101
+ post_install_message:
102
+ rdoc_options: []
103
+
104
+ require_paths:
105
+ - lib
106
+ required_ruby_version: !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ hash: 3
112
+ segments:
113
+ - 0
114
+ version: "0"
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ hash: 3
121
+ segments:
122
+ - 0
123
+ version: "0"
124
+ requirements: []
125
+
126
+ rubyforge_project: newrelic-faraday
127
+ rubygems_version: 1.5.3
128
+ signing_key:
129
+ specification_version: 3
130
+ summary: Faraday instrumentation for Newrelic.
131
+ test_files: []
132
+