quilt_rails 1.9.1 → 1.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +44 -16
  3. data/lib/quilt_rails/version.rb +1 -1
  4. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 875ee204d6daad074946aec06f288627aa5481dfe59f28769462083f99215a66
4
- data.tar.gz: 4335d6f6a9ef4dd9a3ad457b96dd3fbf67cfa0a69a8ca30e78d65926a23d24c5
3
+ metadata.gz: 19ed91c686fab67ad1642a071a8d62214c154c246cf4d8cb4027ac3a50483620
4
+ data.tar.gz: 73ad8104d3e54a5b3ba56aa912fa7147eaeab671f75e310c5dd1dcb6d297471b
5
5
  SHA512:
6
- metadata.gz: f3f2d9043a75979e5c7f45fc25f1e159930610b7d158256ab144dd5ac3f5decd5f0a15cbe7d054fc844a54f97eb572974f1464c3f121f8c56ac5819e2a288983
7
- data.tar.gz: aa91a0d734eed1e1c74ccd3a299edbe8a70cbab01af24fcde5818d0fc7d86942014bb22eaf7d13b329a17daff88ce83cdd156a9b3ab299dc4148b26bb90fbe35
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 json: { result: 'success' }, status: 200
423
+ render(json: { result: 'success' }, status: 200)
424
424
  rescue ActionController::ParameterMissing => error
425
- render json: { error: error.message, status: 422 }
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 [`<PerformanceMark />`](https://github.com/Shopify/quilt/tree/master/packages/react-performance#performancemark) to each of your route-level components.
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 {PerformanceMark} from '@shopify/react-performance';
446
+ import {usePerformanceMark} from '@shopify/react-performance';
447
447
 
448
448
  export function Home() {
449
- return (
450
- <div>
451
- My Cool Home Page
452
- {/* tell the library the page has finished rendering completely */}
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, ['browser_connection_type:3g'])
599
- StatsD.distribution('time_to_first_byte', 2, ['browser_connection_type:3g'])
600
- StatsD.distribution('navigation_complete', 23924, ['browser_connection_type:3g'])
601
- StatsD.distribution('navigation_usable', 23924, ['browser_connection_type:3g'])
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
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Quilt
3
- VERSION = "1.9.1"
3
+ VERSION = "1.9.2"
4
4
  end
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.1
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-24 00:00:00.000000000 Z
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.7.0
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.7.0
54
+ version: 2.8.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rubocop
57
57
  requirement: !ruby/object:Gem::Requirement