From 94c084b298d50db273982da4e6922708494c7739 Mon Sep 17 00:00:00 2001 From: Bastien Caudan Date: Fri, 12 May 2023 15:46:22 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=92=A5=20Drop=20removeUser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/rum-core/src/boot/rumPublicApi.spec.ts | 2 +- packages/rum-core/src/boot/rumPublicApi.ts | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/rum-core/src/boot/rumPublicApi.spec.ts b/packages/rum-core/src/boot/rumPublicApi.spec.ts index 455f13fdd6..068cf9b38b 100644 --- a/packages/rum-core/src/boot/rumPublicApi.spec.ts +++ b/packages/rum-core/src/boot/rumPublicApi.spec.ts @@ -460,7 +460,7 @@ describe('rum public api', () => { it('should remove the user', () => { const user = { id: 'foo', name: 'bar', email: 'qux' } rumPublicApi.setUser(user) - rumPublicApi.removeUser() + rumPublicApi.clearUser() rumPublicApi.addAction('message') rumPublicApi.init(DEFAULT_INIT_CONFIGURATION) diff --git a/packages/rum-core/src/boot/rumPublicApi.ts b/packages/rum-core/src/boot/rumPublicApi.ts index 584e8341fb..693b72df9d 100644 --- a/packages/rum-core/src/boot/rumPublicApi.ts +++ b/packages/rum-core/src/boot/rumPublicApi.ts @@ -249,8 +249,6 @@ export function makeRumPublicApi( removeUserProperty: monitor(userContextManager.removeContextProperty), - /** @deprecated: renamed to clearUser */ - removeUser: monitor(userContextManager.clearContext), clearUser: monitor(userContextManager.clearContext), startView, From 944a21845f127cc06a0c5e72042c995b0120a9ee Mon Sep 17 00:00:00 2001 From: Bastien Caudan Date: Fri, 12 May 2023 15:53:28 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=92=A5=20Drop=20(Rum|Logger)GlobalCon?= =?UTF-8?q?text=20APIs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- developer-extension/src/panel/hooks/useSdkInfos.ts | 4 ++-- packages/logs/src/boot/logsPublicApi.spec.ts | 6 +++--- packages/logs/src/boot/logsPublicApi.ts | 8 -------- packages/rum-core/src/boot/rumPublicApi.spec.ts | 8 ++++---- packages/rum-core/src/boot/rumPublicApi.ts | 8 -------- test/e2e/scenario/rum/init.scenario.ts | 4 ++-- 6 files changed, 11 insertions(+), 27 deletions(-) diff --git a/developer-extension/src/panel/hooks/useSdkInfos.ts b/developer-extension/src/panel/hooks/useSdkInfos.ts index 26a4ed3118..8a9b516658 100644 --- a/developer-extension/src/panel/hooks/useSdkInfos.ts +++ b/developer-extension/src/panel/hooks/useSdkInfos.ts @@ -61,12 +61,12 @@ async function getInfos(): Promise { version: window.DD_RUM?.version, config: window.DD_RUM?.getInitConfiguration?.(), internalContext: window.DD_RUM?.getInternalContext?.(), - globalContext: window.DD_RUM?.getRumGlobalContext?.(), + globalContext: window.DD_RUM?.getGlobalContext?.(), } const logs = window.DD_RUM && { version: window.DD_LOGS?.version, config: window.DD_LOGS?.getInitConfiguration?.(), - globalContext: window.DD_LOGS?.getLoggerGlobalContext?.(), + globalContext: window.DD_LOGS?.getGlobalContext?.(), } return { rum, logs, cookie } ` diff --git a/packages/logs/src/boot/logsPublicApi.spec.ts b/packages/logs/src/boot/logsPublicApi.spec.ts index b383e68f98..0c34049d3a 100644 --- a/packages/logs/src/boot/logsPublicApi.spec.ts +++ b/packages/logs/src/boot/logsPublicApi.spec.ts @@ -213,9 +213,9 @@ describe('logs entry', () => { }) it('stores a deep copy of the global context', () => { - LOGS.addLoggerGlobalContext('foo', 'bar') + LOGS.setGlobalContextProperty('foo', 'bar') LOGS.logger.log('message') - LOGS.addLoggerGlobalContext('foo', 'baz') + LOGS.setGlobalContextProperty('foo', 'baz') LOGS.init(DEFAULT_INIT_CONFIGURATION) @@ -322,7 +322,7 @@ describe('logs entry', () => { LOGS = makeLogsPublicApi(startLogs) }) - it('should return undefined if not initalized', () => { + it('should return undefined if not initialized', () => { expect(LOGS.getInternalContext()).toBeUndefined() }) diff --git a/packages/logs/src/boot/logsPublicApi.ts b/packages/logs/src/boot/logsPublicApi.ts index 67144dd5d1..a49b1a8988 100644 --- a/packages/logs/src/boot/logsPublicApi.ts +++ b/packages/logs/src/boot/logsPublicApi.ts @@ -99,20 +99,12 @@ export function makeLogsPublicApi(startLogsImpl: StartLogs) { isAlreadyInitialized = true }), - /** @deprecated: use getGlobalContext instead */ - getLoggerGlobalContext: monitor(globalContextManager.get), getGlobalContext: monitor(globalContextManager.getContext), - /** @deprecated: use setGlobalContext instead */ - setLoggerGlobalContext: monitor(globalContextManager.set), setGlobalContext: monitor(globalContextManager.setContext), - /** @deprecated: use setGlobalContextProperty instead */ - addLoggerGlobalContext: monitor(globalContextManager.add), setGlobalContextProperty: monitor(globalContextManager.setContextProperty), - /** @deprecated: use removeGlobalContextProperty instead */ - removeLoggerGlobalContext: monitor(globalContextManager.remove), removeGlobalContextProperty: monitor(globalContextManager.removeContextProperty), clearGlobalContext: monitor(globalContextManager.clearContext), diff --git a/packages/rum-core/src/boot/rumPublicApi.spec.ts b/packages/rum-core/src/boot/rumPublicApi.spec.ts index 068cf9b38b..3941b3ad7e 100644 --- a/packages/rum-core/src/boot/rumPublicApi.spec.ts +++ b/packages/rum-core/src/boot/rumPublicApi.spec.ts @@ -263,9 +263,9 @@ describe('rum public api', () => { }) it('stores a deep copy of the global context', () => { - rumPublicApi.addRumGlobalContext('foo', 'bar') + rumPublicApi.setGlobalContextProperty('foo', 'bar') rumPublicApi.addAction('message') - rumPublicApi.addRumGlobalContext('foo', 'baz') + rumPublicApi.setGlobalContextProperty('foo', 'baz') rumPublicApi.init(DEFAULT_INIT_CONFIGURATION) @@ -365,9 +365,9 @@ describe('rum public api', () => { }) it('stores a deep copy of the global context', () => { - rumPublicApi.addRumGlobalContext('foo', 'bar') + rumPublicApi.setGlobalContextProperty('foo', 'bar') rumPublicApi.addError(new Error('message')) - rumPublicApi.addRumGlobalContext('foo', 'baz') + rumPublicApi.setGlobalContextProperty('foo', 'baz') rumPublicApi.init(DEFAULT_INIT_CONFIGURATION) diff --git a/packages/rum-core/src/boot/rumPublicApi.ts b/packages/rum-core/src/boot/rumPublicApi.ts index 693b72df9d..284cb6bddb 100644 --- a/packages/rum-core/src/boot/rumPublicApi.ts +++ b/packages/rum-core/src/boot/rumPublicApi.ts @@ -188,20 +188,12 @@ export function makeRumPublicApi( const rumPublicApi = makePublicApi({ init: monitor(initRum), - /** @deprecated: use setGlobalContextProperty instead */ - addRumGlobalContext: monitor(globalContextManager.add), setGlobalContextProperty: monitor(globalContextManager.setContextProperty), - /** @deprecated: use removeGlobalContextProperty instead */ - removeRumGlobalContext: monitor(globalContextManager.remove), removeGlobalContextProperty: monitor(globalContextManager.removeContextProperty), - /** @deprecated: use getGlobalContext instead */ - getRumGlobalContext: monitor(globalContextManager.get), getGlobalContext: monitor(globalContextManager.getContext), - /** @deprecated: use setGlobalContext instead */ - setRumGlobalContext: monitor(globalContextManager.set), setGlobalContext: monitor(globalContextManager.setContext), clearGlobalContext: monitor(globalContextManager.clearContext), diff --git a/test/e2e/scenario/rum/init.scenario.ts b/test/e2e/scenario/rum/init.scenario.ts index 145f9a2a41..7a44e334b8 100644 --- a/test/e2e/scenario/rum/init.scenario.ts +++ b/test/e2e/scenario/rum/init.scenario.ts @@ -131,8 +131,8 @@ describe('beforeSend', () => { .withRumSlim() .withRumInit((configuration) => { window.DD_RUM!.init(configuration) - window.DD_RUM!.addRumGlobalContext('foo', 'baz') - window.DD_RUM!.addRumGlobalContext('zig', 'zag') + window.DD_RUM!.setGlobalContextProperty('foo', 'baz') + window.DD_RUM!.setGlobalContextProperty('zig', 'zag') }) .run(async ({ serverEvents }) => { await flushEvents()