aws-rum-web
Advanced tools
Comparing version 1.4.0 to 1.5.0
@@ -5,2 +5,10 @@ # Changelog | ||
## [1.5.0](https://github.com/aws-observability/aws-rum-web/compare/v1.2.1...v1.5.0) (2022-04-15) | ||
### Features | ||
* Capture SPA route change timing ([#134](https://github.com/aws-observability/aws-rum-web/issues/134)) ([91e1303](https://github.com/aws-observability/aws-rum-web/commit/91e13034ab1682ec621970bd9b76e693ea928da3)) | ||
## [1.4.0](https://github.com/aws-observability/aws-rum-web/compare/v1.2.1...v1.4.0) (2022-03-30) | ||
@@ -95,2 +103,2 @@ | ||
- Initial release | ||
- Initial release |
@@ -11,8 +11,4 @@ /** | ||
version: "1.0.0"; | ||
initiatorType: "navigation" | "route_change"; | ||
/** | ||
* Page URL | ||
*/ | ||
targetUrl?: string; | ||
initiatorType: "navigation"; | ||
/** | ||
* An unsigned short which indicates how the navigation to this page was done. Possible values are:TYPE_NAVIGATE (0), TYPE_RELOAD (1), TYPE_BACK_FORWARD (2), TYPE_RESERVED (255) | ||
@@ -22,28 +18,28 @@ */ | ||
startTime: number; | ||
unloadEventStart: number; | ||
promptForUnload: number; | ||
unloadEventStart?: number; | ||
promptForUnload?: number; | ||
redirectCount?: number; | ||
redirectStart: number; | ||
redirectTime: number; | ||
redirectStart?: number; | ||
redirectTime?: number; | ||
workerStart?: number; | ||
workerTime?: number; | ||
fetchStart: number; | ||
domainLookupStart: number; | ||
dns: number; | ||
fetchStart?: number; | ||
domainLookupStart?: number; | ||
dns?: number; | ||
nextHopProtocol?: string; | ||
connectStart: number; | ||
connect: number; | ||
secureConnectionStart: number; | ||
tlsTime: number; | ||
requestStart: number; | ||
timeToFirstByte: number; | ||
responseStart: number; | ||
responseTime: number; | ||
domInteractive: number; | ||
domContentLoadedEventStart: number; | ||
domContentLoaded: number; | ||
domComplete: number; | ||
domProcessingTime: number; | ||
loadEventStart: number; | ||
loadEventTime: number; | ||
connectStart?: number; | ||
connect?: number; | ||
secureConnectionStart?: number; | ||
tlsTime?: number; | ||
requestStart?: number; | ||
timeToFirstByte?: number; | ||
responseStart?: number; | ||
responseTime?: number; | ||
domInteractive?: number; | ||
domContentLoadedEventStart?: number; | ||
domContentLoaded?: number; | ||
domComplete?: number; | ||
domProcessingTime?: number; | ||
loadEventStart?: number; | ||
loadEventTime?: number; | ||
duration: number; | ||
@@ -53,3 +49,3 @@ headerSize?: number; | ||
compressionRatio?: number; | ||
navigationTimingLevel: number; | ||
navigationTimingLevel?: number; | ||
} |
@@ -43,2 +43,4 @@ import { Plugin } from '../plugins/Plugin'; | ||
recordResourceUrl?: boolean; | ||
routeChangeComplete?: number; | ||
routeChangeTimeout?: number; | ||
sessionEventLimit?: number; | ||
@@ -90,2 +92,4 @@ sessionLengthSeconds?: number; | ||
recordResourceUrl: boolean; | ||
routeChangeComplete: number; | ||
routeChangeTimeout: number; | ||
sessionEventLimit: number; | ||
@@ -92,0 +96,0 @@ sessionLengthSeconds: number; |
@@ -78,2 +78,4 @@ "use strict"; | ||
recordResourceUrl: true, | ||
routeChangeComplete: 100, | ||
routeChangeTimeout: 10000, | ||
sessionEventLimit: 200, | ||
@@ -80,0 +82,0 @@ sessionLengthSeconds: 60 * 30, |
@@ -13,1 +13,2 @@ export declare const UNKNOWN = "unknown"; | ||
export declare const JS_ERROR_EVENT_TYPE = "com.amazon.rum.js_error_event"; | ||
export declare const PAGE_VIEW_EVENT_TYPE = "com.amazon.rum.page_view_event"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.JS_ERROR_EVENT_TYPE = exports.DOM_EVENT_TYPE = exports.PERFORMANCE_FIRST_CONTENTFUL_PAINT_EVENT_TYPE = exports.PERFORMANCE_FIRST_PAINT_EVENT_TYPE = exports.PERFORMANCE_RESOURCE_EVENT_TYPE = exports.PERFORMANCE_NAVIGATION_EVENT_TYPE = exports.CLS_EVENT_TYPE = exports.FID_EVENT_TYPE = exports.LCP_EVENT_TYPE = exports.XRAY_TRACE_EVENT_TYPE = exports.HTTP_EVENT_TYPE = exports.UNKNOWN = void 0; | ||
exports.PAGE_VIEW_EVENT_TYPE = exports.JS_ERROR_EVENT_TYPE = exports.DOM_EVENT_TYPE = exports.PERFORMANCE_FIRST_CONTENTFUL_PAINT_EVENT_TYPE = exports.PERFORMANCE_FIRST_PAINT_EVENT_TYPE = exports.PERFORMANCE_RESOURCE_EVENT_TYPE = exports.PERFORMANCE_NAVIGATION_EVENT_TYPE = exports.CLS_EVENT_TYPE = exports.FID_EVENT_TYPE = exports.LCP_EVENT_TYPE = exports.XRAY_TRACE_EVENT_TYPE = exports.HTTP_EVENT_TYPE = exports.UNKNOWN = void 0; | ||
exports.UNKNOWN = 'unknown'; | ||
@@ -21,1 +21,3 @@ // Http request event schemas | ||
exports.JS_ERROR_EVENT_TYPE = 'com.amazon.rum.js_error_event'; | ||
// Page view event | ||
exports.PAGE_VIEW_EVENT_TYPE = 'com.amazon.rum.page_view_event'; |
import { Config } from '../orchestration/Orchestration'; | ||
import { RecordEvent } from '../plugins/Plugin'; | ||
export declare const PAGE_VIEW_TYPE = "com.amazon.rum.page_view_event"; | ||
export declare type Page = { | ||
@@ -37,2 +36,4 @@ pageId: string; | ||
private attributes; | ||
private virtualPageLoadTimer; | ||
private TIMEOUT; | ||
/** | ||
@@ -39,0 +40,0 @@ * A flag which keeps track of whether or not cookies have been enabled. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PageManager = exports.PAGE_VIEW_TYPE = void 0; | ||
exports.PAGE_VIEW_TYPE = 'com.amazon.rum.page_view_event'; | ||
exports.PageManager = void 0; | ||
var VirtualPageLoadTimer_1 = require("../sessions/VirtualPageLoadTimer"); | ||
var constant_1 = require("../plugins/utils/constant"); | ||
/** | ||
@@ -17,2 +18,3 @@ * The page manager keeps the state of the current page and interaction level. | ||
function PageManager(config, record) { | ||
this.TIMEOUT = 1000; | ||
this.config = config; | ||
@@ -23,2 +25,3 @@ this.record = record; | ||
this.recordInteraction = false; | ||
this.virtualPageLoadTimer = new VirtualPageLoadTimer_1.VirtualPageLoadTimer(this, config, record); | ||
} | ||
@@ -78,2 +81,27 @@ PageManager.prototype.getPage = function () { | ||
PageManager.prototype.createNextPage = function (pageId) { | ||
var startTime = Date.now(); | ||
var interactionTime = this.virtualPageLoadTimer.latestInteractionTime; | ||
// The latest interaction time (latest) is not guaranteed to be the | ||
// interaction that triggered the route change (actual). There are two | ||
// cases to consider: | ||
// | ||
// 1. Latest is older than actual. This can happen if the user navigates | ||
// with the browser back/forward button, or if the interaction is not a | ||
// click/keyup event. | ||
// | ||
// 2. Latest is newer than actual. This can happen if the user clicks or | ||
// types in the time between actual and when recordPageView is called. | ||
// | ||
// We believe that case (1) has a high risk of skewing route change | ||
// timing metrics because (a) browser navigation is common and (b) there | ||
// is no limit on when the lastest interaction may have occurred. To | ||
// help mitigate this, if the route change is already longer than 1000ms, | ||
// then we do not bother timing the route change. | ||
// | ||
// We do not believe that case (2) has a high risk of skewing route | ||
// change timing, and therefore ignore case (2). | ||
if (startTime - interactionTime <= this.TIMEOUT) { | ||
startTime = interactionTime; | ||
this.virtualPageLoadTimer.startTiming(); | ||
} | ||
this.page = { | ||
@@ -83,3 +111,3 @@ pageId: pageId, | ||
interaction: this.page.interaction + 1, | ||
start: Date.now() | ||
start: startTime | ||
}; | ||
@@ -129,3 +157,3 @@ }; | ||
PageManager.prototype.recordPageViewEvent = function () { | ||
this.record(exports.PAGE_VIEW_TYPE, this.createPageViewEvent()); | ||
this.record(constant_1.PAGE_VIEW_EVENT_TYPE, this.createPageViewEvent()); | ||
}; | ||
@@ -132,0 +160,0 @@ /** |
@@ -11,8 +11,4 @@ /** | ||
version: "1.0.0"; | ||
initiatorType: "navigation" | "route_change"; | ||
/** | ||
* Page URL | ||
*/ | ||
targetUrl?: string; | ||
initiatorType: "navigation"; | ||
/** | ||
* An unsigned short which indicates how the navigation to this page was done. Possible values are:TYPE_NAVIGATE (0), TYPE_RELOAD (1), TYPE_BACK_FORWARD (2), TYPE_RESERVED (255) | ||
@@ -22,28 +18,28 @@ */ | ||
startTime: number; | ||
unloadEventStart: number; | ||
promptForUnload: number; | ||
unloadEventStart?: number; | ||
promptForUnload?: number; | ||
redirectCount?: number; | ||
redirectStart: number; | ||
redirectTime: number; | ||
redirectStart?: number; | ||
redirectTime?: number; | ||
workerStart?: number; | ||
workerTime?: number; | ||
fetchStart: number; | ||
domainLookupStart: number; | ||
dns: number; | ||
fetchStart?: number; | ||
domainLookupStart?: number; | ||
dns?: number; | ||
nextHopProtocol?: string; | ||
connectStart: number; | ||
connect: number; | ||
secureConnectionStart: number; | ||
tlsTime: number; | ||
requestStart: number; | ||
timeToFirstByte: number; | ||
responseStart: number; | ||
responseTime: number; | ||
domInteractive: number; | ||
domContentLoadedEventStart: number; | ||
domContentLoaded: number; | ||
domComplete: number; | ||
domProcessingTime: number; | ||
loadEventStart: number; | ||
loadEventTime: number; | ||
connectStart?: number; | ||
connect?: number; | ||
secureConnectionStart?: number; | ||
tlsTime?: number; | ||
requestStart?: number; | ||
timeToFirstByte?: number; | ||
responseStart?: number; | ||
responseTime?: number; | ||
domInteractive?: number; | ||
domContentLoadedEventStart?: number; | ||
domContentLoaded?: number; | ||
domComplete?: number; | ||
domProcessingTime?: number; | ||
loadEventStart?: number; | ||
loadEventTime?: number; | ||
duration: number; | ||
@@ -53,3 +49,3 @@ headerSize?: number; | ||
compressionRatio?: number; | ||
navigationTimingLevel: number; | ||
navigationTimingLevel?: number; | ||
} |
@@ -43,2 +43,4 @@ import { Plugin } from '../plugins/Plugin'; | ||
recordResourceUrl?: boolean; | ||
routeChangeComplete?: number; | ||
routeChangeTimeout?: number; | ||
sessionEventLimit?: number; | ||
@@ -90,2 +92,4 @@ sessionLengthSeconds?: number; | ||
recordResourceUrl: boolean; | ||
routeChangeComplete: number; | ||
routeChangeTimeout: number; | ||
sessionEventLimit: number; | ||
@@ -92,0 +96,0 @@ sessionLengthSeconds: number; |
@@ -74,2 +74,4 @@ var __assign = (this && this.__assign) || function () { | ||
recordResourceUrl: true, | ||
routeChangeComplete: 100, | ||
routeChangeTimeout: 10000, | ||
sessionEventLimit: 200, | ||
@@ -76,0 +78,0 @@ sessionLengthSeconds: 60 * 30, |
@@ -13,1 +13,2 @@ export declare const UNKNOWN = "unknown"; | ||
export declare const JS_ERROR_EVENT_TYPE = "com.amazon.rum.js_error_event"; | ||
export declare const PAGE_VIEW_EVENT_TYPE = "com.amazon.rum.page_view_event"; |
@@ -18,1 +18,3 @@ export var UNKNOWN = 'unknown'; | ||
export var JS_ERROR_EVENT_TYPE = 'com.amazon.rum.js_error_event'; | ||
// Page view event | ||
export var PAGE_VIEW_EVENT_TYPE = 'com.amazon.rum.page_view_event'; |
import { Config } from '../orchestration/Orchestration'; | ||
import { RecordEvent } from '../plugins/Plugin'; | ||
export declare const PAGE_VIEW_TYPE = "com.amazon.rum.page_view_event"; | ||
export declare type Page = { | ||
@@ -37,2 +36,4 @@ pageId: string; | ||
private attributes; | ||
private virtualPageLoadTimer; | ||
private TIMEOUT; | ||
/** | ||
@@ -39,0 +40,0 @@ * A flag which keeps track of whether or not cookies have been enabled. |
@@ -1,2 +0,3 @@ | ||
export var PAGE_VIEW_TYPE = 'com.amazon.rum.page_view_event'; | ||
import { VirtualPageLoadTimer } from '../sessions/VirtualPageLoadTimer'; | ||
import { PAGE_VIEW_EVENT_TYPE } from '../plugins/utils/constant'; | ||
/** | ||
@@ -14,2 +15,3 @@ * The page manager keeps the state of the current page and interaction level. | ||
function PageManager(config, record) { | ||
this.TIMEOUT = 1000; | ||
this.config = config; | ||
@@ -20,2 +22,3 @@ this.record = record; | ||
this.recordInteraction = false; | ||
this.virtualPageLoadTimer = new VirtualPageLoadTimer(this, config, record); | ||
} | ||
@@ -75,2 +78,27 @@ PageManager.prototype.getPage = function () { | ||
PageManager.prototype.createNextPage = function (pageId) { | ||
var startTime = Date.now(); | ||
var interactionTime = this.virtualPageLoadTimer.latestInteractionTime; | ||
// The latest interaction time (latest) is not guaranteed to be the | ||
// interaction that triggered the route change (actual). There are two | ||
// cases to consider: | ||
// | ||
// 1. Latest is older than actual. This can happen if the user navigates | ||
// with the browser back/forward button, or if the interaction is not a | ||
// click/keyup event. | ||
// | ||
// 2. Latest is newer than actual. This can happen if the user clicks or | ||
// types in the time between actual and when recordPageView is called. | ||
// | ||
// We believe that case (1) has a high risk of skewing route change | ||
// timing metrics because (a) browser navigation is common and (b) there | ||
// is no limit on when the lastest interaction may have occurred. To | ||
// help mitigate this, if the route change is already longer than 1000ms, | ||
// then we do not bother timing the route change. | ||
// | ||
// We do not believe that case (2) has a high risk of skewing route | ||
// change timing, and therefore ignore case (2). | ||
if (startTime - interactionTime <= this.TIMEOUT) { | ||
startTime = interactionTime; | ||
this.virtualPageLoadTimer.startTiming(); | ||
} | ||
this.page = { | ||
@@ -80,3 +108,3 @@ pageId: pageId, | ||
interaction: this.page.interaction + 1, | ||
start: Date.now() | ||
start: startTime | ||
}; | ||
@@ -126,3 +154,3 @@ }; | ||
PageManager.prototype.recordPageViewEvent = function () { | ||
this.record(PAGE_VIEW_TYPE, this.createPageViewEvent()); | ||
this.record(PAGE_VIEW_EVENT_TYPE, this.createPageViewEvent()); | ||
}; | ||
@@ -129,0 +157,0 @@ /** |
{ | ||
"name": "aws-rum-web", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "The Amazon CloudWatch RUM web client.", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1157331
210
12201