@splitsoftware/splitio-commons 1.8.3 → 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.txt +3 -0
- package/cjs/logger/constants.js +3 -2
- package/cjs/logger/messages/warn.js +1 -0
- package/cjs/storages/inMemory/TelemetryCacheInMemory.js +17 -0
- package/cjs/sync/polling/updaters/splitChangesUpdater.js +4 -2
- package/cjs/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +6 -2
- package/cjs/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +16 -7
- package/cjs/sync/streaming/pushManager.js +17 -3
- package/cjs/trackers/telemetryTracker.js +5 -1
- package/esm/logger/constants.js +1 -0
- package/esm/logger/messages/warn.js +1 -0
- package/esm/storages/inMemory/TelemetryCacheInMemory.js +17 -0
- package/esm/sync/polling/updaters/splitChangesUpdater.js +4 -2
- package/esm/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +6 -2
- package/esm/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +13 -4
- package/esm/sync/streaming/pushManager.js +19 -5
- package/esm/trackers/telemetryTracker.js +5 -1
- package/package.json +1 -1
- package/src/logger/constants.ts +1 -0
- package/src/logger/messages/warn.ts +1 -0
- package/src/storages/inMemory/TelemetryCacheInMemory.ts +21 -1
- package/src/storages/types.ts +2 -1
- package/src/sync/polling/types.ts +2 -1
- package/src/sync/polling/updaters/splitChangesUpdater.ts +6 -4
- package/src/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.ts +6 -2
- package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +15 -6
- package/src/sync/streaming/pushManager.ts +18 -5
- package/src/sync/submitters/types.ts +8 -0
- package/src/trackers/telemetryTracker.ts +6 -1
- package/src/trackers/types.ts +5 -1
- package/types/logger/constants.d.ts +1 -0
- package/types/sdkClient/types.d.ts +18 -0
- package/types/storages/inMemory/CountsCacheInMemory.d.ts +20 -0
- package/types/storages/inMemory/LatenciesCacheInMemory.d.ts +20 -0
- package/types/storages/inMemory/TelemetryCacheInMemory.d.ts +7 -1
- package/types/storages/inRedis/CountsCacheInRedis.d.ts +9 -0
- package/types/storages/inRedis/LatenciesCacheInRedis.d.ts +9 -0
- package/types/storages/metadataBuilder.d.ts +3 -0
- package/types/storages/types.d.ts +2 -1
- package/types/sync/offline/LocalhostFromFile.d.ts +2 -0
- package/types/sync/offline/splitsParser/splitsParserFromFile.d.ts +2 -0
- package/types/sync/polling/types.d.ts +5 -1
- package/types/sync/polling/updaters/splitChangesUpdater.d.ts +4 -1
- package/types/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.d.ts +2 -1
- package/types/sync/streaming/UpdateWorkers/SplitsUpdateWorker.d.ts +2 -1
- package/types/sync/submitters/eventsSyncTask.d.ts +8 -0
- package/types/sync/submitters/impressionCountsSubmitterInRedis.d.ts +5 -0
- package/types/sync/submitters/impressionCountsSyncTask.d.ts +13 -0
- package/types/sync/submitters/impressionsSyncTask.d.ts +14 -0
- package/types/sync/submitters/metricsSyncTask.d.ts +12 -0
- package/types/sync/submitters/submitterSyncTask.d.ts +10 -0
- package/types/sync/submitters/types.d.ts +6 -0
- package/types/sync/submitters/uniqueKeysSubmitterInRedis.d.ts +5 -0
- package/types/sync/syncTaskComposite.d.ts +5 -0
- package/types/trackers/filter/bloomFilter.d.ts +10 -0
- package/types/trackers/filter/dictionaryFilter.d.ts +8 -0
- package/types/trackers/filter/types.d.ts +5 -0
- package/types/trackers/types.d.ts +5 -1
- package/types/utils/timeTracker/index.d.ts +70 -0
- package/types/utils/inputValidation/sdkKey.d.ts +0 -7
- /package/types/storages/inMemory/{UniqueKeysCacheInMemory.d.ts → uniqueKeysCacheInMemory.d.ts} +0 -0
- /package/types/storages/inMemory/{UniqueKeysCacheInMemoryCS.d.ts → uniqueKeysCacheInMemoryCS.d.ts} +0 -0
- /package/types/storages/inRedis/{UniqueKeysCacheInRedis.d.ts → uniqueKeysCacheInRedis.d.ts} +0 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ILogger } from '../../logger/types';
|
|
2
|
+
import { IResponse } from '../../services/types';
|
|
3
|
+
interface MetricsCollector {
|
|
4
|
+
countException(): void;
|
|
5
|
+
count(status: number): void;
|
|
6
|
+
latency(ms: number): void;
|
|
7
|
+
ready(ms: number): void;
|
|
8
|
+
getTreatment(ms: number): void;
|
|
9
|
+
getTreatments(ms: number): void;
|
|
10
|
+
getTreatmentWithConfig(ms: number): void;
|
|
11
|
+
getTreatmentsWithConfig(ms: number): void;
|
|
12
|
+
[method: string]: (ms: number) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const TrackerAPI: {
|
|
15
|
+
/**
|
|
16
|
+
* "Private" method, used to attach count/countException and stop callbacks to a promise.
|
|
17
|
+
*
|
|
18
|
+
* @param {ILogger} log - Logger.
|
|
19
|
+
* @param {Promise} promise - The promise we want to attach the callbacks.
|
|
20
|
+
* @param {string} task - The name of the task.
|
|
21
|
+
* @param {number | string} modifier - (optional) The modifier for the task, if any.
|
|
22
|
+
*/
|
|
23
|
+
__attachToPromise(log: ILogger, promise: Promise<IResponse>, task: string, collector: false | MetricsCollector, modifier?: string | number | undefined): Promise<IResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* Starts tracking the time for a given task. All tasks tracked are considered "unique" because
|
|
26
|
+
* there may be multiple SDK instances tracking a "generic" task, making any task non-generic.
|
|
27
|
+
*
|
|
28
|
+
* @param {ILogger} log - Logger.
|
|
29
|
+
* @param {string} task - The task we are starting.
|
|
30
|
+
* @param {Object} collectors - The collectors map.
|
|
31
|
+
* @param {Promise} promise - (optional) The promise we are tracking.
|
|
32
|
+
* @return {Function | Promise} The stop function for this specific task or the promise received with the callbacks registered.
|
|
33
|
+
*/
|
|
34
|
+
start(log: ILogger, task: string, collectors?: Record<string, MetricsCollector> | undefined, promise?: Promise<IResponse> | undefined, now?: (() => number) | undefined): Promise<IResponse> | (() => number);
|
|
35
|
+
/**
|
|
36
|
+
* Setup the collector for a task that reports metrics.
|
|
37
|
+
*
|
|
38
|
+
* @param {string} task - The task name
|
|
39
|
+
* @param {number | string} taskUniqueId - The unique identifier for this task
|
|
40
|
+
* @param {Object} collectors - The collectors map.
|
|
41
|
+
*/
|
|
42
|
+
setCollectorForTask(task: string, taskUniqueId: number | string, collectors: Record<string, MetricsCollector>): void;
|
|
43
|
+
/**
|
|
44
|
+
* Stops the tracking of a given task.
|
|
45
|
+
*
|
|
46
|
+
* @param {ILogger} log - Logger.
|
|
47
|
+
* @param {string} task - The task we are starting.
|
|
48
|
+
* @param {number | string} modifier - (optional) The modifier for that specific task.
|
|
49
|
+
*/
|
|
50
|
+
stop(log: ILogger, task: string, modifier?: string | number | undefined): number | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* The constants shortcut for the task names.
|
|
53
|
+
*/
|
|
54
|
+
TaskNames: {
|
|
55
|
+
SDK_READY: string;
|
|
56
|
+
SDK_GET_TREATMENT: string;
|
|
57
|
+
SDK_GET_TREATMENTS: string;
|
|
58
|
+
SDK_GET_TREATMENT_WITH_CONFIG: string;
|
|
59
|
+
SDK_GET_TREATMENTS_WITH_CONFIG: string;
|
|
60
|
+
SPLITS_READY: string;
|
|
61
|
+
SEGMENTS_READY: string;
|
|
62
|
+
METRICS_PUSH: string;
|
|
63
|
+
IMPRESSIONS_PUSH: string;
|
|
64
|
+
EVENTS_PUSH: string;
|
|
65
|
+
MY_SEGMENTS_FETCH: string;
|
|
66
|
+
SEGMENTS_FETCH: string;
|
|
67
|
+
SPLITS_FETCH: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ILogger } from '../../logger/types';
|
|
2
|
-
/** validates the given SDK key */
|
|
3
|
-
export declare function validateApiKey(log: ILogger, maybeSdkKey: any): string | false;
|
|
4
|
-
export declare const usedKeysMap: Record<string, number>;
|
|
5
|
-
/** validates the given SDK key and also warns if it is in use */
|
|
6
|
-
export declare function validateAndTrackApiKey(log: ILogger, maybeSdkKey: any): string | false;
|
|
7
|
-
export declare function releaseApiKey(sdkKey: string): void;
|
/package/types/storages/inMemory/{UniqueKeysCacheInMemory.d.ts → uniqueKeysCacheInMemory.d.ts}
RENAMED
|
File without changes
|
/package/types/storages/inMemory/{UniqueKeysCacheInMemoryCS.d.ts → uniqueKeysCacheInMemoryCS.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|