diff --git a/CHANGELOG.md b/CHANGELOG.md
index cd3be40c..db7c4a69 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,7 +12,6 @@ All notable changes to this project will be documented in this file. See [standa
### Bug Fixes
-* disable VirtualPageLoadTimer by default ([#739](https://github.com/aws-observability/aws-rum-web/issues/739)) ([215d4c2](https://github.com/aws-observability/aws-rum-web/commit/215d4c230fd2eec879f2aef4b6d5693883733027))
* ignore PutRumEvents for PerformanceResource events ([#712](https://github.com/aws-observability/aws-rum-web/issues/712)) ([8377316](https://github.com/aws-observability/aws-rum-web/commit/8377316c1189827d08708a48438c1f52a189c6e8))
* purge invalid credentials on 403 ([#740](https://github.com/aws-observability/aws-rum-web/issues/740)) ([2329ecc](https://github.com/aws-observability/aws-rum-web/commit/2329ecc23f857226dc273d3b24ba23b836dc33c4))
* resolve npe in web vitals attribution ([#716](https://github.com/aws-observability/aws-rum-web/issues/716)) ([6151a9b](https://github.com/aws-observability/aws-rum-web/commit/6151a9b2e82d9bb4e45db1c15c631690b07cf3bf))
diff --git a/docs/configuration.md b/docs/configuration.md
index 412ecf35..dd35fcf4 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -47,7 +47,6 @@ For example, the config object may look similar to the following:
| eventCacheSize | Number | `1000` | The maximum number of events the cache can contain before dropping events. Each event is typically 1KB in size, so we recommend a default limit of 1000 events -> 1 MB to balance performance against capturing all observed events. If necessary, feel free to enable debug mode to get detailed logs on how to optimize cache size depending on your application behavior. |
| sessionLengthSeconds | Number | `1800` | The duration of a session (in seconds). |
| headers | Object | `{}` | The **headers** configuration is optional and allows you to include custom headers in an HTTP request. For example, you can use it to pass `Authorization` and `x-api-key` headers.
For more details, see: [MDN - Request Headers](https://developer.mozilla.org/en-US/docs/Glossary/Request_header). |
-| legacySPASupport | Boolean | `false` | When this field is `true`, then legacy NavigationEvents with initiatorType=route_change will be recorded for single page applications. **Warning:** This is a legacy feature that is no longer supported. Please enable with caution in debugging mode first to see if it is relevant for your web application before enabling it in prod. See [#723](https://github.com/aws-observability/aws-rum-web/issues/723) for more details. |
## CookieAttributes
diff --git a/smoke/smoke-test-application-CDN/smoke.html b/smoke/smoke-test-application-CDN/smoke.html
index 9737a286..23c53acb 100644
--- a/smoke/smoke-test-application-CDN/smoke.html
+++ b/smoke/smoke-test-application-CDN/smoke.html
@@ -40,8 +40,7 @@
'content-type': 'application/json'
},
useBeacon: false,
- releaseId: '2.1.7',
- legacySPASupport: true
+ releaseId: '2.1.7'
});
diff --git a/smoke/smoke-test-application-CDN/smoke_w3c_format_enabled.html b/smoke/smoke-test-application-CDN/smoke_w3c_format_enabled.html
index 827dd50b..7c7cf9ae 100644
--- a/smoke/smoke-test-application-CDN/smoke_w3c_format_enabled.html
+++ b/smoke/smoke-test-application-CDN/smoke_w3c_format_enabled.html
@@ -41,8 +41,7 @@
},
useBeacon: false,
releaseId: '2.1.7',
- enableW3CTraceId: true,
- legacySPASupport: true
+ enableW3CTraceId: true
});
diff --git a/smoke/smoke-test-application-NPM-CJS/src/loader-npm-rum-2.ts b/smoke/smoke-test-application-NPM-CJS/src/loader-npm-rum-2.ts
index 09bffc9b..7090bf87 100644
--- a/smoke/smoke-test-application-NPM-CJS/src/loader-npm-rum-2.ts
+++ b/smoke/smoke-test-application-NPM-CJS/src/loader-npm-rum-2.ts
@@ -14,8 +14,7 @@ try {
cookieAttributes: {
unique: true
},
- useBeacon: false,
- legacySPASupport: true
+ useBeacon: false
};
const APPLICATION_ID: string = $MONITOR_ID_2;
diff --git a/smoke/smoke-test-application-NPM-CJS/src/loader-npm-rum-w3c-format-enabled.ts b/smoke/smoke-test-application-NPM-CJS/src/loader-npm-rum-w3c-format-enabled.ts
index 0bc44a95..145039d2 100644
--- a/smoke/smoke-test-application-NPM-CJS/src/loader-npm-rum-w3c-format-enabled.ts
+++ b/smoke/smoke-test-application-NPM-CJS/src/loader-npm-rum-w3c-format-enabled.ts
@@ -22,8 +22,7 @@ try {
'content-type': 'application/json'
},
useBeacon: false,
- enableW3CTraceId: true,
- legacySPASupport: true
+ enableW3CTraceId: true
};
const APPLICATION_ID: string = $MONITOR_ID;
diff --git a/smoke/smoke-test-application-NPM-CJS/src/loader-npm-rum.ts b/smoke/smoke-test-application-NPM-CJS/src/loader-npm-rum.ts
index 86d46e9f..dfc203bf 100644
--- a/smoke/smoke-test-application-NPM-CJS/src/loader-npm-rum.ts
+++ b/smoke/smoke-test-application-NPM-CJS/src/loader-npm-rum.ts
@@ -21,8 +21,7 @@ try {
'x-api-key': 'a1b2c3d4e5f6',
'content-type': 'application/json'
},
- useBeacon: false,
- legacySPASupport: true
+ useBeacon: false
};
const APPLICATION_ID: string = $MONITOR_ID;
diff --git a/smoke/smoke-test-application-NPM-ES/src/loader-npm-rum-2.ts b/smoke/smoke-test-application-NPM-ES/src/loader-npm-rum-2.ts
index e3fbfb0e..98bc9c4b 100644
--- a/smoke/smoke-test-application-NPM-ES/src/loader-npm-rum-2.ts
+++ b/smoke/smoke-test-application-NPM-ES/src/loader-npm-rum-2.ts
@@ -15,8 +15,7 @@ try {
unique: true
},
useBeacon: false,
- releaseId: '2.1.7',
- legacySPASupport: true
+ releaseId: '2.1.7'
};
const APPLICATION_ID: string = $MONITOR_ID_2;
diff --git a/smoke/smoke-test-application-NPM-ES/src/loader-npm-rum-w3c-format-enabled.ts b/smoke/smoke-test-application-NPM-ES/src/loader-npm-rum-w3c-format-enabled.ts
index 0bc44a95..145039d2 100644
--- a/smoke/smoke-test-application-NPM-ES/src/loader-npm-rum-w3c-format-enabled.ts
+++ b/smoke/smoke-test-application-NPM-ES/src/loader-npm-rum-w3c-format-enabled.ts
@@ -22,8 +22,7 @@ try {
'content-type': 'application/json'
},
useBeacon: false,
- enableW3CTraceId: true,
- legacySPASupport: true
+ enableW3CTraceId: true
};
const APPLICATION_ID: string = $MONITOR_ID;
diff --git a/smoke/smoke-test-application-NPM-ES/src/loader-npm-rum.ts b/smoke/smoke-test-application-NPM-ES/src/loader-npm-rum.ts
index 16249fc9..a38bdea3 100644
--- a/smoke/smoke-test-application-NPM-ES/src/loader-npm-rum.ts
+++ b/smoke/smoke-test-application-NPM-ES/src/loader-npm-rum.ts
@@ -22,8 +22,7 @@ try {
'content-type': 'application/json'
},
useBeacon: false,
- releaseId: '2.1.7',
- legacySPASupport: true
+ releaseId: '2.1.7'
};
const APPLICATION_ID: string = $MONITOR_ID;
diff --git a/src/loader/loader-page-event.js b/src/loader/loader-page-event.js
index 82d5de3d..3381953e 100644
--- a/src/loader/loader-page-event.js
+++ b/src/loader/loader-page-event.js
@@ -7,8 +7,7 @@ loader('cwr', 'abc123', '1.0', 'us-west-2', './rum_javascript_telemetry.js', {
telemetries: [],
pagesToInclude: [/\/(page_event.html|page_view_one|page_view_two)/],
pagesToExclude: [/\/page_view_do_not_record/],
- clientBuilder: showRequestClientBuilder,
- legacySPASupport: true
+ clientBuilder: showRequestClientBuilder
});
window.cwr('setAwsCredentials', {
accessKeyId: 'a',
diff --git a/src/orchestration/Orchestration.ts b/src/orchestration/Orchestration.ts
index cf928eef..27327f3e 100644
--- a/src/orchestration/Orchestration.ts
+++ b/src/orchestration/Orchestration.ts
@@ -98,7 +98,6 @@ export const defaultConfig = (cookieAttributes: CookieAttributes): Config => {
useBeacon: true,
userIdRetentionDays: 30,
enableW3CTraceId: false,
- legacySPASupport: false, // deprecated
...internalConfigOverrides
};
};
@@ -175,9 +174,6 @@ export interface Config {
alias?: string;
headers?: HeaderBag;
enableW3CTraceId: boolean;
-
- // Deprecated features; enable with caution
- legacySPASupport: boolean; // See https://github.com/aws-observability/aws-rum-web/issues/723
}
export interface PartialConfig
diff --git a/src/orchestration/__tests__/Orchestration.test.ts b/src/orchestration/__tests__/Orchestration.test.ts
index 2a111b63..af078880 100644
--- a/src/orchestration/__tests__/Orchestration.test.ts
+++ b/src/orchestration/__tests__/Orchestration.test.ts
@@ -636,6 +636,5 @@ describe('defaultConfig tests', () => {
expect(config.userIdRetentionDays).toBe(30);
expect(config.enableW3CTraceId).toBe(false);
expect(config.candidatesCacheSize).toBe(10);
- expect(config.legacySPASupport).toBe(false);
});
});
diff --git a/src/sessions/PageManager.ts b/src/sessions/PageManager.ts
index 2fffb3bf..31b344fc 100644
--- a/src/sessions/PageManager.ts
+++ b/src/sessions/PageManager.ts
@@ -50,7 +50,7 @@ export class PageManager {
private page: Page | undefined;
private resumed: boolean;
private attributes: Attributes | undefined;
- private virtualPageLoadTimer: VirtualPageLoadTimer | undefined;
+ private virtualPageLoadTimer: VirtualPageLoadTimer;
private TIMEOUT = 1000;
private timeOnParentPage: number | undefined;
@@ -68,18 +68,11 @@ export class PageManager {
this.page = undefined;
this.resumed = false;
this.recordInteraction = false;
- if (config.legacySPASupport) {
- if (config.debug) {
- InternalLogger.warn(
- 'VirtualPageLoadTiming (deprecated) is enabled and may result in innaccurate page load timing for Single Page Applications. Please use with caution after reviewing https://github.com/aws-observability/aws-rum-web/issues/723'
- );
- }
- this.virtualPageLoadTimer = new VirtualPageLoadTimer(
- this,
- config,
- record
- );
- }
+ this.virtualPageLoadTimer = new VirtualPageLoadTimer(
+ this,
+ config,
+ record
+ );
}
public getPage(): Page | undefined {
@@ -106,10 +99,6 @@ export class PageManager {
pageId = payload.pageId;
}
- if (this.config.debug) {
- InternalLogger.info(`recordPageView called with pageId: ${pageId}`);
- }
-
if (this.useCookies()) {
this.recordInteraction = true;
}
@@ -117,17 +106,14 @@ export class PageManager {
if (!this.page) {
this.createLandingPage(pageId);
if (this.config.debug) {
- InternalLogger.info(`Landing page created: ${pageId}`);
+ InternalLogger.info(`Landing page recorded: ${pageId}`);
}
} else if (this.page.pageId !== pageId) {
this.createNextPage(this.page, pageId);
if (this.config.debug) {
- InternalLogger.info(`Navigation to new page: ${pageId}`);
+ InternalLogger.info(`Navigation to page: ${pageId}`);
}
} else if (this.resumed) {
- if (this.config.debug) {
- InternalLogger.info(`Resumed session for page: ${pageId}`);
- }
// Update attributes state in PageManager for event metadata
this.collectAttributes(
this.page as Page,
@@ -135,9 +121,6 @@ export class PageManager {
);
return;
} else {
- if (this.config.debug) {
- InternalLogger.info(`No page change detected for: ${pageId}`);
- }
// The view has not changed.
return;
}
@@ -156,14 +139,7 @@ export class PageManager {
private createNextPage(currentPage: Page, pageId: string) {
let startTime = Date.now();
-
- if (this.config.debug) {
- InternalLogger.info(
- `Creating next page ${pageId}, interaction: ${
- currentPage.interaction + 1
- }`
- );
- }
+ const 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
@@ -184,24 +160,9 @@ export class PageManager {
//
// We do not believe that case (2) has a high risk of skewing route
// change timing, and therefore ignore case (2).
- if (this.config.legacySPASupport && this.virtualPageLoadTimer) {
- const interactionTime =
- this.virtualPageLoadTimer.latestInteractionTime;
- if (!this.resumed && startTime - interactionTime <= this.TIMEOUT) {
- startTime = interactionTime;
- this.virtualPageLoadTimer.startTiming();
- if (this.config.debug) {
- InternalLogger.info(
- `Started virtual page load timing for ${pageId}`
- );
- }
- } else if (this.config.debug) {
- InternalLogger.info(
- `Skipped virtual page load timing for ${pageId} (resumed: ${
- this.resumed
- }, timeDiff: ${startTime - interactionTime}ms)`
- );
- }
+ if (!this.resumed && startTime - interactionTime <= this.TIMEOUT) {
+ startTime = interactionTime;
+ this.virtualPageLoadTimer.startTiming();
}
this.timeOnParentPage = startTime - currentPage.start;
diff --git a/src/sessions/VirtualPageLoadTimer.ts b/src/sessions/VirtualPageLoadTimer.ts
index b483f57a..b6eab0d4 100644
--- a/src/sessions/VirtualPageLoadTimer.ts
+++ b/src/sessions/VirtualPageLoadTimer.ts
@@ -4,7 +4,6 @@ import { MonkeyPatched } from '../plugins/MonkeyPatched';
import { Config } from '../orchestration/Orchestration';
import { RecordEvent } from '../plugins/types';
import { PageManager, Page } from './PageManager';
-import { InternalLogger } from '../utils/InternalLogger';
type Fetch = typeof fetch;
type Send = () => void;
@@ -14,10 +13,6 @@ type Patching = Pick;
* (1) Holds all virtual page load timing related resources
* (2) Intercepts outgoing XMLHttpRequests and Fetch requests and listens for DOM changes
* (3) Records virtual page load
- *
- * @deprecated This class is deprecated and will be removed in a future version.
- * For now, it can still be enabled via the legacySPASupport configuration. If you would like to opt-in
- * to this legacy feature, then please first carefully review https://github.com/aws-observability/aws-rum-web/issues/723
*/
export class VirtualPageLoadTimer extends MonkeyPatched<
Patching,
@@ -89,11 +84,6 @@ export class VirtualPageLoadTimer extends MonkeyPatched<
/** Initializes timing related resources for current page. */
public startTiming() {
this.latestEndTime = Date.now();
-
- if (this.config.debug) {
- InternalLogger.info('Starting timing for virtual page load');
- }
-
// Clean up existing timer objects and mutationObserver
if (this.periodicCheckerId) {
clearInterval(this.periodicCheckerId);
@@ -124,12 +114,6 @@ export class VirtualPageLoadTimer extends MonkeyPatched<
this.isPageLoaded = false;
this.requestBuffer.forEach(this.moveItemsFromBuffer);
this.requestBuffer.clear();
-
- if (this.config.debug) {
- InternalLogger.info(
- `Moved ${this.requestBuffer.size} requests from buffer to ongoing`
- );
- }
}
private sendWrapper = (): ((original: Send) => Send) => {
@@ -148,18 +132,8 @@ export class VirtualPageLoadTimer extends MonkeyPatched<
const page = this.pageManager.getPage();
if (page && this.isPageLoaded === false) {
this.ongoingRequests.add(item);
- if (this.config.debug) {
- InternalLogger.info(
- `Added XHR to ongoing requests (total: ${this.ongoingRequests.size})`
- );
- }
} else {
this.requestBuffer.add(item);
- if (this.config.debug) {
- InternalLogger.info(
- `VirtualPageLoadTimer: Added XHR to buffer (total: ${this.requestBuffer.size})`
- );
- }
}
}
@@ -230,19 +204,7 @@ export class VirtualPageLoadTimer extends MonkeyPatched<
* (3) Indicate current page has finished loading
*/
private checkLoadStatus = () => {
- if (this.config.debug) {
- InternalLogger.info(
- `VirtualPageLoadTimer: Checking load status - XHR: ${this.ongoingRequests.size}, Fetch: ${this.fetchCounter}`
- );
- }
-
if (this.ongoingRequests.size === 0 && this.fetchCounter === 0) {
- if (this.config.debug) {
- InternalLogger.info(
- 'Page load completed, recording navigation event'
- );
- }
-
clearInterval(this.periodicCheckerId);
clearTimeout(this.timeoutCheckerId);
this.domMutationObserver.disconnect();
@@ -257,10 +219,6 @@ export class VirtualPageLoadTimer extends MonkeyPatched<
/** Clears timers and disconnects observer to stop page timing. */
private declareTimeout = () => {
- if (this.config.debug) {
- InternalLogger.info('Page load timed out');
- }
-
clearInterval(this.periodicCheckerId);
this.periodicCheckerId = undefined;
this.timeoutCheckerId = undefined;
@@ -299,10 +257,5 @@ export class VirtualPageLoadTimer extends MonkeyPatched<
private updateLatestInteractionTime = (e: Event) => {
this.latestInteractionTime = Date.now();
- if (this.config.debug) {
- InternalLogger.info(
- `Updated interaction time: ${this.latestInteractionTime}`
- );
- }
};
}
diff --git a/src/sessions/__tests__/PageManager.test.ts b/src/sessions/__tests__/PageManager.test.ts
index 29a64fbf..47458966 100644
--- a/src/sessions/__tests__/PageManager.test.ts
+++ b/src/sessions/__tests__/PageManager.test.ts
@@ -479,8 +479,7 @@ describe('PageManager tests', () => {
const pageManager: PageManager = new PageManager(
{
...DEFAULT_CONFIG,
- allowCookies: true,
- legacySPASupport: true
+ allowCookies: true
},
record
);
@@ -520,8 +519,7 @@ describe('PageManager tests', () => {
const pageManager: PageManager = new PageManager(
{
...DEFAULT_CONFIG,
- allowCookies: true,
- legacySPASupport: true
+ allowCookies: true
},
record
);
@@ -556,8 +554,7 @@ describe('PageManager tests', () => {
const pageManager: PageManager = new PageManager(
{
...DEFAULT_CONFIG,
- allowCookies: true,
- legacySPASupport: true
+ allowCookies: true
},
record
);
@@ -587,8 +584,7 @@ describe('PageManager tests', () => {
// Init
const config: Config = {
...DEFAULT_CONFIG,
- allowCookies: true,
- legacySPASupport: true
+ allowCookies: true
};
const pageManager: PageManager = new PageManager(config, record);
const helper = pageManager['virtualPageLoadTimer'];
@@ -612,61 +608,11 @@ describe('PageManager tests', () => {
expect(pageManager.getPage().start).toEqual(3000);
});
- test('when legacySPASupport is false then virtualPageLoadTimer is not created', async () => {
- // Init
- const pageManager: PageManager = new PageManager(
- {
- ...DEFAULT_CONFIG,
- allowCookies: true,
- legacySPASupport: false
- },
- record
- );
-
- // Assert
- expect(pageManager['virtualPageLoadTimer']).toBeUndefined();
-
- window.removeEventListener(
- 'popstate',
- (pageManager as any).popstateListener
- );
- });
-
- test('when legacySPASupport is false then page navigation works without virtual timing', async () => {
- // Init
- const pageManager: PageManager = new PageManager(
- {
- ...DEFAULT_CONFIG,
- allowCookies: true,
- legacySPASupport: false
- },
- record
- );
-
- // Run
- pageManager.recordPageView('/rum/home');
- pageManager.recordPageView('/console/home');
-
- // Assert - page view events are still recorded
- expect(record.mock.calls.length).toEqual(2);
- expect(record.mock.calls[1][0]).toEqual(PAGE_VIEW_EVENT_TYPE);
- expect(record.mock.calls[1][1]).toMatchObject({
- pageId: '/console/home',
- interaction: 1
- });
-
- window.removeEventListener(
- 'popstate',
- (pageManager as any).popstateListener
- );
- });
-
test('when latestInteractionTime is within the scope of routeChangeTimeout then page.start is latestInteractionTime', async () => {
// Init
const config: Config = {
...DEFAULT_CONFIG,
- allowCookies: true,
- legacySPASupport: true
+ allowCookies: true
};
const pageManager: PageManager = new PageManager(config, record);
const helper = pageManager['virtualPageLoadTimer'];