newrelic-typhoeus 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/lib/newrelic-typhoeus.rb +40 -0
- data/lib/newrelic-typhoeus/version.rb +5 -0
- data/newrelic-typhoeus.gemspec +20 -0
- metadata +75 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Newrelic::Typhoeus
|
2
|
+
|
3
|
+
NewRelic instrumentation for Typhoeus. Currently instruments POST, GET, HEAD, DELETE, PUT, OPTIONS and PATCH
|
4
|
+
|
5
|
+
## Dependencies
|
6
|
+
1. newrelic_rpm > 3.0
|
7
|
+
2. typhoeus > 0.4.2
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
gem 'newrelic-typhoeus'
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install newrelic-typhoeus
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require "newrelic-typhoeus/version"
|
2
|
+
|
3
|
+
module Newrelic
|
4
|
+
module Typhoeus
|
5
|
+
DependencyDetection.defer do
|
6
|
+
@name = :typhoeus
|
7
|
+
|
8
|
+
depends_on do
|
9
|
+
defined?(::Typhoeus)
|
10
|
+
end
|
11
|
+
|
12
|
+
executes do
|
13
|
+
NewRelic::Agent.logger.debug 'Installing Typhoeus instrumentation'
|
14
|
+
end
|
15
|
+
|
16
|
+
executes do
|
17
|
+
::Typhoeus::Request.instance_eval do
|
18
|
+
%w[post get put delete options head patch].each do |http_method|
|
19
|
+
if respond_to?(http_method)
|
20
|
+
define_singleton_method "#{http_method}_with_newrelic_trace" do |*args|
|
21
|
+
uri = URI.parse(args.first)
|
22
|
+
metrics = ["External/#{uri.host}/Typhoeus/#{http_method.capitalize}","External/#{uri.host}/all"]
|
23
|
+
if NewRelic::Agent::Instrumentation::MetricFrame.recording_web_transaction?
|
24
|
+
metrics << "External/allWeb"
|
25
|
+
else
|
26
|
+
metrics << "External/allOther"
|
27
|
+
end
|
28
|
+
self.class.trace_execution_scoped metrics do
|
29
|
+
send("#{http_method}_without_newrelic_trace", *args)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
eigenclass = class << self; self; end
|
33
|
+
eigenclass.alias_method_chain "#{http_method}", :newrelic_trace
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/newrelic-typhoeus/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Nate Greene"]
|
6
|
+
gem.email = ["nate.greene@sportngin.com"]
|
7
|
+
gem.description = %q{Newrelic instrumentation for Typhoeus}
|
8
|
+
gem.summary = %q{Newrelic instrumentation for Typhoeus}
|
9
|
+
gem.homepage = ""
|
10
|
+
gem.license = "MIT"
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "newrelic-typhoeus"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Newrelic::Typhoeus::VERSION
|
17
|
+
|
18
|
+
gem.add_runtime_dependency(%q<newrelic_rpm>, ["~> 3.0"])
|
19
|
+
gem.add_runtime_dependency(%q<typhoeus>, ["~> 0.4.2"])
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: newrelic-typhoeus
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Nate Greene
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-05-15 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: newrelic_rpm
|
16
|
+
requirement: &70309395161080 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70309395161080
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: typhoeus
|
27
|
+
requirement: &70309395160540 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.4.2
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70309395160540
|
36
|
+
description: Newrelic instrumentation for Typhoeus
|
37
|
+
email:
|
38
|
+
- nate.greene@sportngin.com
|
39
|
+
executables: []
|
40
|
+
extensions: []
|
41
|
+
extra_rdoc_files: []
|
42
|
+
files:
|
43
|
+
- .gitignore
|
44
|
+
- Gemfile
|
45
|
+
- README.md
|
46
|
+
- Rakefile
|
47
|
+
- lib/newrelic-typhoeus.rb
|
48
|
+
- lib/newrelic-typhoeus/version.rb
|
49
|
+
- newrelic-typhoeus.gemspec
|
50
|
+
homepage: ''
|
51
|
+
licenses:
|
52
|
+
- MIT
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options: []
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
requirements: []
|
70
|
+
rubyforge_project:
|
71
|
+
rubygems_version: 1.8.17
|
72
|
+
signing_key:
|
73
|
+
specification_version: 3
|
74
|
+
summary: Newrelic instrumentation for Typhoeus
|
75
|
+
test_files: []
|