Skip to content

Commit

Permalink
chore(release): 1.17.2 (#535)
Browse files Browse the repository at this point in the history
* fix: Allow title override in page attributes (#508)

* chore(deps-dev): bump ip from 1.1.5 to 1.1.9 (#513)

Bumps [ip](https://github.com/indutny/node-ip) from 1.1.5 to 1.1.9.
- [Commits](indutny/node-ip@v1.1.5...v1.1.9)

---
updated-dependencies:
- dependency-name: ip
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump follow-redirects from 1.15.4 to 1.15.6 (#525)

Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.4 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](follow-redirects/follow-redirects@v1.15.4...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump webpack-dev-middleware from 6.0.1 to 6.1.2 (#528)

Bumps [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware) from 6.0.1 to 6.1.2.
- [Release notes](https://github.com/webpack/webpack-dev-middleware/releases)
- [Changelog](https://github.com/webpack/webpack-dev-middleware/blob/v6.1.2/CHANGELOG.md)
- [Commits](webpack/webpack-dev-middleware@v6.0.1...v6.1.2)

---
updated-dependencies:
- dependency-name: webpack-dev-middleware
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: retry with exponential backoff (#501)

* feat: retry with exponential backoff

* fix

* test

* feat: limit retries to 5xx and 429 (#500)

* feat: limit PutRumEvents retry to 5xx

* feat: add 429

* cleanup

* cleanup

* docs

* doc

* fix: fmt

* chore(deps-dev): bump express from 4.18.1 to 4.19.2 (#531)

Bumps [express](https://github.com/expressjs/express) from 4.18.1 to 4.19.2.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](expressjs/express@4.18.1...4.19.2)

---
updated-dependencies:
- dependency-name: express
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: keep alive when dispatch fails (#524)

* feat: disableOnFail

* doc: add config doc

* Revert "doc: add config doc"

This reverts commit ec1f74f.

* Revert "feat: disableOnFail"

This reverts commit 67ed7b3.

* feat: only disable RUM when dispatch fails with 403 or 404

* chore: add unit tests

* feat: add 401

* fix: record resources with invalid names (#532)

* fix: Ignore URL construction error from invalid performance resource event

* fix: Throw error when URL construction fails for invalid performance resource event

* fix: Ignore error thrown from URL construction

* test: add unit test

* fix: record resources with invalid names

* fix: Update unit test for invalid url

* fix: Update hostname typo in isPutRumEventsCall tests

---------

Co-authored-by: Billy <billyzh@amazon.com>

* chore(release): 1.17.2

* Revert "Sync changes from main for 1.17.2 patch release"

* fix: record resources with invalid names (#532)

* fix: Ignore URL construction error from invalid performance resource event

* fix: Throw error when URL construction fails for invalid performance resource event

* fix: Ignore error thrown from URL construction

* test: add unit test

* fix: record resources with invalid names

* fix: Update unit test for invalid url

* fix: Update hostname typo in isPutRumEventsCall tests

---------

Co-authored-by: Billy <billyzh@amazon.com>

* Update changelog

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Quinn Hanam <qhanam@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Billy <billyzh@amazon.com>
  • Loading branch information
4 people committed Apr 9, 2024
1 parent a7758f9 commit 5d05cae
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 40 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [1.17.2](https://github.com/aws-observability/aws-rum-web/compare/v1.17.1...v1.17.2) (2024-04-03)

### Bug Fixes

* Record resources with invalid names ([#532](https://github.com/aws-observability/aws-rum-web/issues/532)) ([1da86e7](https://github.com/aws-observability/aws-rum-web/commit/1da86e7b42aa9545f623a5d55ca7859481b81e54))

### [1.17.1](https://github.com/aws-observability/aws-rum-web/compare/v1.17.0...v1.17.1) (2024-02-26)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aws-rum-web",
"version": "1.17.1",
"version": "1.17.2",
"sideEffects": false,
"description": "The Amazon CloudWatch RUM web client.",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/event-cache/EventCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '../dispatch/dataplane';
import EventBus, { Topic } from '../event-bus/EventBus';

const webClientVersion = '1.17.1';
const webClientVersion = '1.17.2';

/**
* A cache which stores events generated by telemetry plugins.
Expand Down
2 changes: 1 addition & 1 deletion src/event-cache/__tests__/EventCache.integ.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { DEFAULT_CONFIG, mockFetch } from '../../test-utils/test-utils';
import { SESSION_START_EVENT_TYPE } from '../../sessions/SessionManager';
import { INSTALL_MODULE } from '../../utils/constants';

const WEB_CLIENT_VERSION = '1.17.1';
const WEB_CLIENT_VERSION = '1.17.2';

global.fetch = mockFetch;
describe('EventCache tests', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/event-cache/__tests__/EventCache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jest.mock('../../sessions/SessionManager', () => ({
}))
}));

const WEB_CLIENT_VERSION = '1.17.1';
const WEB_CLIENT_VERSION = '1.17.2';

describe('EventCache tests', () => {
beforeAll(() => {
Expand Down
12 changes: 6 additions & 6 deletions src/plugins/event-plugins/ResourcePlugin.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { InternalPlugin } from '../InternalPlugin';
import { getResourceFileType, shuffle } from '../../utils/common-utils';
import {
getResourceFileType,
isPutRumEventsCall,
shuffle
} from '../../utils/common-utils';
import { ResourceEvent } from '../../events/resource-event';
import { PERFORMANCE_RESOURCE_EVENT_TYPE } from '../utils/constant';
import {
Expand Down Expand Up @@ -88,12 +92,8 @@ export class ResourcePlugin extends InternalPlugin {
duration,
transferSize
}: PerformanceResourceTiming): void => {
const pathRegex =
/.*\/application\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/events/;
const entryUrl = new URL(name);
if (
entryUrl.host === this.context.config.endpointUrl.host &&
pathRegex.test(entryUrl.pathname)
isPutRumEventsCall(name, this.context.config.endpointUrl.hostname)
) {
// Ignore calls to PutRumEvents (i.e., the CloudWatch RUM data
// plane), otherwise we end up in an infinite loop of recording
Expand Down
52 changes: 24 additions & 28 deletions src/plugins/event-plugins/__tests__/ResourcePlugin.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {
resourceTiming,
putRumEventsDocument,
putRumEventsGammaDocument,
dataPlaneDocument,
imageResourceEventA,
imageResourceEventB,
navigationEvent,
Expand Down Expand Up @@ -95,32 +93,6 @@ describe('ResourcePlugin tests', () => {
expect(record).not.toHaveBeenCalled();
});

test('when resource is a PutRumEvents request with a path prefix then resource event is not recorded', async () => {
// Setup
doMockPerformanceObserver([putRumEventsGammaDocument]);

const plugin: ResourcePlugin = buildResourcePlugin();

// Run
plugin.load(context);

// Assert
expect(record).not.toHaveBeenCalled();
});

test('when resource is not a PutRumEvents request but has the same host then the resource event is recorded', async () => {
// Setup
doMockPerformanceObserver([dataPlaneDocument]);

const plugin: ResourcePlugin = buildResourcePlugin();

// Run
plugin.load(context);

// Assert
expect(record).toHaveBeenCalled();
});

test('when enabled then events are recorded', async () => {
// Setup
const plugin: ResourcePlugin = buildResourcePlugin();
Expand Down Expand Up @@ -235,4 +207,28 @@ describe('ResourcePlugin tests', () => {

expect(record).not.toHaveBeenCalled();
});

test('when entry name is an invalid url then resource event is recorded', async () => {
// setup
const invalidEntry = {
name: 'invalid.com',
startTime: 0,
duration: 10,
entryType: 'resource'
} as PerformanceEntry;
doMockPerformanceObserver([invalidEntry]);

// run
const plugin = buildResourcePlugin();
plugin.load(context);

// assert
expect(() => new URL(invalidEntry.name)).toThrowError();
expect(() =>
plugin.recordResourceEvent(
invalidEntry as PerformanceResourceTiming
)
).not.toThrowError();
expect(record).toHaveBeenCalled();
});
});
29 changes: 29 additions & 0 deletions src/utils/__tests__/common-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,33 @@ describe('Common utils tests', () => {
utils.getResourceFileType(resourceUrl, utils.InitiatorType.CSS)
).toEqual(utils.ResourceType.STYLESHEET);
});

test('when url is has endpoint host and path then it is a PutRumEvents call', async () => {
const endpointHost = 'dataplane.rum.us-west-2.amazonaws.com';
const resourceUrl =
'https://dataplane.rum.us-west-2.amazonaws.com/gamma/application/aa17a42c-e737-48f7-adaf-2e0905f48073/events';
expect(utils.isPutRumEventsCall(resourceUrl, endpointHost)).toBe(true);
});

test('when url has endpoint host but wrong path then it is not a PutRumEvents call', async () => {
const endpointHost = 'dataplane.rum.us-west-2.amazonaws.com';
const resourceUrl =
'https://dataplane.rum.us-west-2.amazonaws.com/user';
expect(utils.isPutRumEventsCall(resourceUrl, endpointHost)).toBe(false);
});

test('when url has wrong host and wrong path then it is not a PutRumEvents call', async () => {
const endpointHost = 'example.com';
const resourceUrl =
'https://dataplane.rum.us-west-2.amazonaws.com/user';
expect(utils.isPutRumEventsCall(resourceUrl, endpointHost)).toBe(false);
});

test('when url is invalid then it is not a PutRumEvents call', async () => {
const endpointHost = 'dataplane.rum.us-west-2.amazonaws.com';
const resourceUrl =
'dataplane.rum.us-west-2.amazonaws.com/gamma/application/aa17a42c-e737-48f7-adaf-2e0905f48073/events';
expect(() => new URL(endpointHost)).toThrowError();
expect(utils.isPutRumEventsCall(resourceUrl, endpointHost)).toBe(false);
});
});
19 changes: 19 additions & 0 deletions src/utils/common-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,22 @@ export const isFCPSupported = () => {
export const isLongTaskSupported = () => {
return PerformanceObserver.supportedEntryTypes.includes('longtask');
};

/** PutRumEvents regex pattern */
const putRumEventsPattern =
/.*\/application\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/events/;

export const isPutRumEventsCall = (
url: string,
endpointHost: string
): boolean => {
try {
return (
new URL(url).hostname === endpointHost &&
putRumEventsPattern.test(url)
);
} catch (_) {
// Ignore invalid URLs
return false;
}
};

0 comments on commit 5d05cae

Please sign in to comment.