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

💥 [RUMF-1554] Drop some deprecated public APIs #2241

Merged
merged 2 commits into from
May 15, 2023
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
4 changes: 2 additions & 2 deletions developer-extension/src/panel/hooks/useSdkInfos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ async function getInfos(): Promise<SdkInfos> {
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 }
`
Expand Down
6 changes: 3 additions & 3 deletions packages/logs/src/boot/logsPublicApi.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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()
})

Expand Down
8 changes: 0 additions & 8 deletions packages/logs/src/boot/logsPublicApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
10 changes: 5 additions & 5 deletions packages/rum-core/src/boot/rumPublicApi.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down
10 changes: 0 additions & 10 deletions packages/rum-core/src/boot/rumPublicApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -249,8 +241,6 @@ export function makeRumPublicApi(

removeUserProperty: monitor(userContextManager.removeContextProperty),

/** @deprecated: renamed to clearUser */
removeUser: monitor(userContextManager.clearContext),
clearUser: monitor(userContextManager.clearContext),

startView,
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/scenario/rum/init.scenario.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down