newrelic-pjax 0.1.1 → 0.1.2
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.
- data/README.md +49 -3
- data/lib/newrelic-pjax/agent/monitoring.rb +3 -2
- data/lib/newrelic-pjax/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -18,11 +18,57 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
For PJAX requests, instead of rendering no template you'll need to render a PJAX template where we'll return some additional JavaScript to record response timing.
|
22
22
|
|
23
|
-
|
23
|
+
If you're using `pjax_rails` rails then add this to your application controller:
|
24
24
|
|
25
|
-
|
25
|
+
|
26
|
+
``` ruby
|
27
|
+
class ApplicationController < ActionController::Base
|
28
|
+
protected
|
29
|
+
|
30
|
+
def pjax_layout
|
31
|
+
'pjax'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
```
|
35
|
+
|
36
|
+
Next create a PJAX layout like so:
|
37
|
+
|
38
|
+
```
|
39
|
+
# app/views/layouts/pjax.html.erb
|
40
|
+
|
41
|
+
<%= NewRelic::Agent.pjax_timing_start %>
|
42
|
+
<%= yield %>
|
43
|
+
<%= NewRelic::Agent.pjax_timing_end %>
|
44
|
+
|
45
|
+
```
|
46
|
+
|
47
|
+
Lastly in your applications JavaScript you will need to fire off timing information to newrelic once the PJAX request is complete. Here in the example below i'm using the [jquery.waitForImages JavaScript library](https://github.com/alexanderdickson/waitForImages) to calculate front end rendering time by timing how long the images take to render on the page.
|
48
|
+
|
49
|
+
You can find the jquery.waitForImages library here [https://github.com/alexanderdickson/waitForImages](https://github.com/alexanderdickson/waitForImages)
|
50
|
+
|
51
|
+
```coffee
|
52
|
+
# app/assets/javascript/application.js
|
53
|
+
|
54
|
+
#= require jquery
|
55
|
+
#= require jquery.pjax
|
56
|
+
#= require jquery.waitforimages
|
57
|
+
|
58
|
+
$ ->
|
59
|
+
$(document).on 'pjax:start', (xhr) ->
|
60
|
+
window.pjaxTiming = {'navigationStart': new Date().getTime() }
|
61
|
+
|
62
|
+
$(document).on 'pjax:end', (xhr) ->
|
63
|
+
$('#main-inner').waitForImages ->
|
64
|
+
if NREUMQ?
|
65
|
+
currentTime = new Date().getTime()
|
66
|
+
totalBeTime = pjaxTiming['firstByte'] - pjaxTiming['navigationStart']
|
67
|
+
domTime = pjaxTiming['lastByte'] - pjaxTiming['firstByte']
|
68
|
+
feTime = currentTime - pjaxTiming['firstByte']
|
69
|
+
|
70
|
+
NREUM.inlineHit(pjaxTiming['transactionName'], pjaxTiming['queueTime'], pjaxTiming['appTime'], totalBeTime, domTime, feTime)
|
71
|
+
```
|
26
72
|
|
27
73
|
## Contributing
|
28
74
|
|
@@ -18,8 +18,9 @@ module NewRelic
|
|
18
18
|
config = NewRelic::Agent.instance.beacon_configuration
|
19
19
|
|
20
20
|
if config.nil? ||
|
21
|
-
!config.
|
22
|
-
config.
|
21
|
+
!config.enabled? ||
|
22
|
+
NewRelic::Agent.config[:browser_key].nil? ||
|
23
|
+
NewRelic::Agent.config[:browser_key].empty? ||
|
23
24
|
!NewRelic::Agent.is_transaction_traced? ||
|
24
25
|
!NewRelic::Agent.is_execution_traced? ||
|
25
26
|
NewRelic::Agent::TransactionInfo.get.ignore_end_user?
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic-pjax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
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-10-
|
12
|
+
date: 2012-10-16 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Instrument PJAX requests for New Relic RPM
|
15
15
|
email:
|