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

feat: move data plane events processing to core #1999

Draft
wants to merge 65 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 62 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
02d2f5d
feat: move error reporting functionality to the core module
saikumarrs Dec 31, 2024
b93cb5a
chore: remove unnecessary console statement in test suite
saikumarrs Jan 2, 2025
3026f5f
chore: delete duplicate constants file
saikumarrs Jan 2, 2025
9b0f514
chore: restore error messages filtering logic
saikumarrs Jan 2, 2025
3fd7a5a
refactor: move code around to the right places
saikumarrs Jan 2, 2025
65e3190
chore: remove unnecessary test suites
saikumarrs Jan 2, 2025
9a8df29
fix: error filtering and logging
saikumarrs Jan 2, 2025
c34b0a2
chore: fix test target
saikumarrs Jan 2, 2025
d40d8cf
test: add tests for errorhandler
saikumarrs Jan 2, 2025
702aeb6
test: add more test cases for coverage
saikumarrs Jan 2, 2025
d5d6dff
refactor: remove the need to create new http client
saikumarrs Jan 2, 2025
d1b9ac4
test: refactor browser test suite
saikumarrs Jan 2, 2025
a30f526
chore: adjust size limits
saikumarrs Jan 2, 2025
d2e051e
test: improve browser test suite
saikumarrs Jan 2, 2025
059388a
test: improve code coverage
saikumarrs Jan 2, 2025
a3d8561
chore: use sonarqube scan
saikumarrs Jan 3, 2025
69ac89b
chore: minor improvements
saikumarrs Jan 3, 2025
cb0f336
chore: minor improvements 2
saikumarrs Jan 3, 2025
115ab6a
fix: error handling
saikumarrs Jan 3, 2025
733387f
refactor: address ai bot review comments
saikumarrs Jan 3, 2025
f51cb95
test: add missing unit test for source configuration data
saikumarrs Jan 3, 2025
c852699
chore: address ai bot review comments
saikumarrs Jan 3, 2025
cb8e1d8
fix: user and context details in the error payload
saikumarrs Jan 3, 2025
5c1fbe4
chore: remove invalid test case
saikumarrs Jan 3, 2025
a590ed8
test: fix failing tests
saikumarrs Jan 3, 2025
75f05c6
fix: restore user name in the payload type
saikumarrs Jan 3, 2025
7e0d815
chore: replace deprecated jest apis
saikumarrs Jan 3, 2025
a749734
Merge remote-tracking branch 'origin/develop' into feat.move-error-re…
saikumarrs Jan 7, 2025
4606387
chore: avoid fixing paths in reports
saikumarrs Jan 7, 2025
6e6dba8
chore: fix reports paths to relative
saikumarrs Jan 7, 2025
10bf1a8
chore: fix report paths
saikumarrs Jan 7, 2025
dcf0c70
Merge remote-tracking branch 'origin/develop' into feat.move-error-re…
saikumarrs Jan 7, 2025
8cf04e3
Merge remote-tracking branch 'origin/develop' into feat.move-error-re…
saikumarrs Jan 8, 2025
073c1c6
fix: error message prefix
saikumarrs Jan 9, 2025
96c79cc
fix: allow errors with simple stack trace
saikumarrs Jan 9, 2025
cd9b9e9
fix: add custom message separator
saikumarrs Jan 9, 2025
f623d4b
fix: filter only unhandled errors
saikumarrs Jan 9, 2025
56afb07
fix: callback invocations
saikumarrs Jan 9, 2025
85f5ac0
fix: remove unwanted error handling logic
saikumarrs Jan 9, 2025
7fd54ba
test: add more test cases for coverage
saikumarrs Jan 9, 2025
1b0b0db
test: add more test cases for coverage
saikumarrs Jan 9, 2025
e67f70e
test: add more test cases for improving coverage of error handler
saikumarrs Jan 9, 2025
7a74983
fix: add missing event properties
saikumarrs Jan 10, 2025
a59a002
test: add more test cases for improving coverage of error handler
saikumarrs Jan 10, 2025
c9c6453
test: add more test cases for improving coverage in multiple modules
saikumarrs Jan 10, 2025
ef841ae
test: add more test cases for improving coverage in config manager
saikumarrs Jan 10, 2025
0ecb545
test: add more test cases for improving coverage in plugin engine
saikumarrs Jan 10, 2025
8451e77
test: address ai bot review comments
saikumarrs Jan 10, 2025
12ff2ca
feat: move data plane events processing to core
saikumarrs Jan 10, 2025
f27ad1c
Merge remote-tracking branch 'origin/develop' into feat.move-error-re…
saikumarrs Jan 12, 2025
43979e1
Merge remote-tracking branch 'origin/feat.move-error-reporting-to-cor…
saikumarrs Jan 12, 2025
449a5e5
chore: skip tests temporarily
saikumarrs Jan 12, 2025
dd3c0cc
feat: move retry queue to common
saikumarrs Jan 12, 2025
9fed03a
feat: use fetch api
saikumarrs Jan 16, 2025
89b30d9
Merge remote-tracking branch 'origin/develop' into feat.move-event-ha…
saikumarrs Jan 20, 2025
bf89963
Merge remote-tracking branch 'origin/develop' into feat.move-event-ha…
saikumarrs Jan 24, 2025
86f5bf4
chore: address sonar issues
saikumarrs Jan 24, 2025
7fd3b7d
Merge branch 'develop' into feat.move-event-handling-to-core-sdk-2823
saikumarrs Jan 28, 2025
52e42be
feat: add dataplane events queue component
saikumarrs Jan 28, 2025
5e136f1
Merge remote-tracking branch 'origin/develop' into feat.move-event-ha…
saikumarrs Jan 30, 2025
d8d0196
chore: ai bot code review comments
saikumarrs Jan 30, 2025
0b5daed
feat: add missing polyfills
saikumarrs Jan 30, 2025
c006d04
Merge remote-tracking branch 'origin/develop' into feat.move-event-ha…
saikumarrs Jan 31, 2025
023d77a
Merge remote-tracking branch 'origin/develop' into feat.move-event-ha…
saikumarrs Feb 11, 2025
3edab47
Merge remote-tracking branch 'origin/develop' into feat.move-event-ha…
saikumarrs Feb 12, 2025
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
6 changes: 4 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
"CustomEvent",
"requestAnimationFrame",
"cancelAnimationFrame",
"navigator.sendBeacon",
"Uint8Array",
"Set",
"atob"
"atob",
"AbortController",
"fetch",
"Response"
]
},
"env": {
Expand Down
2 changes: 0 additions & 2 deletions jest/jest.polyfills.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@ global.Math.random = () => 0.5;
// Suppress Console output from tested code to terminal
console.warn = jest.fn();
console.error = jest.fn();
// Mock browsers sendBeacon utility
navigator.sendBeacon = jest.fn();
5 changes: 1 addition & 4 deletions packages/analytics-js-common/__mocks__/HttpClient.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import type { IErrorHandler } from '@rudderstack/analytics-js-common/types/ErrorHandler';
import type { IHttpClient } from '@rudderstack/analytics-js-common/types/HttpClient';
import type { ILogger } from '@rudderstack/analytics-js-common/types/Logger';
import { defaultLogger } from './Logger';

class HttpClient implements IHttpClient {
errorHandler?: IErrorHandler;
logger: ILogger = defaultLogger;
hasErrorHandler = false;
getData = jest.fn();
request = jest.fn();
getAsyncData = jest.fn();
setAuthHeader = jest.fn();
resetAuthHeader = jest.fn();
init = jest.fn();
}

const defaultHttpClient = new HttpClient();
Expand Down
7 changes: 4 additions & 3 deletions packages/analytics-js-common/__mocks__/Store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { defaultInMemoryStorage, defaultLocalStorage } from './Storage';
import { defaultPluginsManager } from './PluginsManager';
import { defaultLogger } from './Logger';
import { defaultErrorHandler } from './ErrorHandler';
import type { Nullable } from '@rudderstack/analytics-js-common/types/Nullable';

// Mock all the methods of the Store class

Expand All @@ -12,7 +13,7 @@ class Store implements IStore {
this.id = config.id;
this.name = config.name;
this.isEncrypted = config.isEncrypted ?? false;
this.validKeys = config.validKeys ?? {};
this.validKeys = config.validKeys ?? [];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Use an array for validKeys
Switching validKeys to an array is simpler and more predictable for iteration. Ensure you update any prior code that might rely on a key-value record structure.

this.engine = engine ?? defaultLocalStorage;
this.originalEngine = this.engine;
this.errorHandler = config.errorHandler;
Expand All @@ -22,7 +23,7 @@ class Store implements IStore {
id = 'test';
name = 'test';
isEncrypted = false;
validKeys: Record<string, string>;
validKeys: string[];
engine: IStorage = defaultLocalStorage;
originalEngine: IStorage = defaultLocalStorage;
errorHandler;
Expand All @@ -43,7 +44,7 @@ class Store implements IStore {
const validKey = this.createValidKey(key);
this.engine.setItem(validKey, value);
};
get = (key: string) => {
get = <T = string>(key: string): Nullable<T> => {
const validKey = this.createValidKey(key);
return this.engine.getItem(validKey);
};
Expand Down
4 changes: 4 additions & 0 deletions packages/analytics-js-common/__mocks__/StoreManager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import type { IStoreConfig, IStoreManager } from '../src/types/Store';
import { defaultErrorHandler } from './ErrorHandler';
import { defaultLogger } from './Logger';
import { defaultPluginsManager } from './PluginsManager';
import { defaultCookieStorage, defaultInMemoryStorage, defaultLocalStorage } from './Storage';
import { defaultStore, Store } from './Store';
Expand All @@ -25,6 +27,8 @@ class StoreManager implements IStoreManager {
return new Store(config, storageEngine, defaultPluginsManager);
};
getStore = jest.fn(() => defaultStore);
errorHandler = defaultErrorHandler;
logger = defaultLogger;
initializeStorageState = jest.fn();
}

Expand Down
Loading