newrelic-dragonfly 0.0.1

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,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ Mzk2ODE1ZjQ3NWNlZTI0Y2Y2MjdkZWExZmUxOTg1NzYzN2JkMmYyMw==
5
+ data.tar.gz: !binary |-
6
+ MDEwZDYyNDYzZjExZWVkYWM0YjBiOTA1NjRhZjM3ODQzZGQ1NDU1NA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MWQ5M2ZmMmY2NzRlNTExNzk3Y2IwZGVjYWJlMTBkMWQxNmJkZjFiMTgwYzkz
10
+ YjJiOTU5ODNjOWZmMGFiNjI4N2E4NjJiMGQ3MDgzNTUzNTU1MjM1OWJhMmY4
11
+ NTFlZTgyNGRmNjBmYThmODI1NDMzODZmZmZlN2Q0MGYxNTVlZDc=
12
+ data.tar.gz: !binary |-
13
+ Y2M2M2QxZWEzNWUyMjJkOGIwMDIxMDQ0YjJlMjRiZDBhNDg0MTBlN2VjNjAx
14
+ YWE5NDM2ZWQxODA4MTMzMWJlMzkxOWI3ZDAwNmJjNTUyZmVhNzBjODhmNTg3
15
+ N2M1YTQzMDNlNWE4NzQwYWM5OTcwOGE2YTU1YTRmZjE3ZTk1ZGY=
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in newrelic-dragonfly.gemspec
4
+ gemspec
5
+
6
+ group :test do
7
+ gem 'pry-debugger'
8
+ gem 'rack-test'
9
+ gem 'rspec'
10
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 miyucy
2
+
3
+ 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.md ADDED
@@ -0,0 +1,29 @@
1
+ # Newrelic::Dragonfly
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'newrelic-dragonfly'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install newrelic-dragonfly
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
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 'Add 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,5 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new
5
+ task default: :spec
@@ -0,0 +1,146 @@
1
+ require 'newrelic_rpm'
2
+
3
+ DependencyDetection.defer do
4
+ @name = :dragonfly
5
+
6
+ depends_on do
7
+ defined?(::Dragonfly) and not NewRelic::Control.instance['disable_dragonfly']
8
+ end
9
+
10
+ executes do
11
+ NewRelic::Agent.logger.debug 'Installing Dragonfly instrumentation'
12
+ end
13
+
14
+ executes do
15
+ class Dragonfly::App
16
+ include NewRelic::Agent::Instrumentation::Rack
17
+ end
18
+ end
19
+
20
+ executes do
21
+ class Dragonfly::Server
22
+ include ::NewRelic::Agent::MethodTracer
23
+ add_method_tracer :call
24
+ end
25
+ end
26
+
27
+ executes do
28
+ class Dragonfly::Job::Step
29
+ include ::NewRelic::Agent::MethodTracer
30
+ end
31
+ [
32
+ Dragonfly::Job::Fetch,
33
+ Dragonfly::Job::Process,
34
+ Dragonfly::Job::Encode,
35
+ Dragonfly::Job::Generate,
36
+ Dragonfly::Job::FetchFile,
37
+ Dragonfly::Job::FetchUrl
38
+ ].each do |klass|
39
+ klass.class_eval do
40
+ add_method_tracer :apply
41
+ end
42
+ end
43
+ end
44
+
45
+ executes do
46
+ class Dragonfly::Analyser
47
+ include NewRelic::Agent::MethodTracer
48
+ add_method_tracer :analyse
49
+ end
50
+ class Dragonfly::Encoder
51
+ include NewRelic::Agent::MethodTracer
52
+ add_method_tracer :encode
53
+ end
54
+ class Dragonfly::Generator
55
+ include NewRelic::Agent::MethodTracer
56
+ add_method_tracer :generate
57
+ end
58
+ class Dragonfly::Processor
59
+ include NewRelic::Agent::MethodTracer
60
+ add_method_tracer :process
61
+ end
62
+ module Dragonfly::Shell
63
+ include NewRelic::Agent::MethodTracer
64
+ add_method_tracer :run
65
+ end
66
+ end
67
+
68
+ executes do
69
+ class Dragonfly::ImageMagick::Analyser
70
+ include NewRelic::Agent::MethodTracer
71
+ add_method_tracer :width
72
+ add_method_tracer :height
73
+ add_method_tracer :aspect_ratio
74
+ add_method_tracer :portrait?
75
+ add_method_tracer :portrait
76
+ add_method_tracer :landscape?
77
+ add_method_tracer :landscape
78
+ add_method_tracer :depth
79
+ add_method_tracer :number_of_colours
80
+ add_method_tracer :number_of_colors
81
+ add_method_tracer :format
82
+ add_method_tracer :image?
83
+ end
84
+ class Dragonfly::ImageMagick::Encoder
85
+ include NewRelic::Agent::MethodTracer
86
+ add_method_tracer :encode
87
+ end
88
+ class Dragonfly::ImageMagick::Generator
89
+ include NewRelic::Agent::MethodTracer
90
+ add_method_tracer :plain
91
+ add_method_tracer :plasma
92
+ add_method_tracer :text
93
+ end
94
+ class Dragonfly::ImageMagick::Processor
95
+ include NewRelic::Agent::MethodTracer
96
+ add_method_tracer :resize
97
+ add_method_tracer :auto_orient
98
+ add_method_tracer :crop
99
+ add_method_tracer :flip
100
+ add_method_tracer :flop
101
+ add_method_tracer :greyscale
102
+ add_method_tracer :grayscale
103
+ add_method_tracer :resize_and_crop
104
+ add_method_tracer :rotate
105
+ add_method_tracer :strip
106
+ add_method_tracer :thumb
107
+ add_method_tracer :convert
108
+ end
109
+ module Dragonfly::ImageMagick::Utils
110
+ include NewRelic::Agent::MethodTracer
111
+ add_method_tracer :convert
112
+ add_method_tracer :identify
113
+ add_method_tracer :raw_identify
114
+ end
115
+ end
116
+
117
+ executes do
118
+ class Dragonfly::DataStorage::FileDataStore
119
+ include NewRelic::Agent::MethodTracer
120
+ add_method_tracer :store
121
+ add_method_tracer :retrieve
122
+ add_method_tracer :destroy
123
+ end
124
+ end
125
+ end
126
+
127
+ DependencyDetection.defer do
128
+ @name = :dragonfly_s3datastore
129
+
130
+ depends_on do
131
+ defined?(::Fog) and not NewRelic::Control.instance['disable_dragonfly_s3datastore']
132
+ end
133
+
134
+ executes do
135
+ NewRelic::Agent.logger.debug 'Installing Dragonfly instrumentation'
136
+ end
137
+
138
+ executes do
139
+ class Dragonfly::DataStorage::S3DataStore
140
+ include NewRelic::Agent::MethodTracer
141
+ add_method_tracer :store
142
+ add_method_tracer :retrieve
143
+ add_method_tracer :destroy
144
+ end
145
+ end
146
+ end
@@ -0,0 +1,5 @@
1
+ module Newrelic
2
+ module Dragonfly
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ require "newrelic/dragonfly/version"
2
+ require "newrelic/dragonfly/instrumentation/instrumentation"
3
+
4
+ module Newrelic
5
+ module Dragonfly
6
+ end
7
+ end
@@ -0,0 +1 @@
1
+ require "newrelic/dragonfly"
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'newrelic/dragonfly/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "newrelic-dragonfly"
8
+ spec.version = Newrelic::Dragonfly::VERSION
9
+ spec.authors = ["miyucy"]
10
+ spec.email = ["fistfvck@gmail.com"]
11
+ spec.description = %q{newrelic instrument for dragonfly}
12
+ spec.summary = %q{newrelic instrument for dragonfly}
13
+ spec.homepage = "https://github.com/miyucy/newrelic-dragonflyg"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_dependency "newrelic_rpm"
24
+ spec.add_dependency "dragonfly"
25
+ end
Binary file
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe Newrelic::Dragonfly do
4
+ include Rack::Test::Methods
5
+
6
+ let(:app) { Dragonfly[:images].configure_with(:imagemagick) }
7
+ let(:uid) { app.store fixture('sample.png') }
8
+
9
+ let(:agent) { NewRelic::Agent.instance }
10
+
11
+ it 'include rack instrumentation' do
12
+ get app.create.fetch(uid).url
13
+ agent.transaction_sampler.last_sample.to_s.should include 'Controller/Rack/Dragonfly::App'
14
+ end
15
+
16
+ it 'include job instrumentation' do
17
+ get app.create.fetch(uid).process(:thumb, '32x32').encode(:jpg).url
18
+ agent.transaction_sampler.last_sample.to_s.should include 'Dragonfly::Job::Fetch'
19
+ agent.transaction_sampler.last_sample.to_s.should include 'Dragonfly::Job::Process'
20
+ agent.transaction_sampler.last_sample.to_s.should include 'Dragonfly::Job::Encode'
21
+ end
22
+ end
@@ -0,0 +1,25 @@
1
+ require 'rubygems'
2
+ require 'newrelic_rpm'
3
+ require 'dragonfly'
4
+ require 'bundler/setup'
5
+ Bundler.require :default, :test
6
+
7
+ RSpec.configure do |config|
8
+ config.before(:suite) do
9
+ Dragonfly[:images].configure_with(:imagemagick)
10
+ end
11
+
12
+ config.before(:suite) do
13
+ NewRelic::Agent.manual_start
14
+ DependencyDetection.detect!
15
+ end
16
+
17
+ config.before(:each) do
18
+ @engine = NewRelic::Agent.instance.stats_engine
19
+ @engine.clear_stats
20
+ end
21
+ end
22
+
23
+ def fixture(name)
24
+ File.new(File.expand_path(File.join(__FILE__, '..', 'fixtures', name)))
25
+ end
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: newrelic-dragonfly
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - miyucy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-08-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: newrelic_rpm
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: dragonfly
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: newrelic instrument for dragonfly
70
+ email:
71
+ - fistfvck@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - lib/newrelic-dragonfly.rb
82
+ - lib/newrelic/dragonfly.rb
83
+ - lib/newrelic/dragonfly/instrumentation/instrumentation.rb
84
+ - lib/newrelic/dragonfly/version.rb
85
+ - newrelic-dragonfly.gemspec
86
+ - spec/fixtures/sample.png
87
+ - spec/instrumentation_spec.rb
88
+ - spec/spec_helper.rb
89
+ homepage: https://github.com/miyucy/newrelic-dragonflyg
90
+ licenses:
91
+ - MIT
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.0.6
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: newrelic instrument for dragonfly
113
+ test_files:
114
+ - spec/fixtures/sample.png
115
+ - spec/instrumentation_spec.rb
116
+ - spec/spec_helper.rb