garelic 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -21
- data/lib/garelic/middleware.rb +3 -1
- data/lib/garelic/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -12,10 +12,9 @@ Here are some features with pictures:
|
|
12
12
|
- [How has the switch to Ruby 1.9.3 affected response time?](http://twitpic.com/b11mxm/full)
|
13
13
|
- [In which action do we spent most time globaly?](http://twitpic.com/b15l7j/full)
|
14
14
|
- *NEW (in 0.1.0)* [ActiveRecord queries drilldown](http://twitpic.com/b2o26x/full)
|
15
|
+
- *NEW (in 0.2.0)* [Deployment performance comparison](http://twitpic.com/b8ai3l/full)
|
15
16
|
|
16
|
-
|
17
|
-
*This is a proof of concept and will probably break things. Use it at your own risk.*
|
18
|
-
|
17
|
+
Or look at these [slides from a Garelic presentation](http://www.slideshare.net/jsuchal/garelic-google-analytics-as-app-performance-monitoring).
|
19
18
|
|
20
19
|
## Installation
|
21
20
|
|
@@ -25,24 +24,13 @@ It's easy as 1-2-3.
|
|
25
24
|
|
26
25
|
gem 'garelic'
|
27
26
|
|
28
|
-
*Step 2.* Add `<%= Garelic
|
29
|
-
|
30
|
-
<script type="text/javascript">
|
31
|
-
var _gaq = _gaq || [];
|
32
|
-
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);
|
33
|
-
_gaq.push(['_setSiteSpeedSampleRate', 100]);
|
34
|
-
_gaq.push(['_trackPageview']);
|
35
|
-
|
36
|
-
<%= Garelic::Timing %>
|
27
|
+
*Step 2.* Add `<%= Garelic.monitoring 'UA-XXXXXX-X' %>` instrumentation in application layout template (before the closing `</head>` tag) like this:
|
37
28
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
</script>
|
44
|
-
|
45
|
-
(Please note the `_gaq.push(['_setSiteSpeedSampleRate', 100]);` code for better testing.)
|
29
|
+
<head>
|
30
|
+
<!-- other rails stuff -->
|
31
|
+
<%= Garelic.monitoring 'UA-XXXXXX-X' %>
|
32
|
+
<!-- make sure you remove your old GA code! -->
|
33
|
+
</head>
|
46
34
|
|
47
35
|
*Step 3.* Go to Google Analytics > Content > Site Speed > User Timings
|
48
36
|
|
@@ -65,7 +53,6 @@ Enjoy!
|
|
65
53
|
|
66
54
|
## TODO
|
67
55
|
|
68
|
-
- add more fine-grained ActiveRecord instrumentation
|
69
56
|
- add support for adding custom user tracers (e.g. for external services)
|
70
57
|
|
71
58
|
## Contributing
|
data/lib/garelic/middleware.rb
CHANGED
@@ -7,7 +7,9 @@ class Garelic::Middleware
|
|
7
7
|
def call(env)
|
8
8
|
status, headers, response = @app.call(env)
|
9
9
|
|
10
|
-
if headers["Content-Type"] =~ /text\/html|application\/xhtml\+xml/
|
10
|
+
if headers["Content-Type"] =~ /text\/html|application\/xhtml\+xml/ \
|
11
|
+
and response.respond_to?(:body) \
|
12
|
+
and response.body.respond_to?(:gsub)
|
11
13
|
body = response.body.gsub(Garelic::Timing, Garelic.report_user_timing_from_metrics(Garelic::Metrics))
|
12
14
|
response = [body]
|
13
15
|
end
|
data/lib/garelic/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: garelic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-18 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Use Google Analytics for Rails App Performance Monitoring
|
15
15
|
email:
|