copperegg-apm 1.0.0.pre4 → 1.0.0.pre5
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 +4 -4
- data/README.md +25 -6
- data/copperegg_apm_test.db +0 -0
- data/lib/copperegg/apm.rb +1 -1
- data/lib/copperegg/apm/benchmark.rb +5 -9
- data/lib/copperegg/apm/{engine.rb → railtie.rb} +4 -1
- data/lib/copperegg/apm/version.rb +1 -1
- data/lib/helpers/benchmark_methods_table.rb +65 -0
- data/lib/helpers/reveal_cloud.rb +19 -0
- data/screenshot02.png +0 -0
- data/spec/apm_spec.rb +2 -1
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e143cece9e590383a13e4f8a29a5f3e6a8a39fe
|
4
|
+
data.tar.gz: b4fc0574c45b9dd1a838b54e515c5c79178d8b3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64aec00ee6e653dd59884633de9824fce8ee4327e2328e8580a45939e8b69aeddc1bffb5c02914028a354515243d42af849ad823a82c7ada0ab0a9b6e1442487
|
7
|
+
data.tar.gz: 77dc00611f2344497ed8621b3f185025cfe59faf60bd31a050128e5dcc26d883d7f8ba56c434c0471eb7d1a96c8a23daf4da2cb93397f52fab52e3ad1832ff57
|
data/README.md
CHANGED
@@ -8,9 +8,17 @@ Monitor the performance of your application with code instrumentation and except
|
|
8
8
|
|
9
9
|
## Getting Started
|
10
10
|
|
11
|
-
###
|
11
|
+
### Prerequisites
|
12
12
|
|
13
|
-
|
13
|
+
To get started monitoring your project's code, you'll need to complete the following steps:
|
14
|
+
|
15
|
+
+ Signup for a [CopperEgg Account](http://copperegg.com/copperegg-signup/)
|
16
|
+
+ Install [RevealCloud](http://copperegg.com/revealcloud-server-monitoring/), CopperEgg's server monitoring tool
|
17
|
+
+ Create an App under your CopperEgg Account, as described below
|
18
|
+
|
19
|
+
### Create An App Under Your CopperEgg Account
|
20
|
+
|
21
|
+

|
14
22
|
|
15
23
|
Login to your account at [CopperEgg.com](https://app.copperegg.com/login) and click on the `Apps` tag to create a new App. An App represents your existing application. Give it a descriptive name like 'MySaaSApp.com'.
|
16
24
|
|
@@ -44,9 +52,9 @@ From your project's root directory, run `copperegg-apm-init`. This will create a
|
|
44
52
|
|
45
53
|
Require this file below your other require directives.
|
46
54
|
|
47
|
-
|
55
|
+
## Configuration
|
48
56
|
|
49
|
-
Instrumentation is initiated in your project by calling the `CopperEgg::APM.configure` block.
|
57
|
+
Instrumentation is initiated in your project by calling the `CopperEgg::APM.configure` block. While your application runs, performance data is sent to the RevealCloud tool installed on your server over UDP on port 28344 in either 8 kB packets or at 15-second intervals, whichever comes first. RevealCloud in turn aggregates this data and transmits it to CopperEgg in 60-second intervals. This aggregation and transmission happens outside of your application code and has a negligible impact on your server performance.
|
50
58
|
|
51
59
|
The auto-generated configuration script contains the default configuration values.
|
52
60
|
|
@@ -137,7 +145,18 @@ def generate_password(length=16)
|
|
137
145
|
end
|
138
146
|
```
|
139
147
|
|
140
|
-
|
148
|
+
## Viewing Your Performance Data
|
149
|
+
|
150
|
+
Once your application starts, it will take a few minutes before performance data appears in the CopperEgg UI. To view this data, log into your account and navigate to the `Apps` tag. You will see the name of your App listed in the sidebar to the left.
|
151
|
+
|
152
|
+

|
153
|
+
|
154
|
+
## Supported Ruby Versions
|
155
|
+
|
156
|
+
+ 1.8.7 (with the exception of automatic method benchmarking)
|
157
|
+
+ 1.9+
|
158
|
+
|
159
|
+
## Supported Databases
|
141
160
|
|
142
161
|
Database query benchmarking is supported for the following engines:
|
143
162
|
|
@@ -145,7 +164,7 @@ Database query benchmarking is supported for the following engines:
|
|
145
164
|
+ PostgreSQL (via the pg gem)
|
146
165
|
+ SQLite (via the sqlite3 gem)
|
147
166
|
|
148
|
-
|
167
|
+
## Supported Gems For Benchmarking Outbound HTTP Requests
|
149
168
|
|
150
169
|
Outbound HTTP requests performed within your project will be benchmarked from any of the following sources:
|
151
170
|
|
data/copperegg_apm_test.db
CHANGED
Binary file
|
data/lib/copperegg/apm.rb
CHANGED
@@ -15,7 +15,8 @@ module CopperEgg
|
|
15
15
|
|
16
16
|
def configure(&block)
|
17
17
|
Configuration.configure(&block)
|
18
|
-
@@payload_cache = { :
|
18
|
+
@@payload_cache = { :ruby_version => ENV["RUBY_VERSION"],
|
19
|
+
:apm_gem_version => GEM_VERSION,
|
19
20
|
:id => Configuration.instrument_key,
|
20
21
|
:sql => Configuration.benchmark_sql?,
|
21
22
|
:http => Configuration.benchmark_http?,
|
@@ -53,14 +54,8 @@ module CopperEgg
|
|
53
54
|
def benchmarkable_methods
|
54
55
|
return @@benchmarkable_methods if @@benchmarkable_methods.size > 0
|
55
56
|
|
56
|
-
if defined?(::Rails) && Rails.respond_to?(:
|
57
|
-
|
58
|
-
v, $VERBOSE = $VERBOSE, nil
|
59
|
-
if path.include?(Rails.configuration.root.to_s) && DO_NOT_INCLUDE_PATHS.detect {|part| path.include?("/#{part}")}.nil?
|
60
|
-
Dir.glob("#{path}/**/*.rb").each {|f| ActiveSupport::Dependencies::Loadable.require_dependency f, ""}
|
61
|
-
end
|
62
|
-
$VERBOSE = v
|
63
|
-
end
|
57
|
+
if defined?(::Rails) && Rails.respond_to?(:application) && Rails.application.respond_to?(:eager_load!)
|
58
|
+
Rails.application.eager_load!
|
64
59
|
end
|
65
60
|
|
66
61
|
ObjectSpace.each_object(Class) do |class_or_module|
|
@@ -211,6 +206,7 @@ module CopperEgg
|
|
211
206
|
args.first.exception(args[1])
|
212
207
|
end
|
213
208
|
stacktrace = trim_stacktrace(caller)
|
209
|
+
return if stacktrace.length == 0
|
214
210
|
parameters = {:error => "#{exception.class}|#{stacktrace.first}", :stacktrace => "#{exception.message}\n#{stacktrace.join("\n")}", :ts => Time.now.to_i}
|
215
211
|
send_payload(parameters)
|
216
212
|
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module CopperEgg
|
2
|
+
module APM
|
3
|
+
class BenchmarkMethodsTable
|
4
|
+
def benchmarkable_methods
|
5
|
+
@benchmarkable_methods ||= CopperEgg::APM.benchmarkable_methods.sort_by(&:display_name)
|
6
|
+
end
|
7
|
+
|
8
|
+
def excluded_methods
|
9
|
+
benchmarkable_methods.select {|method| method.excluded?}
|
10
|
+
end
|
11
|
+
|
12
|
+
def method_column_width
|
13
|
+
benchmarkable_methods.reduce(0) do |memo, method|
|
14
|
+
method.display_name.size > memo ? method.display_name.size : memo
|
15
|
+
end + column_padding
|
16
|
+
end
|
17
|
+
|
18
|
+
def source_filename_column_width
|
19
|
+
benchmarkable_methods.reduce(0) do |memo, method|
|
20
|
+
method.display_filename.size > memo ? method.display_filename.size : memo
|
21
|
+
end + column_padding
|
22
|
+
end
|
23
|
+
|
24
|
+
def column_padding
|
25
|
+
2
|
26
|
+
end
|
27
|
+
|
28
|
+
def separator
|
29
|
+
"+" + "-"*(method_column_width+1) + "+" + "-"*(source_filename_column_width+1) + "+" + "--------------+"
|
30
|
+
end
|
31
|
+
|
32
|
+
def header_columns
|
33
|
+
"| Method" + " "*(method_column_width - 6).abs + "| Source Location" + " "*(source_filename_column_width - 15).abs + "| Benchmarked? |"
|
34
|
+
end
|
35
|
+
|
36
|
+
def method_columns(method)
|
37
|
+
"| #{method.display_name}" + " "*(method_column_width - method.display_name.size) + "| #{method.display_filename}" + " "*(source_filename_column_width - method.display_filename.size) + "| #{method.excluded? ? "NO " : "YES"} |"
|
38
|
+
end
|
39
|
+
|
40
|
+
def classes_count
|
41
|
+
benchmarkable_methods.map(&:owner).uniq!.size
|
42
|
+
end
|
43
|
+
|
44
|
+
def file_count
|
45
|
+
benchmarkable_methods.map(&:source_filename).uniq!.size
|
46
|
+
end
|
47
|
+
|
48
|
+
def print_table
|
49
|
+
if RUBY_VERSION < "1.9"
|
50
|
+
puts "Method benchmarking is not available in Ruby #{RUBY_VERSION}. It is only available in Ruby 1.9 or later."
|
51
|
+
elsif CopperEgg::APM::Configuration.benchmark_methods_level == :disabled
|
52
|
+
puts "Method benchmarking is disabled. You can enable method benchmarking by setting the benchmark_methods configuration value."
|
53
|
+
elsif benchmarkable_methods.size == 0
|
54
|
+
puts "No methods benchmarked"
|
55
|
+
else
|
56
|
+
puts
|
57
|
+
puts "#{separator}\n#{header_columns}\n#{separator}\n#{benchmarkable_methods.map {|method| method_columns(method)}.join("\n")}\n#{separator}"
|
58
|
+
puts "#{benchmarkable_methods.size} methods defined in #{classes_count} classes across #{file_count} files. #{benchmarkable_methods.size - excluded_methods.size == 1 ? "1 method" : "#{benchmarkable_methods.size - excluded_methods.size} methods"} benchmarked."
|
59
|
+
puts
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
data/screenshot02.png
ADDED
Binary file
|
data/spec/apm_spec.rb
CHANGED
@@ -26,7 +26,8 @@ describe CopperEgg::APM do
|
|
26
26
|
it "should send a payload with version and configuration settings" do
|
27
27
|
Socket.any_instance.should_receive(:send) do |payload_cache, flag|
|
28
28
|
hash = JSON.parse(payload_cache)
|
29
|
-
expect(hash
|
29
|
+
expect(hash.has_key?("ruby_version")).to be_true
|
30
|
+
expect(hash["apm_gem_version"]).to eq CopperEgg::APM::GEM_VERSION
|
30
31
|
expect(hash["id"]).to match(/\A[0-1a-z]{16}\z/i)
|
31
32
|
expect(hash["sql"]).to eq true
|
32
33
|
expect(hash["http"]).to eq true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: copperegg-apm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.pre5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Bradford
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -198,7 +198,6 @@ files:
|
|
198
198
|
- ./lib/copperegg/apm/benchmark.rb
|
199
199
|
- ./lib/copperegg/apm/benchmark_methods_table.rb
|
200
200
|
- ./lib/copperegg/apm/configuration.rb
|
201
|
-
- ./lib/copperegg/apm/engine.rb
|
202
201
|
- ./lib/copperegg/apm/errors.rb
|
203
202
|
- ./lib/copperegg/apm/ethon/easy/operations.rb
|
204
203
|
- ./lib/copperegg/apm/kernel.rb
|
@@ -206,6 +205,7 @@ files:
|
|
206
205
|
- ./lib/copperegg/apm/mysql2/client.rb
|
207
206
|
- ./lib/copperegg/apm/net/http.rb
|
208
207
|
- ./lib/copperegg/apm/pg/connection.rb
|
208
|
+
- ./lib/copperegg/apm/railtie.rb
|
209
209
|
- ./lib/copperegg/apm/restclient/request.rb
|
210
210
|
- ./lib/copperegg/apm/rum.rb
|
211
211
|
- ./lib/copperegg/apm/sqlite3/database.rb
|
@@ -217,10 +217,13 @@ files:
|
|
217
217
|
- ./lib/copperegg-apm.rb
|
218
218
|
- ./lib/generators/copperegg/apm/init_generator.rb
|
219
219
|
- ./lib/generators/copperegg/apm/templates/config.rb
|
220
|
+
- ./lib/helpers/benchmark_methods_table.rb
|
221
|
+
- ./lib/helpers/reveal_cloud.rb
|
220
222
|
- ./performance/mysql2.rb
|
221
223
|
- ./Rakefile
|
222
224
|
- ./README.md
|
223
225
|
- ./screenshot01.png
|
226
|
+
- ./screenshot02.png
|
224
227
|
- ./spec/action_controller_spec.rb
|
225
228
|
- ./spec/apm_spec.rb
|
226
229
|
- ./spec/ethon_spec.rb
|
@@ -291,7 +294,7 @@ rubyforge_project:
|
|
291
294
|
rubygems_version: 2.0.3
|
292
295
|
signing_key:
|
293
296
|
specification_version: 4
|
294
|
-
summary: copperegg-apm-1.0.0.
|
297
|
+
summary: copperegg-apm-1.0.0.pre5
|
295
298
|
test_files:
|
296
299
|
- spec/action_controller_spec.rb
|
297
300
|
- spec/apm_spec.rb
|