From 93f4c3f53aa259fcbf83df325b898272c513b696 Mon Sep 17 00:00:00 2001 From: William Lacroix Date: Wed, 14 Dec 2022 15:21:22 +0100 Subject: [PATCH 1/2] v4.28.0 (#1876) --- CHANGELOG.md | 4 ++++ developer-extension/package.json | 2 +- lerna.json | 2 +- packages/core/package.json | 2 +- packages/logs/package.json | 4 ++-- packages/rum-core/package.json | 4 ++-- packages/rum-slim/package.json | 6 +++--- packages/rum/package.json | 6 +++--- performances/package.json | 2 +- test/app/yarn.lock | 20 ++++++++++---------- 10 files changed, 28 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 601f6a55c8..49d30b618a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ --- +## v4.28.0 + +- 🐛 [RUMF-1337] Fix incorrect fetch duration ([#1875](https://github.com/DataDog/browser-sdk/pull/1875)) + ## v4.27.1 - 🐛 [RUMF-1449] fix Zone support when **symbol** is missing ([#1872](https://github.com/DataDog/browser-sdk/pull/1872)) diff --git a/developer-extension/package.json b/developer-extension/package.json index c4036d9332..2928ba67fa 100644 --- a/developer-extension/package.json +++ b/developer-extension/package.json @@ -1,6 +1,6 @@ { "name": "@datadog/browser-sdk-developer-extension", - "version": "4.27.1", + "version": "4.28.0", "private": true, "scripts": { "build": "rm -rf dist && webpack --mode production", diff --git a/lerna.json b/lerna.json index 14c38ee32a..acd7a161fd 100644 --- a/lerna.json +++ b/lerna.json @@ -1,7 +1,7 @@ { "npmClient": "yarn", "useWorkspaces": true, - "version": "4.27.1", + "version": "4.28.0", "publishConfig": { "access": "public" } diff --git a/packages/core/package.json b/packages/core/package.json index 4194799f74..3a5e2744bf 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@datadog/browser-core", - "version": "4.27.1", + "version": "4.28.0", "license": "Apache-2.0", "main": "cjs/index.js", "module": "esm/index.js", diff --git a/packages/logs/package.json b/packages/logs/package.json index eca6288f77..b0e4d08fa6 100644 --- a/packages/logs/package.json +++ b/packages/logs/package.json @@ -1,6 +1,6 @@ { "name": "@datadog/browser-logs", - "version": "4.27.1", + "version": "4.28.0", "license": "Apache-2.0", "main": "cjs/entries/main.js", "module": "esm/entries/main.js", @@ -13,7 +13,7 @@ "replace-build-env": "node ../../scripts/replace-build-env.js" }, "dependencies": { - "@datadog/browser-core": "4.27.1" + "@datadog/browser-core": "4.28.0" }, "peerDependencies": { "@datadog/browser-rum": "4.27.1" diff --git a/packages/rum-core/package.json b/packages/rum-core/package.json index 3bb607a739..adcfcea495 100644 --- a/packages/rum-core/package.json +++ b/packages/rum-core/package.json @@ -1,6 +1,6 @@ { "name": "@datadog/browser-rum-core", - "version": "4.27.1", + "version": "4.28.0", "license": "Apache-2.0", "main": "cjs/index.js", "module": "esm/index.js", @@ -12,7 +12,7 @@ "replace-build-env": "node ../../scripts/replace-build-env.js" }, "dependencies": { - "@datadog/browser-core": "4.27.1" + "@datadog/browser-core": "4.28.0" }, "devDependencies": { "ajv": "6.12.6" diff --git a/packages/rum-slim/package.json b/packages/rum-slim/package.json index 09ae07ef68..c1fbaf4acb 100644 --- a/packages/rum-slim/package.json +++ b/packages/rum-slim/package.json @@ -1,6 +1,6 @@ { "name": "@datadog/browser-rum-slim", - "version": "4.27.1", + "version": "4.28.0", "license": "Apache-2.0", "main": "cjs/entries/main.js", "module": "esm/entries/main.js", @@ -12,8 +12,8 @@ "build:esm": "rm -rf esm && tsc -p tsconfig.esm.json" }, "dependencies": { - "@datadog/browser-core": "4.27.1", - "@datadog/browser-rum-core": "4.27.1" + "@datadog/browser-core": "4.28.0", + "@datadog/browser-rum-core": "4.28.0" }, "peerDependencies": { "@datadog/browser-logs": "4.27.1" diff --git a/packages/rum/package.json b/packages/rum/package.json index 84bdc99415..aab5b68b5d 100644 --- a/packages/rum/package.json +++ b/packages/rum/package.json @@ -1,6 +1,6 @@ { "name": "@datadog/browser-rum", - "version": "4.27.1", + "version": "4.28.0", "license": "Apache-2.0", "main": "cjs/entries/main.js", "module": "esm/entries/main.js", @@ -12,8 +12,8 @@ "build:esm": "rm -rf esm && tsc -p tsconfig.esm.json" }, "dependencies": { - "@datadog/browser-core": "4.27.1", - "@datadog/browser-rum-core": "4.27.1" + "@datadog/browser-core": "4.28.0", + "@datadog/browser-rum-core": "4.28.0" }, "peerDependencies": { "@datadog/browser-logs": "4.27.1" diff --git a/performances/package.json b/performances/package.json index 90771b8b28..d750dff698 100644 --- a/performances/package.json +++ b/performances/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "performances", - "version": "4.27.1", + "version": "4.28.0", "scripts": { "start": "ts-node ./src/main.ts" }, diff --git a/test/app/yarn.lock b/test/app/yarn.lock index aba3fc775d..17780dd007 100644 --- a/test/app/yarn.lock +++ b/test/app/yarn.lock @@ -2,24 +2,24 @@ # yarn lockfile v1 -"@datadog/browser-core@4.27.1", "@datadog/browser-core@file:../../packages/core": - version "4.27.1" +"@datadog/browser-core@4.28.0", "@datadog/browser-core@file:../../packages/core": + version "4.28.0" "@datadog/browser-logs@file:../../packages/logs": - version "4.27.1" + version "4.28.0" dependencies: - "@datadog/browser-core" "4.27.1" + "@datadog/browser-core" "4.28.0" -"@datadog/browser-rum-core@4.27.1", "@datadog/browser-rum-core@file:../../packages/rum-core": - version "4.27.1" +"@datadog/browser-rum-core@4.28.0", "@datadog/browser-rum-core@file:../../packages/rum-core": + version "4.28.0" dependencies: - "@datadog/browser-core" "4.27.1" + "@datadog/browser-core" "4.28.0" "@datadog/browser-rum@file:../../packages/rum": - version "4.27.1" + version "4.28.0" dependencies: - "@datadog/browser-core" "4.27.1" - "@datadog/browser-rum-core" "4.27.1" + "@datadog/browser-core" "4.28.0" + "@datadog/browser-rum-core" "4.28.0" "@jridgewell/gen-mapping@^0.3.0": version "0.3.2" From cbc83fff4aa26f23b27b36d8e0123db90d32ecec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Zugmeyer?= Date: Wed, 14 Dec 2022 16:00:53 +0100 Subject: [PATCH 2/2] =?UTF-8?q?Revert=20"Revert=20"=E2=9C=A8=20[RUMF-1425]?= =?UTF-8?q?=20enable=20request=20retry/throttle=20for=20replay=20intake=20?= =?UTF-8?q?(#1819)"=20(#1820)"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit b4105f81d1645bea255132655ec200582a6e982d. --- .../segmentCollection.spec.ts | 98 +++---------------- .../segmentCollection/segmentCollection.ts | 8 +- 2 files changed, 15 insertions(+), 91 deletions(-) diff --git a/packages/rum/src/domain/segmentCollection/segmentCollection.spec.ts b/packages/rum/src/domain/segmentCollection/segmentCollection.spec.ts index 64d2252852..a67d4544b4 100644 --- a/packages/rum/src/domain/segmentCollection/segmentCollection.spec.ts +++ b/packages/rum/src/domain/segmentCollection/segmentCollection.spec.ts @@ -1,5 +1,5 @@ import type { HttpRequest, TimeStamp } from '@datadog/browser-core' -import { PageExitReason, updateExperimentalFeatures, resetExperimentalFeatures, isIE } from '@datadog/browser-core' +import { PageExitReason, isIE } from '@datadog/browser-core' import type { ViewContexts, ViewContext } from '@datadog/browser-rum-core' import { LifeCycle, LifeCycleEventType } from '@datadog/browser-rum-core' import type { Clock } from '@datadog/browser-core/test/specHelper' @@ -83,7 +83,6 @@ describe('startSegmentCollection', () => { afterEach(() => { clock?.cleanup() stopSegmentCollection() - resetExperimentalFeatures() }) describe('initial segment', () => { @@ -135,17 +134,6 @@ describe('startSegmentCollection', () => { expect(httpRequestSpy.sendOnExit).toHaveBeenCalled() }) - describe('with the retry_replay experimental flag', () => { - beforeEach(() => { - updateExperimentalFeatures(['retry_replay']) - }) - - it('uses `httpRequest.sendOnExit` when sending the segment', () => { - addRecordAndFlushSegment(emulatePageUnload) - expect(httpRequestSpy.sendOnExit).toHaveBeenCalled() - }) - }) - it('next segment is created because of beforeunload event', () => { addRecordAndFlushSegment(emulatePageUnload) addRecordAndFlushSegment() @@ -163,17 +151,6 @@ describe('startSegmentCollection', () => { expect(httpRequestSpy.sendOnExit).toHaveBeenCalled() }) - describe('with the retry_replay experimental flag', () => { - beforeEach(() => { - updateExperimentalFeatures(['retry_replay']) - }) - - it('uses `httpRequest.sendOnExit` when sending the segment', () => { - addRecordAndFlushSegment(emulatePageHidden) - expect(httpRequestSpy.sendOnExit).toHaveBeenCalled() - }) - }) - it('next segment is created because of visibility hidden event', () => { addRecordAndFlushSegment(emulatePageHidden) addRecordAndFlushSegment() @@ -186,20 +163,9 @@ describe('startSegmentCollection', () => { lifeCycle.notify(LifeCycleEventType.VIEW_CREATED, {} as any) } - it('uses `httpRequest.sendOnExit` when sending the segment', () => { + it('uses `httpRequest.send` when sending the segment', () => { addRecordAndFlushSegment(emulateViewChange) - expect(httpRequestSpy.sendOnExit).toHaveBeenCalled() - }) - - describe('with the retry_replay experimental flag', () => { - beforeEach(() => { - updateExperimentalFeatures(['retry_replay']) - }) - - it('uses `httpRequest.send` when sending the segment', () => { - addRecordAndFlushSegment(emulateViewChange) - expect(httpRequestSpy.send).toHaveBeenCalled() - }) + expect(httpRequestSpy.send).toHaveBeenCalled() }) it('next segment is created because of view change', () => { @@ -210,24 +176,11 @@ describe('startSegmentCollection', () => { }) describe('flush when reaching a bytes limit', () => { - it('uses `httpRequest.sendOnExit` when sending the segment', () => { + it('uses `httpRequest.send` when sending the segment', () => { addRecordAndFlushSegment(() => { addRecord(VERY_BIG_RECORD) }) - expect(httpRequestSpy.sendOnExit).toHaveBeenCalled() - }) - - describe('with the retry_replay experimental flag', () => { - beforeEach(() => { - updateExperimentalFeatures(['retry_replay']) - }) - - it('uses `httpRequest.send` when sending the segment', () => { - addRecordAndFlushSegment(() => { - addRecord(VERY_BIG_RECORD) - }) - expect(httpRequestSpy.send).toHaveBeenCalled() - }) + expect(httpRequestSpy.send).toHaveBeenCalled() }) it('next segment is created because the bytes limit has been reached', () => { @@ -246,8 +199,8 @@ describe('startSegmentCollection', () => { addRecord(RECORD) worker.processAllMessages() - expect(httpRequestSpy.sendOnExit).toHaveBeenCalledTimes(1) - expect(getSentFormData(httpRequestSpy.sendOnExit).get('records_count')).toBe('4') + expect(httpRequestSpy.send).toHaveBeenCalledTimes(1) + expect(getSentFormData(httpRequestSpy.send).get('records_count')).toBe('4') }) it('does not flush segment prematurely when records from the previous segment are still being processed', () => { @@ -264,32 +217,18 @@ describe('startSegmentCollection', () => { worker.processAllMessages() - expect(httpRequestSpy.sendOnExit).toHaveBeenCalledTimes(1) - expect(getSentFormData(httpRequestSpy.sendOnExit).get('records_count')).toBe('2') + expect(httpRequestSpy.send).toHaveBeenCalledTimes(1) + expect(getSentFormData(httpRequestSpy.send).get('records_count')).toBe('2') }) }) describe('flush when a duration has been reached', () => { - it('uses `httpRequest.sendOnExit` when sending the segment', () => { + it('uses `httpRequest.send` when sending the segment', () => { clock = mockClock() addRecordAndFlushSegment(() => { clock!.tick(SEGMENT_DURATION_LIMIT) }) - expect(httpRequestSpy.sendOnExit).toHaveBeenCalled() - }) - - describe('with the retry_replay experimental flag', () => { - beforeEach(() => { - updateExperimentalFeatures(['retry_replay']) - }) - - it('uses `httpRequest.send` when sending the segment', () => { - clock = mockClock() - addRecordAndFlushSegment(() => { - clock!.tick(SEGMENT_DURATION_LIMIT) - }) - expect(httpRequestSpy.send).toHaveBeenCalled() - }) + expect(httpRequestSpy.send).toHaveBeenCalled() }) it('next segment is created because of the segment duration limit has been reached', () => { @@ -317,20 +256,9 @@ describe('startSegmentCollection', () => { }) describe('flush when stopping segment collection', () => { - it('uses `httpRequest.sendOnExit` when sending the segment', () => { + it('uses `httpRequest.send` when sending the segment', () => { addRecordAndFlushSegment(stopSegmentCollection) - expect(httpRequestSpy.sendOnExit).toHaveBeenCalled() - }) - - describe('with the retry_replay experimental flag', () => { - beforeEach(() => { - updateExperimentalFeatures(['retry_replay']) - }) - - it('uses `httpRequest.send` when sending the segment', () => { - addRecordAndFlushSegment(stopSegmentCollection) - expect(httpRequestSpy.send).toHaveBeenCalled() - }) + expect(httpRequestSpy.send).toHaveBeenCalled() }) }) }) diff --git a/packages/rum/src/domain/segmentCollection/segmentCollection.ts b/packages/rum/src/domain/segmentCollection/segmentCollection.ts index 821b583e3a..ce7dd49739 100644 --- a/packages/rum/src/domain/segmentCollection/segmentCollection.ts +++ b/packages/rum/src/domain/segmentCollection/segmentCollection.ts @@ -1,5 +1,5 @@ import type { HttpRequest, TimeoutId } from '@datadog/browser-core' -import { isExperimentalFeatureEnabled, ONE_SECOND, monitor } from '@datadog/browser-core' +import { ONE_SECOND, monitor } from '@datadog/browser-core' import type { LifeCycle, ViewContexts, RumSessionManager } from '@datadog/browser-rum-core' import { LifeCycleEventType } from '@datadog/browser-rum-core' import type { BrowserRecord, CreationReason, SegmentContext } from '../../types' @@ -133,11 +133,7 @@ export function doStartSegmentCollection( }, (data, rawSegmentBytesCount) => { const payload = buildReplayPayload(data, segment.metadata, rawSegmentBytesCount) - if ( - !isExperimentalFeatureEnabled('retry_replay') || - segment.flushReason === 'visibility_hidden' || - segment.flushReason === 'before_unload' - ) { + if (segment.flushReason === 'visibility_hidden' || segment.flushReason === 'before_unload') { httpRequest.sendOnExit(payload) } else { httpRequest.send(payload)