Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stage RUM 2.0 for release #571

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/__integ__/customEvents.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ fixture('Custom Events API & Plugin').page(
const removeUnwantedEvents = (json: any) => {
const newEventsList = json.RumEvents.filter(
(e) =>
/(custom_event_api)/.test(e.type) ||
/(custom_event_plugin)/.test(e.type)
/custom_event_api/.test(e.type) ||
/custom_event_plugin/.test(e.type)
);

json.RumEvents = newEventsList;
Expand Down Expand Up @@ -136,6 +136,7 @@ test('when a plugin calls recordEvent x times then event is recorded x times', a
}
await t
.click(dispatch)
.wait(100)
.expect(REQUEST_BODY.textContent)
.contains('BatchId');

Expand Down Expand Up @@ -167,12 +168,14 @@ test('when plugin recordEvent has empty event_data then RumEvent details is empt
await t
.click(pluginRecordEmptyEvent)
.click(dispatch)
.wait(100)
.expect(REQUEST_BODY.textContent)
.contains('BatchId');

const json = removeUnwantedEvents(
JSON.parse(await REQUEST_BODY.textContent)
);

await t
.expect(json.RumEvents.length)
.eql(1)
Expand Down
2 changes: 2 additions & 0 deletions src/event-cache/EventCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export class EventCache {
* If the session is not being recorded, the event will not be recorded.
*
* @param type The event schema.
* @param eventData The RUM Event to be dispatched to PutRumEvents
*/
public recordEvent = (type: string, eventData: object) => {
if (!this.enabled) {
Expand Down Expand Up @@ -209,6 +210,7 @@ export class EventCache {
* Add an event to the cache.
*
* @param type The event schema.
* @param eventData The RUM Event to be dispatched to PutRumEvents
*/
private addRecordToCache = (type: string, eventData: object) => {
if (!this.enabled) {
Expand Down
1 change: 0 additions & 1 deletion src/event-cache/__tests__/EventCache.integ.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ describe('EventCache tests', () => {
allowCookies: false,
sessionLengthSeconds: 0,
sessionAttributes: {
version: '2.0.0',
domain: 'overridden.console.aws.amazon.com',
browserLanguage: 'en-UK',
browserName: 'Chrome',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,45 +1,38 @@
{
"$id": "com.amazon.rum.performance_navigation_event",
"$id": "com.amazon.rum.performance_navigation_timing",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "NavigationEvent",
"title": "PerformanceNavigationTimingEvent",
"type": "object",
"properties": {
"version": {
"const": "1.0.0",
"type": "string",
"description": "Schema version."
},
"initiatorType": {
"type": "string",
"enum": ["navigation", "route_change"]
"name": {
"type": "string"
},
"navigationType": {
"description": "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)",
"type": "string",
"enum": ["navigate", "reload", "back_forward", "reserved"]
"entryType": {
"const": "navigation",
"type": "string"
},
"startTime": {
"type": "number"
},
"unloadEventStart": {
"type": "number"
"type": "number",
"description": "StartTime value is always '0' for PerformanceNavigationTimingEvents created by the PerformanceAPI. However, non-W3C 'route_changes' created by RUM's polyfill for SinglePageApplications can have startTimes >= 0."
},
"promptForUnload": {
"duration": {
"type": "number"
},
"redirectCount": {
"type": "integer"
"initiatorType": {
"type": "string",
"enum": ["navigation", "route_change"],
"description": "InitiatorType value is always 'navigation' for PerformanceNavigationTimingEvents created by the PerformanceAPI. However, RUM adds the non-W3C concept 'route_change' as a polyfill because the PerformanceAPI currently does not support Single Page Applications."
},
"redirectStart": {
"type": "number"
"nextHopProtocol": {
"type": "string"
},
"redirectTime": {
"workerStart": {
"type": "number"
},
"workerStart": {
"redirectStart": {
"type": "number"
},
"workerTime": {
"redirectEnd": {
"type": "number"
},
"fetchStart": {
Expand All @@ -48,73 +41,68 @@
"domainLookupStart": {
"type": "number"
},
"dns": {
"domainLookupEnd": {
"type": "number"
},
"nextHopProtocol": {
"type": "string"
},
"connectStart": {
"type": "number"
},
"connect": {
"connectEnd": {
"type": "number"
},
"secureConnectionStart": {
"type": "number"
},
"tlsTime": {
"type": "number"
},
"requestStart": {
"type": "number"
},
"timeToFirstByte": {
"type": "number"
},
"responseStart": {
"type": "number"
},
"responseTime": {
"responseEnd": {
"type": "number"
},
"domInteractive": {
"transferSize": {
"type": "number"
},
"domContentLoadedEventStart": {
"encodedBodySize": {
"type": "number"
},
"domContentLoaded": {
"decodedBodySize": {
"type": "number"
},
"domComplete": {
"type": "number"
},
"domProcessingTime": {
"domContentLoadedEventEnd": {
"type": "number"
},
"loadEventStart": {
"domContentLoadedEventStart": {
"type": "number"
},
"loadEventTime": {
"domInteractive": {
"type": "number"
},
"duration": {
"loadEventEnd": {
"type": "number"
},
"headerSize": {
"loadEventStart": {
"type": "number"
},
"transferSize": {
"type": "number"
"redirectCount": {
"type": "integer"
},
"compressionRatio": {
"type": {
"type": "string",
"enum": ["navigate", "reload", "back_forward", "prerender"]
},
"unloadEventEnd": {
"type": "number"
},
"navigationTimingLevel": {
"unloadEventStart": {
"type": "number"
}
},
"additionalProperties": false,
"required": ["version", "initiatorType", "startTime", "duration"]
"required": ["entryType", "startTime", "duration", "initiatorType"]
}
Original file line number Diff line number Diff line change
@@ -1,88 +1,101 @@
{
"$id": "com.amazon.rum.performance_resource_event",
"$id": "com.amazon.rum.performance_resource_timing",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "ResourceEvent",
"title": "PerformanceResourceTimingEvent",
"type": "object",
"properties": {
"version": {
"const": "1.0.0",
"type": "string",
"description": "Schema version."
},
"targetUrl": {
"description": "Page URL",
"name": {
"type": "string"
},
"initiatorType": {
"entryType": {
"const": "resource",
"type": "string"
},
"startTime": {
"type": "number"
},
"redirectStart": {
"duration": {
"type": "number"
},
"redirectTime": {
"connectStart": {
"type": "number"
},
"workerStart": {
"connectEnd": {
"type": "number"
},
"workerTime": {
"decodedBodySize": {
"type": "number"
},
"fetchStart": {
"domainLookupEnd": {
"type": "number"
},
"domainLookupStart": {
"type": "number"
},
"dns": {
"encodedBodySize": {
"type": "number"
},
"fetchStart": {
"type": "number"
},
"initiatorType": {
"type": "string",
"enum": [
"audio",
"beacon",
"body",
"css",
"early-hint",
"embed",
"fetch",
"frame",
"iframe",
"icon",
"image",
"img",
"input",
"link",
"navigation",
"object",
"ping",
"script",
"track",
"video",
"xmlhttprequest",
"other"
]
},
"nextHopProtocol": {
"type": "string"
},
"connectStart": {
"type": "number"
},
"connect": {
"redirectEnd": {
"type": "number"
},
"secureConnectionStart": {
"redirectStart": {
"type": "number"
},
"tlsTime": {
"type": "number"
"renderBlockingStatus": {
"type": "string"
},
"requestStart": {
"type": "number"
},
"timeToFirstByte": {
"responseEnd": {
"type": "number"
},
"responseStart": {
"type": "number"
},
"responseTime": {
"type": "number"
},
"duration": {
"type": "number"
},
"headerSize": {
"secureConnectionStart": {
"type": "number"
},
"transferSize": {
"type": "number"
},
"compressionRatio": {
"workerStart": {
"type": "number"
},
"fileType": {
"type": "string"
}
},
"additionalProperties": false,
"required": ["version", "initiatorType", "duration", "fileType"]
"required": ["duration", "entryType", "startTime"]
}
4 changes: 3 additions & 1 deletion src/orchestration/__tests__/Orchestration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ jest.mock('../../utils/common-utils', () => {
return {
__esModule: true,
...originalModule,
isLCPSupported: jest.fn().mockReturnValue(true)
isLCPSupported: jest.fn().mockReturnValue(true),
isNavigationSupported: jest.fn().mockReturnValue(true),
isResourceSupported: jest.fn().mockReturnValue(true)
};
});

Expand Down
Loading
Loading