newrelic-pjax 0.1.2 → 0.1.3
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 +7 -0
- data/README.md +16 -0
- data/lib/newrelic-pjax/agent/monitoring.rb +8 -18
- data/lib/newrelic-pjax/version.rb +1 -1
- metadata +7 -9
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2e26e8ab34cfc43abd7c27cacbb505d6f9b92ac9
|
4
|
+
data.tar.gz: 039b8ffbe1947f32972aa4042139ba10efc74452
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 62a3905dd739ae2bc2f9b08b6cd8b02a56462dc884d92634c3765cbb4d710f82e76c524190221e9db0f9cd88716e370ea7881ad9373f32c3af57d8b392e70717
|
7
|
+
data.tar.gz: 067bad3359e52868fda3a50c7a3cac00423b3c9f70d8d2e21e6de128a73b42dfaa29fc7522a6103534598737065a2e3d4af77a739275a6ab343a4c5507d57c00
|
data/README.md
CHANGED
@@ -33,6 +33,22 @@ class ApplicationController < ActionController::Base
|
|
33
33
|
end
|
34
34
|
```
|
35
35
|
|
36
|
+
Otherwise if you are using something like `rack-pjax` you can inject the code in your rack layer like this
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
class NewRelicRackPjax < Rack::Pjax
|
40
|
+
def call(env)
|
41
|
+
response = super(env)
|
42
|
+
if pjax? env
|
43
|
+
body = response[2][0]
|
44
|
+
body = "%s%s%s" % [NewRelic::Agent.pjax_timing_start, body, NewRelic::Agent.pjax_timing_end]
|
45
|
+
response[2] = [body]
|
46
|
+
end
|
47
|
+
response
|
48
|
+
end
|
49
|
+
end
|
50
|
+
```
|
51
|
+
|
36
52
|
Next create a PJAX layout like so:
|
37
53
|
|
38
54
|
```
|
@@ -5,37 +5,27 @@ module NewRelic
|
|
5
5
|
module Agent
|
6
6
|
module Monitoring
|
7
7
|
include NewRelic::Agent::BrowserMonitoring
|
8
|
+
|
8
9
|
def pjax_timing_start
|
9
|
-
|
10
|
-
%{<script type="text/javascript">
|
11
|
-
pjaxTiming['firstByte'] = new Date().getTime();
|
12
|
-
</script>
|
13
|
-
}.html_safe
|
10
|
+
if insert_js?
|
11
|
+
%{<script type="text/javascript">pjaxTiming['firstByte'] = new Date().getTime();</script>}.html_safe
|
14
12
|
end
|
15
13
|
end
|
16
14
|
|
17
15
|
def pjax_timing_end
|
18
16
|
config = NewRelic::Agent.instance.beacon_configuration
|
19
17
|
|
20
|
-
if
|
21
|
-
|
22
|
-
NewRelic::Agent.config[:browser_key].nil? ||
|
23
|
-
NewRelic::Agent.config[:browser_key].empty? ||
|
24
|
-
!NewRelic::Agent.is_transaction_traced? ||
|
25
|
-
!NewRelic::Agent.is_execution_traced? ||
|
26
|
-
NewRelic::Agent::TransactionInfo.get.ignore_end_user?
|
27
|
-
return ""
|
18
|
+
if insert_js?
|
19
|
+
pjax_footer_js_string(config)
|
28
20
|
end
|
29
|
-
|
30
|
-
pjax_footer_js_string(config)
|
31
21
|
end
|
32
22
|
|
33
23
|
def pjax_footer_js_string(config)
|
34
|
-
if
|
24
|
+
if current_transaction.start_time
|
35
25
|
%{<script type="text/javascript">
|
36
26
|
pjaxTiming['transactionName'] = '#{browser_monitoring_transaction_name}';
|
37
|
-
pjaxTiming['queueTime'] = #{
|
38
|
-
pjaxTiming['appTime'] = #{
|
27
|
+
pjaxTiming['queueTime'] = #{current_timings.queue_time_in_millis};
|
28
|
+
pjaxTiming['appTime'] = #{current_timings.app_time_in_millis};
|
39
29
|
pjaxTiming['lastByte'] = new Date().getTime();
|
40
30
|
</script>}.html_safe
|
41
31
|
else
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic-pjax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Mario Visic
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-09-21 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: Instrument PJAX requests for New Relic RPM
|
15
14
|
email:
|
@@ -29,27 +28,26 @@ files:
|
|
29
28
|
- newrelic-pjax.gemspec
|
30
29
|
homepage: https://github.com/mariovisic/newrelic-pjax
|
31
30
|
licenses: []
|
31
|
+
metadata: {}
|
32
32
|
post_install_message:
|
33
33
|
rdoc_options: []
|
34
34
|
require_paths:
|
35
35
|
- lib
|
36
36
|
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
-
none: false
|
38
37
|
requirements:
|
39
|
-
- -
|
38
|
+
- - '>='
|
40
39
|
- !ruby/object:Gem::Version
|
41
40
|
version: '0'
|
42
41
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
42
|
requirements:
|
45
|
-
- -
|
43
|
+
- - '>='
|
46
44
|
- !ruby/object:Gem::Version
|
47
45
|
version: '0'
|
48
46
|
requirements: []
|
49
47
|
rubyforge_project:
|
50
|
-
rubygems_version:
|
48
|
+
rubygems_version: 2.0.6
|
51
49
|
signing_key:
|
52
|
-
specification_version:
|
50
|
+
specification_version: 4
|
53
51
|
summary: Adds additional helper methods to the newrelic_rpm gem to allow instrumentation
|
54
52
|
of PJAX requests
|
55
53
|
test_files: []
|