quilt_rails 1.9.1 → 1.9.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.
- checksums.yaml +4 -4
- data/README.md +44 -16
- data/lib/quilt_rails/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19ed91c686fab67ad1642a071a8d62214c154c246cf4d8cb4027ac3a50483620
|
4
|
+
data.tar.gz: 73ad8104d3e54a5b3ba56aa912fa7147eaeab671f75e310c5dd1dcb6d297471b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10618fcc4252375f45e54b98ed366c47fa06de9541b57e748081dab0ba66d0817f78e38c4d3a8e23315f2402c79d4dde5c86c85132e3b7e97534a0165166fee0
|
7
|
+
data.tar.gz: 838be176ef13ae501f40c2eb6763a7d0416d42ce6908650dd03ecfdcc6039dc35d7769518b60f977dda0d3fa81cffc10a7e6656beeda9e510c74e4c5587d0321
|
data/README.md
CHANGED
@@ -420,9 +420,9 @@ class PerformanceReportController < ActionController::Base
|
|
420
420
|
def create
|
421
421
|
process_report
|
422
422
|
|
423
|
-
render
|
423
|
+
render(json: { result: 'success' }, status: 200)
|
424
424
|
rescue ActionController::ParameterMissing => error
|
425
|
-
render
|
425
|
+
render(json: { error: error.message }, status: 422)
|
426
426
|
end
|
427
427
|
end
|
428
428
|
```
|
@@ -439,20 +439,17 @@ post '/performance_report', to: 'performance_report#create'
|
|
439
439
|
|
440
440
|
### Add annotations
|
441
441
|
|
442
|
-
Add a [
|
442
|
+
Add a [`usePerformanceMark`](https://github.com/Shopify/quilt/tree/master/packages/react-performance#useperformancemark) call to each of your route-level components.
|
443
443
|
|
444
444
|
```tsx
|
445
445
|
// app/ui/features/Home/Home.tsx
|
446
|
-
import {
|
446
|
+
import {usePerformanceMark} from '@shopify/react-performance';
|
447
447
|
|
448
448
|
export function Home() {
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
<PerformanceMark stage="complete" id="Home" />
|
454
|
-
</div>
|
455
|
-
);
|
449
|
+
// tell the library the page has finished rendering completely
|
450
|
+
usePerformanceMark('complete', 'Home');
|
451
|
+
|
452
|
+
return <>{/* your Home page JSX goes here*/}</>;
|
456
453
|
}
|
457
454
|
```
|
458
455
|
|
@@ -592,15 +589,42 @@ The params sent to the controller are expected to be of type `application/json`.
|
|
592
589
|
}
|
593
590
|
```
|
594
591
|
|
595
|
-
the above controller would send the following metrics:
|
592
|
+
given the the above controller input, the library would send the following metrics:
|
596
593
|
|
597
594
|
```ruby
|
598
|
-
StatsD.distribution('time_to_first_byte', 2,
|
599
|
-
|
600
|
-
|
601
|
-
StatsD.distribution('
|
595
|
+
StatsD.distribution('time_to_first_byte', 2, tags: {
|
596
|
+
browser_connection_type:'3g',
|
597
|
+
})
|
598
|
+
StatsD.distribution('time_to_first_byte', 2, tags: {
|
599
|
+
browser_connection_type:'3g' ,
|
600
|
+
})
|
601
|
+
StatsD.distribution('navigation_complete', 23924, tags: {
|
602
|
+
browser_connection_type:'3g' ,
|
603
|
+
})
|
604
|
+
StatsD.distribution('navigation_usable', 23924, tags: {
|
605
|
+
browser_connection_type:'3g' ,
|
606
|
+
})
|
602
607
|
```
|
603
608
|
|
609
|
+
##### Default Metrics
|
610
|
+
|
611
|
+
The full list of metrics sent by default are as follows:
|
612
|
+
|
613
|
+
###### For full-page load
|
614
|
+
|
615
|
+
- `AppName.time_to_first_byte`, representing the time from the start of the request to when the server began responding with data.
|
616
|
+
- `AppName.time_to_first_paint`, representing the time from the start of the request to when the browser rendered anything to the screen.
|
617
|
+
- `AppName.time_to_first_contentful_paint` representing the time from the start of the request to when the browser rendered meaningful content to the screen.
|
618
|
+
- `AppName.dom_content_loaded` representing the time from the start of the request to when the browser fired the [DOMContentLoaded](https://developer.mozilla.org/en-US/docs/Web/API/Window/DOMContentLoaded_event) event.
|
619
|
+
- `AppName.dom_load` representing the time from the start of the request to when the browser fired the [window.load](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event) event.
|
620
|
+
|
621
|
+
###### For both full-page navigations and client-side page transitions
|
622
|
+
|
623
|
+
- `AppName.navigation_usable`, representing the time it took before for the page to be rendered in a usable state. Usually this does not include data fetching or asynchronous tasks.
|
624
|
+
- `AppName.navigation_complete` representing the time it took for the page to be fully loaded, including any data fetching which blocks above-the-fold content.
|
625
|
+
- `AppName.navigation_download_size`, representing the total weight of all client-side assets (eg. CSS, JS, images). This will only be sent if there are any events with a `type` of `script` or `style`.
|
626
|
+
- `AppName.navigation_cache_effectiveness`, representing what percentage of client-side assets (eg. CSS, JS, images) were returned from the browser's cache. This will only be sent if there are any events with a `type` of `script` or `style`.
|
627
|
+
|
604
628
|
##### Customizing `process_report` with a block
|
605
629
|
|
606
630
|
The behaviour of `process_report` can be customized by manipulating the `Quilt::Performance::Client` instance yielded into its implicit block parameter.
|
@@ -639,6 +663,10 @@ client.on_navigation do |navigation, tags|
|
|
639
663
|
tags[:connection_rtt] = navigation.connection.rtt
|
640
664
|
tags[:connection_type] = navigation.connection.type
|
641
665
|
tags[:navigation_target] = navigation.target
|
666
|
+
|
667
|
+
# add a tag to allow filtering out navigations that are too long
|
668
|
+
# this is useful when you are unable to rule out missing performance marks on some pages
|
669
|
+
tags[:too_long_dont_read] = navigation.duration > 30.seconds.in_milliseconds
|
642
670
|
end
|
643
671
|
```
|
644
672
|
|
data/lib/quilt_rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quilt_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathew Allen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10
|
11
|
+
date: 2019-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: statsd-instrument
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.
|
47
|
+
version: 2.8.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.
|
54
|
+
version: 2.8.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rubocop
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|