newrelic_patron 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +10 -0
- data/lib/newrelic_patron/instrumentation.rb +27 -0
- data/lib/newrelic_patron/version.rb +8 -0
- data/lib/newrelic_patron.rb +1 -0
- data/newrelic-patron.gemspec +23 -0
- metadata +78 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 103804683aaa25c2c631b80b6a906e6bf34acddd
|
4
|
+
data.tar.gz: ac07e47ff2a6685ff685857ffef334fbf1f23fc3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8ffd1f60a5a26e61ef2e98399321f11f63ccb3a6b8af462b65b18a9940b0f4d32b2bf2e77c7bb92ff051e9497a4855bc251c875a61b7611ed3d3344be208e6b7
|
7
|
+
data.tar.gz: ff4bae9c55404447f1eeefa83ca35d4d05e7e4e1596bc866e375576f4901292bfec0db12f32bed0a4c213d11da80dd1b581addbb7a2ff7790bea0c286020051e
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Evgeny Dudin
|
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,10 @@
|
|
1
|
+
# newrelic-patron
|
2
|
+
NewRelic instrumentation for patron http client - tracking http calls made by patron as external transactions
|
3
|
+
|
4
|
+
inspired by https://github.com/Viximo/newrelic-faraday
|
5
|
+
|
6
|
+
# installation
|
7
|
+
gem install newrelic_patron
|
8
|
+
# usage
|
9
|
+
require 'newrelic_rpm'
|
10
|
+
require 'newrelic_patron'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'patron'
|
2
|
+
if defined?(::Patron) and not NewRelic::Control.instance['disable_patron'] and not ENV['NEWRELIC_ENABLE'].to_s =~ /false|off|no/i
|
3
|
+
::Patron::Session.class_eval do
|
4
|
+
def request_with_newrelic_trace(action, url, headers, options = {})
|
5
|
+
newrelic_host = parse_host_for_newrelic url
|
6
|
+
metrics = ["External/#{newrelic_host}/Faraday::Connection/#{action}", "External/#{newrelic_host}/all", "External/all"]
|
7
|
+
if NewRelic::Agent::Transaction.recording_web_transaction?
|
8
|
+
metrics << "External/allWeb"
|
9
|
+
else
|
10
|
+
metrics << "External/allOther"
|
11
|
+
end
|
12
|
+
self.class.trace_execution_scoped metrics do
|
13
|
+
request_without_newrelic_trace(action, url, headers, options)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
alias request_without_newrelic_trace request
|
17
|
+
alias request request_with_newrelic_trace
|
18
|
+
|
19
|
+
def parse_host_for_newrelic(url)
|
20
|
+
begin
|
21
|
+
URI.parse(base_url.empty? ? url : File.join(base_url, url)).host.to_s
|
22
|
+
rescue
|
23
|
+
''
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'newrelic_patron/instrumentation'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
$LOAD_PATH.unshift 'lib'
|
2
|
+
require "newrelic_patron/version"
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "newrelic_patron"
|
6
|
+
s.version = NewrelicPatron::VERSION::STRING
|
7
|
+
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
|
+
s.authors = ["Evgeny Dudin"]
|
10
|
+
s.description = "Patron instrumentation for Newrelic."
|
11
|
+
s.email = ["nagliyvred@gmail.com"]
|
12
|
+
s.has_rdoc = false
|
13
|
+
s.files = %w( README.md LICENSE newrelic-patron.gemspec )
|
14
|
+
s.files += Dir.glob("lib/**/*")
|
15
|
+
s.homepage = "http://github.com/nagliyvred/newrelic-patron"
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubygems_version = "1.5.3"
|
18
|
+
s.summary = "Patron instrumentation for Newrelic."
|
19
|
+
s.license = "MIT"
|
20
|
+
|
21
|
+
s.add_dependency(%q<patron>, ["~> 0"])
|
22
|
+
s.add_dependency(%q<newrelic_rpm>, ["~> 3.0"])
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: newrelic_patron
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Evgeny Dudin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: patron
|
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: newrelic_rpm
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
41
|
+
description: Patron instrumentation for Newrelic.
|
42
|
+
email:
|
43
|
+
- nagliyvred@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- LICENSE
|
49
|
+
- README.md
|
50
|
+
- lib/newrelic_patron.rb
|
51
|
+
- lib/newrelic_patron/instrumentation.rb
|
52
|
+
- lib/newrelic_patron/version.rb
|
53
|
+
- newrelic-patron.gemspec
|
54
|
+
homepage: http://github.com/nagliyvred/newrelic-patron
|
55
|
+
licenses:
|
56
|
+
- MIT
|
57
|
+
metadata: {}
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options: []
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
requirements: []
|
73
|
+
rubyforge_project:
|
74
|
+
rubygems_version: 2.4.3
|
75
|
+
signing_key:
|
76
|
+
specification_version: 4
|
77
|
+
summary: Patron instrumentation for Newrelic.
|
78
|
+
test_files: []
|