@splitsoftware/splitio-commons 1.3.1 → 1.3.2-rc.2

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.
Files changed (219) hide show
  1. package/cjs/consent/sdkUserConsent.js +1 -1
  2. package/cjs/listeners/browser.js +5 -4
  3. package/cjs/logger/constants.js +2 -1
  4. package/cjs/logger/messages/error.js +2 -1
  5. package/cjs/logger/messages/info.js +3 -3
  6. package/cjs/logger/messages/warn.js +2 -2
  7. package/cjs/sdkClient/client.js +17 -3
  8. package/cjs/sdkClient/sdkClient.js +4 -1
  9. package/cjs/sdkFactory/index.js +16 -19
  10. package/cjs/services/splitApi.js +15 -14
  11. package/cjs/services/splitHttpClient.js +4 -1
  12. package/cjs/storages/AbstractSegmentsCacheSync.js +0 -5
  13. package/cjs/storages/KeyBuilderSS.js +12 -19
  14. package/cjs/storages/findLatencyIndex.js +11 -6
  15. package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +13 -1
  16. package/cjs/storages/inLocalStorage/index.js +4 -1
  17. package/cjs/storages/inMemory/InMemoryStorage.js +2 -0
  18. package/cjs/storages/inMemory/InMemoryStorageCS.js +3 -0
  19. package/cjs/storages/inMemory/MySegmentsCacheInMemory.js +6 -0
  20. package/cjs/storages/inMemory/SegmentsCacheInMemory.js +6 -0
  21. package/cjs/storages/inMemory/TelemetryCacheInMemory.js +165 -0
  22. package/cjs/storages/inRedis/TelemetryCacheInRedis.js +29 -0
  23. package/cjs/storages/inRedis/index.js +2 -4
  24. package/cjs/storages/pluggable/TelemetryCachePluggable.js +27 -0
  25. package/cjs/storages/pluggable/index.js +2 -1
  26. package/cjs/sync/polling/pollingManagerCS.js +1 -1
  27. package/cjs/sync/polling/syncTasks/splitsSyncTask.js +2 -2
  28. package/cjs/sync/polling/updaters/mySegmentsUpdater.js +0 -3
  29. package/cjs/sync/polling/updaters/segmentChangesUpdater.js +1 -8
  30. package/cjs/sync/polling/updaters/splitChangesUpdater.js +3 -6
  31. package/cjs/sync/streaming/SSEHandler/NotificationKeeper.js +20 -13
  32. package/cjs/sync/streaming/SSEHandler/index.js +21 -15
  33. package/cjs/sync/streaming/pushManager.js +7 -4
  34. package/cjs/sync/submitters/eventsSubmitter.js +28 -0
  35. package/cjs/sync/submitters/{impressionCountsSyncTask.js → impressionCountsSubmitter.js} +10 -7
  36. package/cjs/sync/submitters/{impressionsSyncTask.js → impressionsSubmitter.js} +8 -8
  37. package/cjs/sync/submitters/submitter.js +66 -0
  38. package/cjs/sync/submitters/submitterManager.js +12 -10
  39. package/cjs/sync/submitters/telemetrySubmitter.js +128 -0
  40. package/cjs/sync/syncManagerOnline.js +6 -2
  41. package/cjs/trackers/eventTracker.js +5 -1
  42. package/cjs/trackers/impressionsTracker.js +9 -1
  43. package/cjs/trackers/telemetryTracker.js +65 -0
  44. package/cjs/utils/constants/index.js +40 -1
  45. package/cjs/utils/inputValidation/apiKey.js +12 -11
  46. package/cjs/utils/settingsValidation/index.js +35 -11
  47. package/cjs/utils/settingsValidation/url.js +4 -0
  48. package/cjs/utils/timeTracker/index.js +1 -0
  49. package/cjs/utils/timeTracker/timer.js +2 -2
  50. package/esm/consent/sdkUserConsent.js +1 -1
  51. package/esm/listeners/browser.js +3 -2
  52. package/esm/logger/constants.js +1 -0
  53. package/esm/logger/messages/error.js +2 -1
  54. package/esm/logger/messages/info.js +3 -3
  55. package/esm/logger/messages/warn.js +2 -2
  56. package/esm/sdkClient/client.js +18 -4
  57. package/esm/sdkClient/sdkClient.js +4 -1
  58. package/esm/sdkFactory/index.js +16 -19
  59. package/esm/services/splitApi.js +15 -14
  60. package/esm/services/splitHttpClient.js +4 -1
  61. package/esm/storages/AbstractSegmentsCacheSync.js +0 -5
  62. package/esm/storages/KeyBuilderSS.js +12 -19
  63. package/esm/storages/findLatencyIndex.js +11 -6
  64. package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +13 -1
  65. package/esm/storages/inLocalStorage/index.js +5 -2
  66. package/esm/storages/inMemory/InMemoryStorage.js +3 -1
  67. package/esm/storages/inMemory/InMemoryStorageCS.js +4 -1
  68. package/esm/storages/inMemory/MySegmentsCacheInMemory.js +6 -0
  69. package/esm/storages/inMemory/SegmentsCacheInMemory.js +6 -0
  70. package/esm/storages/inMemory/TelemetryCacheInMemory.js +161 -0
  71. package/esm/storages/inRedis/TelemetryCacheInRedis.js +26 -0
  72. package/esm/storages/inRedis/index.js +2 -4
  73. package/esm/storages/pluggable/TelemetryCachePluggable.js +24 -0
  74. package/esm/storages/pluggable/index.js +2 -1
  75. package/esm/sync/polling/pollingManagerCS.js +1 -1
  76. package/esm/sync/polling/syncTasks/splitsSyncTask.js +2 -2
  77. package/esm/sync/polling/updaters/mySegmentsUpdater.js +0 -3
  78. package/esm/sync/polling/updaters/segmentChangesUpdater.js +1 -8
  79. package/esm/sync/polling/updaters/splitChangesUpdater.js +3 -6
  80. package/esm/sync/streaming/SSEHandler/NotificationKeeper.js +8 -1
  81. package/esm/sync/streaming/SSEHandler/index.js +21 -15
  82. package/esm/sync/streaming/pushManager.js +7 -4
  83. package/esm/sync/submitters/eventsSubmitter.js +24 -0
  84. package/esm/sync/submitters/{impressionCountsSyncTask.js → impressionCountsSubmitter.js} +8 -5
  85. package/esm/sync/submitters/{impressionsSyncTask.js → impressionsSubmitter.js} +6 -6
  86. package/esm/sync/submitters/submitter.js +61 -0
  87. package/esm/sync/submitters/submitterManager.js +12 -10
  88. package/esm/sync/submitters/telemetrySubmitter.js +122 -0
  89. package/esm/sync/syncManagerOnline.js +6 -2
  90. package/esm/trackers/eventTracker.js +6 -2
  91. package/esm/trackers/impressionsTracker.js +10 -2
  92. package/esm/trackers/telemetryTracker.js +61 -0
  93. package/esm/utils/constants/index.js +38 -0
  94. package/esm/utils/inputValidation/apiKey.js +2 -1
  95. package/esm/utils/settingsValidation/index.js +34 -10
  96. package/esm/utils/settingsValidation/url.js +4 -0
  97. package/esm/utils/timeTracker/index.js +1 -0
  98. package/esm/utils/timeTracker/timer.js +2 -2
  99. package/package.json +1 -1
  100. package/src/consent/sdkUserConsent.ts +1 -1
  101. package/src/listeners/browser.ts +3 -2
  102. package/src/logger/constants.ts +1 -0
  103. package/src/logger/messages/error.ts +2 -1
  104. package/src/logger/messages/info.ts +3 -3
  105. package/src/logger/messages/warn.ts +2 -2
  106. package/src/sdkClient/client.ts +23 -4
  107. package/src/sdkClient/sdkClient.ts +4 -1
  108. package/src/sdkFactory/index.ts +22 -24
  109. package/src/sdkFactory/types.ts +32 -15
  110. package/src/services/splitApi.ts +17 -14
  111. package/src/services/splitHttpClient.ts +6 -3
  112. package/src/services/types.ts +7 -5
  113. package/src/storages/AbstractSegmentsCacheSync.ts +8 -3
  114. package/src/storages/KeyBuilderSS.ts +13 -50
  115. package/src/storages/findLatencyIndex.ts +12 -3
  116. package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +13 -1
  117. package/src/storages/inLocalStorage/index.ts +5 -2
  118. package/src/storages/inMemory/InMemoryStorage.ts +3 -1
  119. package/src/storages/inMemory/InMemoryStorageCS.ts +4 -1
  120. package/src/storages/inMemory/MySegmentsCacheInMemory.ts +8 -0
  121. package/src/storages/inMemory/SegmentsCacheInMemory.ts +6 -0
  122. package/src/storages/inMemory/TelemetryCacheInMemory.ts +210 -0
  123. package/src/storages/inRedis/TelemetryCacheInRedis.ts +29 -0
  124. package/src/storages/inRedis/index.ts +2 -4
  125. package/src/storages/pluggable/TelemetryCachePluggable.ts +26 -0
  126. package/src/storages/pluggable/index.ts +2 -1
  127. package/src/storages/types.ts +84 -32
  128. package/src/sync/offline/syncManagerOffline.ts +4 -3
  129. package/src/sync/polling/pollingManagerCS.ts +3 -3
  130. package/src/sync/polling/pollingManagerSS.ts +2 -2
  131. package/src/sync/polling/syncTasks/splitsSyncTask.ts +2 -0
  132. package/src/sync/polling/updaters/mySegmentsUpdater.ts +0 -4
  133. package/src/sync/polling/updaters/segmentChangesUpdater.ts +2 -10
  134. package/src/sync/polling/updaters/splitChangesUpdater.ts +3 -6
  135. package/src/sync/streaming/SSEHandler/NotificationKeeper.ts +11 -1
  136. package/src/sync/streaming/SSEHandler/index.ts +21 -14
  137. package/src/sync/streaming/pushManager.ts +11 -7
  138. package/src/sync/submitters/eventsSubmitter.ts +35 -0
  139. package/src/sync/submitters/{impressionCountsSyncTask.ts → impressionCountsSubmitter.ts} +15 -15
  140. package/src/sync/submitters/{impressionsSyncTask.ts → impressionsSubmitter.ts} +12 -16
  141. package/src/sync/submitters/{submitterSyncTask.ts → submitter.ts} +34 -16
  142. package/src/sync/submitters/submitterManager.ts +14 -11
  143. package/src/sync/submitters/telemetrySubmitter.ts +143 -0
  144. package/src/sync/submitters/types.ts +123 -0
  145. package/src/sync/syncManagerOnline.ts +13 -7
  146. package/src/sync/types.ts +0 -15
  147. package/src/trackers/eventTracker.ts +7 -3
  148. package/src/trackers/impressionsTracker.ts +11 -3
  149. package/src/trackers/telemetryTracker.ts +63 -0
  150. package/src/trackers/types.ts +24 -0
  151. package/src/types.ts +35 -6
  152. package/src/utils/constants/index.ts +45 -0
  153. package/src/utils/inputValidation/apiKey.ts +2 -1
  154. package/src/utils/settingsValidation/index.ts +35 -11
  155. package/src/utils/settingsValidation/url.ts +4 -0
  156. package/src/utils/timeTracker/index.ts +1 -1
  157. package/src/utils/timeTracker/timer.ts +3 -3
  158. package/types/logger/constants.d.ts +1 -0
  159. package/types/sdkFactory/types.d.ts +29 -14
  160. package/types/services/splitApi.d.ts +2 -1
  161. package/types/services/types.d.ts +8 -5
  162. package/types/storages/AbstractSegmentsCacheSync.d.ts +7 -3
  163. package/types/storages/KeyBuilderSS.d.ts +3 -3
  164. package/types/storages/findLatencyIndex.d.ts +7 -1
  165. package/types/storages/inLocalStorage/MySegmentsCacheInLocal.d.ts +2 -0
  166. package/types/storages/inMemory/MySegmentsCacheInMemory.d.ts +2 -0
  167. package/types/storages/inMemory/SegmentsCacheInMemory.d.ts +1 -0
  168. package/types/storages/inMemory/TelemetryCacheInMemory.d.ts +6 -2
  169. package/types/storages/inRedis/TelemetryCacheInRedis.d.ts +3 -3
  170. package/types/storages/pluggable/TelemetryCachePluggable.d.ts +2 -2
  171. package/types/storages/types.d.ts +71 -22
  172. package/types/sync/offline/syncManagerOffline.d.ts +3 -2
  173. package/types/sync/polling/pollingManagerCS.d.ts +2 -2
  174. package/types/sync/polling/pollingManagerSS.d.ts +2 -2
  175. package/types/sync/polling/syncTasks/splitsSyncTask.d.ts +1 -1
  176. package/types/sync/polling/updaters/splitChangesUpdater.d.ts +1 -1
  177. package/types/sync/streaming/SSEHandler/NotificationKeeper.d.ts +2 -1
  178. package/types/sync/streaming/SSEHandler/index.d.ts +2 -1
  179. package/types/sync/streaming/pushManager.d.ts +2 -2
  180. package/types/sync/submitters/eventsSubmitter.d.ts +5 -0
  181. package/types/sync/submitters/impressionCountsSubmitter.d.ts +10 -0
  182. package/types/sync/submitters/impressionsSubmitter.d.ts +11 -0
  183. package/types/sync/submitters/submitter.d.ts +12 -0
  184. package/types/sync/submitters/submitterManager.d.ts +2 -2
  185. package/types/sync/submitters/telemetrySubmitter.d.ts +24 -0
  186. package/types/sync/submitters/telemetrySyncTask.d.ts +0 -27
  187. package/types/sync/submitters/types.d.ts +107 -0
  188. package/types/sync/syncManagerOnline.d.ts +3 -2
  189. package/types/sync/types.d.ts +0 -13
  190. package/types/trackers/eventTracker.d.ts +2 -2
  191. package/types/trackers/impressionsTracker.d.ts +2 -2
  192. package/types/trackers/telemetryTracker.d.ts +2 -3
  193. package/types/trackers/types.d.ts +22 -0
  194. package/types/types.d.ts +33 -4
  195. package/types/utils/constants/index.d.ts +37 -0
  196. package/types/utils/inputValidation/apiKey.d.ts +1 -0
  197. package/types/utils/settingsValidation/index.d.ts +40 -0
  198. package/types/utils/timeTracker/index.d.ts +1 -1
  199. package/types/utils/timeTracker/timer.d.ts +1 -1
  200. package/cjs/storages/inMemory/CountsCacheInMemory.js +0 -38
  201. package/cjs/storages/inMemory/LatenciesCacheInMemory.js +0 -43
  202. package/cjs/storages/inRedis/CountsCacheInRedis.js +0 -16
  203. package/cjs/storages/inRedis/LatenciesCacheInRedis.js +0 -18
  204. package/cjs/sync/submitters/eventsSyncTask.js +0 -44
  205. package/cjs/sync/submitters/metricsSyncTask.js +0 -31
  206. package/cjs/sync/submitters/submitterSyncTask.js +0 -44
  207. package/esm/storages/inMemory/CountsCacheInMemory.js +0 -35
  208. package/esm/storages/inMemory/LatenciesCacheInMemory.js +0 -40
  209. package/esm/storages/inRedis/CountsCacheInRedis.js +0 -13
  210. package/esm/storages/inRedis/LatenciesCacheInRedis.js +0 -15
  211. package/esm/sync/submitters/eventsSyncTask.js +0 -40
  212. package/esm/sync/submitters/metricsSyncTask.js +0 -26
  213. package/esm/sync/submitters/submitterSyncTask.js +0 -40
  214. package/src/storages/inMemory/CountsCacheInMemory.ts +0 -37
  215. package/src/storages/inMemory/LatenciesCacheInMemory.ts +0 -45
  216. package/src/storages/inRedis/CountsCacheInRedis.ts +0 -20
  217. package/src/storages/inRedis/LatenciesCacheInRedis.ts +0 -23
  218. package/src/sync/submitters/eventsSyncTask.ts +0 -57
  219. package/src/sync/submitters/metricsSyncTask.ts +0 -49
@@ -1,7 +1,7 @@
1
- export function timer(now?: () => number) {
2
- const st = now ? now() : Date.now();
1
+ export function timer(now: () => number) {
2
+ const st = now();
3
3
 
4
4
  return function stop() {
5
- return Math.round(now ? now() : Date.now() - st);
5
+ return Math.round(now() - st);
6
6
  };
7
7
  }
@@ -120,6 +120,7 @@ export declare const ERROR_HTTP = 322;
120
120
  export declare const ERROR_LOCALHOST_MODULE_REQUIRED = 323;
121
121
  export declare const ERROR_STORAGE_INVALID = 324;
122
122
  export declare const ERROR_NOT_BOOLEAN = 325;
123
+ export declare const ERROR_MIN_CONFIG_PARAM = 326;
123
124
  export declare const LOG_PREFIX_SETTINGS = "settings";
124
125
  export declare const LOG_PREFIX_INSTANTIATION = "Factory instantiation";
125
126
  export declare const LOG_PREFIX_ENGINE = "engine";
@@ -1,22 +1,13 @@
1
1
  import { IIntegrationManager, IIntegrationFactoryParams } from '../integrations/types';
2
2
  import { ISignalListener } from '../listeners/types';
3
3
  import { ILogger } from '../logger/types';
4
- import { ISdkReadinessManager } from '../readiness/types';
4
+ import { IReadinessManager, ISdkReadinessManager } from '../readiness/types';
5
5
  import { IFetch, ISplitApi, IEventSourceConstructor } from '../services/types';
6
6
  import { IStorageAsync, IStorageSync, ISplitsCacheSync, ISplitsCacheAsync, IStorageFactoryParams } from '../storages/types';
7
- import { ISyncManager, ISyncManagerFactoryParams } from '../sync/types';
7
+ import { ISyncManager } from '../sync/types';
8
8
  import { IImpressionObserver } from '../trackers/impressionObserver/types';
9
- import { IImpressionsTracker, IEventTracker } from '../trackers/types';
9
+ import { IImpressionsTracker, IEventTracker, ITelemetryTracker } from '../trackers/types';
10
10
  import { SplitIO, ISettings, IEventEmitter } from '../types';
11
- export interface ISdkFactoryContext {
12
- storage: IStorageSync | IStorageAsync;
13
- sdkReadinessManager: ISdkReadinessManager;
14
- settings: ISettings;
15
- impressionsTracker: IImpressionsTracker;
16
- eventTracker: IEventTracker;
17
- signalListener?: ISignalListener;
18
- syncManager?: ISyncManager;
19
- }
20
11
  /**
21
12
  * Environment related dependencies.
22
13
  * These getters are called a fixed number of times per factory instantiation.
@@ -26,6 +17,30 @@ export interface IPlatform {
26
17
  getFetch?: () => (IFetch | undefined);
27
18
  getEventSource?: () => (IEventSourceConstructor | undefined);
28
19
  EventEmitter: new () => IEventEmitter;
20
+ now?: () => number;
21
+ }
22
+ export interface ISdkFactoryContext {
23
+ platform: IPlatform;
24
+ sdkReadinessManager: ISdkReadinessManager;
25
+ readiness: IReadinessManager;
26
+ settings: ISettings;
27
+ impressionsTracker: IImpressionsTracker;
28
+ eventTracker: IEventTracker;
29
+ telemetryTracker: ITelemetryTracker;
30
+ storage: IStorageSync | IStorageAsync;
31
+ signalListener?: ISignalListener;
32
+ splitApi?: ISplitApi;
33
+ syncManager?: ISyncManager;
34
+ }
35
+ export interface ISdkFactoryContextSync extends ISdkFactoryContext {
36
+ storage: IStorageSync;
37
+ splitApi: ISplitApi;
38
+ syncManager: ISyncManager;
39
+ }
40
+ export interface ISdkFactoryContextAsync extends ISdkFactoryContext {
41
+ storage: IStorageAsync;
42
+ splitApi: undefined;
43
+ syncManager: undefined;
29
44
  }
30
45
  /**
31
46
  * Object parameter with the modules required to create an SDK factory instance
@@ -34,8 +49,8 @@ export interface ISdkFactoryParams {
34
49
  settings: ISettings;
35
50
  platform: IPlatform;
36
51
  storageFactory: (params: IStorageFactoryParams) => IStorageSync | IStorageAsync;
37
- splitApiFactory?: (settings: ISettings, platform: IPlatform) => ISplitApi;
38
- syncManagerFactory?: (params: ISyncManagerFactoryParams) => ISyncManager;
52
+ splitApiFactory?: (settings: ISettings, platform: IPlatform, telemetryTracker: ITelemetryTracker) => ISplitApi;
53
+ syncManagerFactory?: (params: ISdkFactoryContextSync) => ISyncManager;
39
54
  sdkManagerFactory: (log: ILogger, splits: ISplitsCacheSync | ISplitsCacheAsync, sdkReadinessManager: ISdkReadinessManager) => SplitIO.IManager | SplitIO.IAsyncManager;
40
55
  sdkClientMethodFactory: (params: ISdkFactoryContext) => ({
41
56
  (): SplitIO.ICsClient;
@@ -1,10 +1,11 @@
1
1
  import { IPlatform } from '../sdkFactory/types';
2
2
  import { ISettings } from '../types';
3
3
  import { ISplitApi } from './types';
4
+ import { ITelemetryTracker } from '../trackers/types';
4
5
  /**
5
6
  * Factory of SplitApi objects, which group the collection of Split HTTP endpoints used by the SDK
6
7
  *
7
8
  * @param settings validated settings object
8
9
  * @param platform object containing environment-specific `getFetch` and `getOptions` dependencies
9
10
  */
10
- export declare function splitApiFactory(settings: Pick<ISettings, 'urls' | 'sync' | 'log' | 'version' | 'runtime' | 'core'>, platform: Pick<IPlatform, 'getFetch' | 'getOptions'>): ISplitApi;
11
+ export declare function splitApiFactory(settings: Pick<ISettings, 'urls' | 'sync' | 'log' | 'version' | 'runtime' | 'core'>, platform: Pick<IPlatform, 'getFetch' | 'getOptions'>, telemetryTracker: ITelemetryTracker): ISplitApi;
@@ -9,9 +9,12 @@ export declare type IResponse = {
9
9
  json: () => Promise<any>;
10
10
  text: () => Promise<string>;
11
11
  };
12
+ export declare type NetworkError = Error & {
13
+ statusCode?: number;
14
+ };
12
15
  export declare type IFetch = (url: string, options?: IRequestOptions) => Promise<IResponse>;
13
16
  export declare type IHealthCheckAPI = () => Promise<boolean>;
14
- export declare type ISplitHttpClient = (url: string, options?: IRequestOptions, logErrorsAsInfo?: boolean) => Promise<IResponse>;
17
+ export declare type ISplitHttpClient = (url: string, options?: IRequestOptions, latencyTracker?: (error?: NetworkError) => void, logErrorsAsInfo?: boolean) => Promise<IResponse>;
15
18
  export declare type IFetchAuth = (userKeys?: string[]) => Promise<IResponse>;
16
19
  export declare type IFetchSplitChanges = (since: number, noCache?: boolean) => Promise<IResponse>;
17
20
  export declare type IFetchSegmentChanges = (since: number, segmentName: string, noCache?: boolean) => Promise<IResponse>;
@@ -19,8 +22,8 @@ export declare type IFetchMySegments = (userMatchingKey: string, noCache?: boole
19
22
  export declare type IPostEventsBulk = (body: string, headers?: Record<string, string>) => Promise<IResponse>;
20
23
  export declare type IPostTestImpressionsBulk = (body: string, headers?: Record<string, string>) => Promise<IResponse>;
21
24
  export declare type IPostTestImpressionsCount = (body: string, headers?: Record<string, string>) => Promise<IResponse>;
22
- export declare type IPostMetricsCounters = (body: string) => Promise<IResponse>;
23
- export declare type IPostMetricsTimes = (body: string) => Promise<IResponse>;
25
+ export declare type IPostMetricsConfig = (body: string) => Promise<IResponse>;
26
+ export declare type IPostMetricsUsage = (body: string) => Promise<IResponse>;
24
27
  export interface ISplitApi {
25
28
  getSdkAPIHealthCheck: IHealthCheckAPI;
26
29
  getEventsAPIHealthCheck: IHealthCheckAPI;
@@ -31,8 +34,8 @@ export interface ISplitApi {
31
34
  postEventsBulk: IPostEventsBulk;
32
35
  postTestImpressionsBulk: IPostTestImpressionsBulk;
33
36
  postTestImpressionsCount: IPostTestImpressionsCount;
34
- postMetricsCounters: IPostMetricsCounters;
35
- postMetricsTimes: IPostMetricsTimes;
37
+ postMetricsConfig: IPostMetricsConfig;
38
+ postMetricsUsage: IPostMetricsUsage;
36
39
  }
37
40
  interface EventSourceEventMap {
38
41
  'error': Event;
@@ -29,10 +29,14 @@ export declare abstract class AbstractSegmentsCacheSync implements ISegmentsCach
29
29
  */
30
30
  registerSegments(names: string[]): boolean;
31
31
  /**
32
- * For server-side synchronizer: get the list of segments in the cache.
33
- * For client-side synchronizer: the method is not used.
32
+ * For server-side synchronizer: get the list of segments to fetch changes.
33
+ * Also used for the `seC` (segment count) telemetry stat.
34
+ */
35
+ abstract getRegisteredSegments(): string[];
36
+ /**
37
+ * Only used for the `skC`(segment keys count) telemetry stat: 1 for client-side, and total count of keys in server-side.
34
38
  */
35
- getRegisteredSegments(): string[];
39
+ abstract getKeysCount(): number;
36
40
  /**
37
41
  * For server-side synchronizer: set the change number of `name` segment.
38
42
  * For client-side synchronizer: the method is not used.
@@ -1,5 +1,6 @@
1
1
  import { KeyBuilder } from './KeyBuilder';
2
2
  import { IMetadata } from '../dtos/types';
3
+ import { Method } from '../sync/submitters/types';
3
4
  export declare class KeyBuilderSS extends KeyBuilder {
4
5
  protected readonly metadata: IMetadata;
5
6
  constructor(prefix: string, metadata: IMetadata);
@@ -7,8 +8,7 @@ export declare class KeyBuilderSS extends KeyBuilder {
7
8
  private buildVersionablePrefix;
8
9
  buildImpressionsKey(): string;
9
10
  buildEventsKey(): string;
10
- private buildLatencyKeyPrefix;
11
- buildLatencyKey(metricName: string, bucketNumber: number | string): string;
12
- buildCountKey(metricName: string): string;
11
+ buildLatencyKey(method: Method, bucket: number): string;
12
+ buildExceptionKey(method: Method): string;
13
13
  searchPatternForSplitKeys(): string;
14
14
  }
@@ -1 +1,7 @@
1
- export declare function findLatencyIndex(latency: number, min?: number, max?: number, base?: number): number;
1
+ /**
2
+ * Calculates buckets from latency in milliseconds
3
+ *
4
+ * @param latencyInMs
5
+ * @returns a bucket index from 0 to 22 inclusive
6
+ */
7
+ export declare function findLatencyIndex(latencyInMs: number): number;
@@ -20,4 +20,6 @@ export declare class MySegmentsCacheInLocal extends AbstractSegmentsCacheSync {
20
20
  * @returns boolean indicating if the cache was updated (i.e., given list was different from the cached one)
21
21
  */
22
22
  resetSegments(names: string[]): boolean;
23
+ getRegisteredSegments(): string[];
24
+ getKeysCount(): number;
23
25
  }
@@ -17,4 +17,6 @@ export declare class MySegmentsCacheInMemory extends AbstractSegmentsCacheSync {
17
17
  * @returns boolean indicating if the cache was updated (i.e., given list was different from the cached one)
18
18
  */
19
19
  resetSegments(names: string[]): boolean;
20
+ getRegisteredSegments(): string[];
21
+ getKeysCount(): number;
20
22
  }
@@ -13,6 +13,7 @@ export declare class SegmentsCacheInMemory extends AbstractSegmentsCacheSync {
13
13
  private _registerSegment;
14
14
  registerSegments(names: string[]): boolean;
15
15
  getRegisteredSegments(): string[];
16
+ getKeysCount(): number;
16
17
  setChangeNumber(name: string, changeNumber: number): boolean;
17
18
  getChangeNumber(name: string): number;
18
19
  }
@@ -1,6 +1,10 @@
1
1
  import { ImpressionDataType, EventDataType, LastSync, HttpErrors, HttpLatencies, StreamingEvent, Method, OperationType, MethodExceptions, MethodLatencies } from '../../sync/submitters/types';
2
- import { TelemetryCacheSync } from '../types';
3
- export declare class TelemetryCacheInMemory implements TelemetryCacheSync {
2
+ import { ITelemetryCacheSync } from '../types';
3
+ /**
4
+ * Used on client-side. 0.1% of instances will track telemetry
5
+ */
6
+ export declare function shouldRecordTelemetry(): boolean;
7
+ export declare class TelemetryCacheInMemory implements ITelemetryCacheSync {
4
8
  private timeUntilReady?;
5
9
  getTimeUntilReady(): number | undefined;
6
10
  recordTimeUntilReady(ms: number): void;
@@ -1,14 +1,14 @@
1
1
  import { ILogger } from '../../logger/types';
2
2
  import { Method } from '../../sync/submitters/types';
3
3
  import { KeyBuilderSS } from '../KeyBuilderSS';
4
- import { TelemetryCacheAsync } from '../types';
4
+ import { ITelemetryCacheAsync } from '../types';
5
5
  import { Redis } from 'ioredis';
6
- export declare class TelemetryCacheInRedis implements TelemetryCacheAsync {
6
+ export declare class TelemetryCacheInRedis implements ITelemetryCacheAsync {
7
7
  private readonly log;
8
8
  private readonly keys;
9
9
  private readonly redis;
10
10
  /**
11
- * Create a Telemetry cache that uses a storage wrapper.
11
+ * Create a Telemetry cache that uses Redis as storage.
12
12
  * @param log Logger instance.
13
13
  * @param keys Key builder.
14
14
  * @param redis Redis client.
@@ -1,8 +1,8 @@
1
1
  import { ILogger } from '../../logger/types';
2
2
  import { Method } from '../../sync/submitters/types';
3
3
  import { KeyBuilderSS } from '../KeyBuilderSS';
4
- import { IPluggableStorageWrapper, TelemetryCacheAsync } from '../types';
5
- export declare class TelemetryCachePluggable implements TelemetryCacheAsync {
4
+ import { IPluggableStorageWrapper, ITelemetryCacheAsync } from '../types';
5
+ export declare class TelemetryCachePluggable implements ITelemetryCacheAsync {
6
6
  private readonly log;
7
7
  private readonly keys;
8
8
  private readonly wrapper;
@@ -1,6 +1,6 @@
1
1
  import { MaybeThenable, IMetadata, ISplitFiltersValidation } from '../dtos/types';
2
2
  import { ILogger } from '../logger/types';
3
- import { StoredEventWithMetadata, StoredImpressionWithMetadata } from '../sync/submitters/types';
3
+ import { EventDataType, HttpErrors, HttpLatencies, ImpressionDataType, LastSync, Method, MethodExceptions, MethodLatencies, OperationType, StoredEventWithMetadata, StoredImpressionWithMetadata, StreamingEvent } from '../sync/submitters/types';
4
4
  import { SplitIO, ImpressionDTO, SDKMode } from '../types';
5
5
  /**
6
6
  * Interface of a pluggable storage wrapper.
@@ -239,6 +239,7 @@ export interface ISegmentsCacheSync extends ISegmentsCacheBase {
239
239
  isInSegment(name: string, key?: string): boolean;
240
240
  registerSegments(names: string[]): boolean;
241
241
  getRegisteredSegments(): string[];
242
+ getKeysCount(): number;
242
243
  setChangeNumber(name: string, changeNumber: number): boolean;
243
244
  getChangeNumber(name: string): number;
244
245
  resetSegments(names: string[]): boolean;
@@ -297,41 +298,89 @@ export interface IImpressionCountsCacheSync extends IRecorderCacheProducerSync<R
297
298
  clear(): void;
298
299
  state(): Record<string, number>;
299
300
  }
300
- /** Latencies and metric counts cache */
301
- export interface ILatenciesCacheSync extends IRecorderCacheProducerSync<Record<string, number[]>> {
302
- track(metricName: string, latency: number): boolean;
303
- isEmpty(): boolean;
304
- clear(): void;
305
- state(): Record<string, number[]>;
301
+ /**
302
+ * Telemetry storage interface for standalone and partial consumer modes.
303
+ * Methods are sync because data is stored in memory.
304
+ */
305
+ export interface ITelemetryInitConsumerSync {
306
+ getTimeUntilReady(): number | undefined;
307
+ getTimeUntilReadyFromCache(): number | undefined;
308
+ getNonReadyUsage(): number;
306
309
  }
307
- export interface ILatenciesCacheAsync {
308
- track(metricName: string, latency: number): Promise<boolean>;
310
+ export interface ITelemetryRuntimeConsumerSync {
311
+ getImpressionStats(type: ImpressionDataType): number;
312
+ getEventStats(type: EventDataType): number;
313
+ getLastSynchronization(): LastSync;
314
+ popHttpErrors(): HttpErrors;
315
+ popHttpLatencies(): HttpLatencies;
316
+ popAuthRejections(): number;
317
+ popTokenRefreshes(): number;
318
+ popStreamingEvents(): Array<StreamingEvent>;
319
+ popTags(): Array<string> | undefined;
320
+ getSessionLength(): number | undefined;
309
321
  }
310
- export interface ICountsCacheSync extends IRecorderCacheProducerSync<Record<string, number>> {
311
- track(metricName: string): boolean;
312
- isEmpty(): boolean;
313
- clear(): void;
314
- state(): Record<string, number>;
322
+ export interface ITelemetryEvaluationConsumerSync {
323
+ popExceptions(): MethodExceptions;
324
+ popLatencies(): MethodLatencies;
325
+ }
326
+ export interface ITelemetryStorageConsumerSync extends ITelemetryInitConsumerSync, ITelemetryRuntimeConsumerSync, ITelemetryEvaluationConsumerSync {
327
+ }
328
+ export interface ITelemetryInitProducerSync {
329
+ recordTimeUntilReady(ms: number): void;
330
+ recordTimeUntilReadyFromCache(ms: number): void;
331
+ recordNonReadyUsage(): void;
332
+ }
333
+ export interface ITelemetryRuntimeProducerSync {
334
+ addTag(tag: string): void;
335
+ recordImpressionStats(type: ImpressionDataType, count: number): void;
336
+ recordEventStats(type: EventDataType, count: number): void;
337
+ recordSuccessfulSync(resource: OperationType, timeMs: number): void;
338
+ recordHttpError(resource: OperationType, status: number): void;
339
+ recordHttpLatency(resource: OperationType, latencyMs: number): void;
340
+ recordAuthRejections(): void;
341
+ recordTokenRefreshes(): void;
342
+ recordStreamingEvents(streamingEvent: StreamingEvent): void;
343
+ recordSessionLength(ms: number): void;
315
344
  }
316
- export interface ICountsCacheAsync {
317
- track(metricName: string): Promise<boolean>;
345
+ export interface ITelemetryEvaluationProducerSync {
346
+ recordLatency(method: Method, latencyMs: number): void;
347
+ recordException(method: Method): void;
348
+ }
349
+ export interface ITelemetryStorageProducerSync extends ITelemetryInitProducerSync, ITelemetryRuntimeProducerSync, ITelemetryEvaluationProducerSync {
350
+ }
351
+ export interface ITelemetryCacheSync extends ITelemetryStorageConsumerSync, ITelemetryStorageProducerSync {
352
+ }
353
+ /**
354
+ * Telemetry storage interface for consumer mode.
355
+ * Methods are async because data is stored in Redis or a pluggable storage.
356
+ */
357
+ export interface ITelemetryEvaluationConsumerAsync {
358
+ popExceptions(): Promise<MethodExceptions>;
359
+ popLatencies(): Promise<MethodLatencies>;
360
+ }
361
+ export interface ITelemetryEvaluationProducerAsync {
362
+ recordLatency(method: Method, latencyMs: number): Promise<any>;
363
+ recordException(method: Method): Promise<any>;
364
+ }
365
+ export interface ITelemetryCacheAsync extends ITelemetryEvaluationProducerAsync {
318
366
  }
319
367
  /**
320
368
  * Storages
321
369
  */
322
- export interface IStorageBase<TSplitsCache extends ISplitsCacheBase, TSegmentsCache extends ISegmentsCacheBase, TImpressionsCache extends IImpressionsCacheBase, TEventsCache extends IEventsCacheBase, TLatenciesCache extends ILatenciesCacheSync | ILatenciesCacheAsync, TCountsCache extends ICountsCacheSync | ICountsCacheAsync> {
370
+ export interface IStorageBase<TSplitsCache extends ISplitsCacheBase, TSegmentsCache extends ISegmentsCacheBase, TImpressionsCache extends IImpressionsCacheBase, TEventsCache extends IEventsCacheBase, TTelemetryCache extends ITelemetryCacheSync | ITelemetryCacheAsync> {
323
371
  splits: TSplitsCache;
324
372
  segments: TSegmentsCache;
325
373
  impressions: TImpressionsCache;
326
374
  impressionCounts?: IImpressionCountsCacheSync;
327
375
  events: TEventsCache;
328
- latencies?: TLatenciesCache;
329
- counts?: TCountsCache;
376
+ telemetry?: TTelemetryCache;
330
377
  destroy(): void | Promise<void>;
331
378
  shared?: (matchingKey: string, onReadyCb: (error?: any) => void) => this;
332
379
  }
333
- export declare type IStorageSync = IStorageBase<ISplitsCacheSync, ISegmentsCacheSync, IImpressionsCacheSync, IEventsCacheSync, ILatenciesCacheSync, ICountsCacheSync>;
334
- export declare type IStorageAsync = IStorageBase<ISplitsCacheAsync, ISegmentsCacheAsync, IImpressionsCacheAsync | IImpressionsCacheSync, IEventsCacheAsync | IEventsCacheSync, ILatenciesCacheAsync, ICountsCacheAsync>;
380
+ export interface IStorageSync extends IStorageBase<ISplitsCacheSync, ISegmentsCacheSync, IImpressionsCacheSync, IEventsCacheSync, ITelemetryCacheSync> {
381
+ }
382
+ export interface IStorageAsync extends IStorageBase<ISplitsCacheAsync, ISegmentsCacheAsync, IImpressionsCacheAsync | IImpressionsCacheSync, IEventsCacheAsync | IEventsCacheSync, ITelemetryCacheAsync> {
383
+ }
335
384
  /** StorageFactory */
336
385
  export declare type DataLoader = (storage: IStorageSync, matchingKey: string) => void;
337
386
  export interface IStorageFactoryParams {
@@ -339,9 +388,9 @@ export interface IStorageFactoryParams {
339
388
  impressionsQueueSize?: number;
340
389
  eventsQueueSize?: number;
341
390
  optimize?: boolean;
391
+ mode: SDKMode;
342
392
  matchingKey?: string;
343
393
  splitFiltersValidation?: ISplitFiltersValidation;
344
- mode?: SDKMode;
345
394
  onReadyCb: (error?: any) => void;
346
395
  metadata: IMetadata;
347
396
  }
@@ -1,9 +1,10 @@
1
- import { ISyncManagerCS, ISyncManagerFactoryParams } from '../types';
1
+ import { ISyncManagerCS } from '../types';
2
2
  import { ISplitsParser } from './splitsParser/types';
3
+ import { ISdkFactoryContextSync } from '../../sdkFactory/types';
3
4
  /**
4
5
  * Offline SyncManager factory.
5
6
  * Can be used for server-side API, and client-side API with or without multiple clients.
6
7
  *
7
8
  * @param splitsParser e.g., `splitsParserFromFile`, `splitsParserFromSettings`.
8
9
  */
9
- export declare function syncManagerOfflineFactory(splitsParserFactory: () => ISplitsParser): (params: ISyncManagerFactoryParams) => ISyncManagerCS;
10
+ export declare function syncManagerOfflineFactory(splitsParserFactory: () => ISplitsParser): (params: ISdkFactoryContextSync) => ISyncManagerCS;
@@ -1,7 +1,7 @@
1
1
  import { IPollingManagerCS } from './types';
2
- import { ISyncManagerFactoryParams } from '../types';
2
+ import { ISdkFactoryContextSync } from '../../sdkFactory/types';
3
3
  /**
4
4
  * Expose start / stop mechanism for polling data from services.
5
5
  * For client-side API with multiple clients.
6
6
  */
7
- export declare function pollingManagerCSFactory(params: ISyncManagerFactoryParams): IPollingManagerCS;
7
+ export declare function pollingManagerCSFactory(params: ISdkFactoryContextSync): IPollingManagerCS;
@@ -1,6 +1,6 @@
1
1
  import { IPollingManager } from './types';
2
- import { ISyncManagerFactoryParams } from '../types';
2
+ import { ISdkFactoryContextSync } from '../../sdkFactory/types';
3
3
  /**
4
4
  * Expose start / stop mechanism for pulling data from services.
5
5
  */
6
- export declare function pollingManagerSSFactory(params: ISyncManagerFactoryParams): IPollingManager;
6
+ export declare function pollingManagerSSFactory(params: ISdkFactoryContextSync): IPollingManager;
@@ -6,4 +6,4 @@ import { ISettings } from '../../../types';
6
6
  /**
7
7
  * Creates a sync task that periodically executes a `splitChangesUpdater` task
8
8
  */
9
- export declare function splitsSyncTaskFactory(fetchSplitChanges: IFetchSplitChanges, storage: IStorageSync, readiness: IReadinessManager, settings: ISettings): ISplitsSyncTask;
9
+ export declare function splitsSyncTaskFactory(fetchSplitChanges: IFetchSplitChanges, storage: IStorageSync, readiness: IReadinessManager, settings: ISettings, isClientSide?: boolean): ISplitsSyncTask;
@@ -35,5 +35,5 @@ export declare function computeSplitsMutation(entries: ISplit[]): ISplitMutation
35
35
  * @param requestTimeoutBeforeReady How long the updater will wait for the request to timeout. Default 0, i.e., never timeout.
36
36
  * @param retriesOnFailureBeforeReady How many retries on `/splitChanges` we the updater do in case of failure or timeout. Default 0, i.e., no retries.
37
37
  */
38
- export declare function splitChangesUpdaterFactory(log: ILogger, splitChangesFetcher: ISplitChangesFetcher, splits: ISplitsCacheBase, segments: ISegmentsCacheBase, splitsEventEmitter?: ISplitsEventEmitter, requestTimeoutBeforeReady?: number, retriesOnFailureBeforeReady?: number): ISplitChangesUpdater;
38
+ export declare function splitChangesUpdaterFactory(log: ILogger, splitChangesFetcher: ISplitChangesFetcher, splits: ISplitsCacheBase, segments: ISegmentsCacheBase, splitsEventEmitter?: ISplitsEventEmitter, requestTimeoutBeforeReady?: number, retriesOnFailureBeforeReady?: number, isClientSide?: boolean): ISplitChangesUpdater;
39
39
  export {};
@@ -1,3 +1,4 @@
1
+ import { ITelemetryTracker } from '../../../trackers/types';
1
2
  import { ControlType } from '../constants';
2
3
  import { IPushEventEmitter } from '../types';
3
4
  /**
@@ -5,7 +6,7 @@ import { IPushEventEmitter } from '../types';
5
6
  *
6
7
  * @param pushEmitter emitter for events related to streaming support
7
8
  */
8
- export declare function notificationKeeperFactory(pushEmitter: IPushEventEmitter): {
9
+ export declare function notificationKeeperFactory(pushEmitter: IPushEventEmitter, telemetryTracker: ITelemetryTracker): {
9
10
  handleOpen(): void;
10
11
  isStreamingUp(): boolean;
11
12
  handleOccupancyEvent(publishers: number, channel: string, timestamp: number): void;
@@ -1,10 +1,11 @@
1
1
  import { IPushEventEmitter } from '../types';
2
2
  import { ISseEventHandler } from '../SSEClient/types';
3
3
  import { ILogger } from '../../../logger/types';
4
+ import { ITelemetryTracker } from '../../../trackers/types';
4
5
  /**
5
6
  * Factory for SSEHandler, which processes SSEClient messages and emits the corresponding push events.
6
7
  *
7
8
  * @param log factory logger
8
9
  * @param pushEmitter emitter for events related to streaming support
9
10
  */
10
- export declare function SSEHandlerFactory(log: ILogger, pushEmitter: IPushEventEmitter): ISseEventHandler;
11
+ export declare function SSEHandlerFactory(log: ILogger, pushEmitter: IPushEventEmitter, telemetryTracker: ITelemetryTracker): ISseEventHandler;
@@ -1,9 +1,9 @@
1
1
  import { IPushManager } from './types';
2
2
  import { IPollingManager } from '../polling/types';
3
- import { ISyncManagerFactoryParams } from '../types';
3
+ import { ISdkFactoryContextSync } from '../../sdkFactory/types';
4
4
  /**
5
5
  * PushManager factory:
6
6
  * - for server-side if key is not provided in settings.
7
7
  * - for client-side, with support for multiple clients, if key is provided in settings
8
8
  */
9
- export declare function pushManagerFactory(params: ISyncManagerFactoryParams, pollingManager: IPollingManager): IPushManager | undefined;
9
+ export declare function pushManagerFactory(params: ISdkFactoryContextSync, pollingManager: IPollingManager): IPushManager | undefined;
@@ -0,0 +1,5 @@
1
+ import { ISdkFactoryContextSync } from '../../sdkFactory/types';
2
+ /**
3
+ * Submitter that periodically posts tracked events
4
+ */
5
+ export declare function eventsSubmitterFactory(params: ISdkFactoryContextSync): import("../types").ISyncTask<[], void>;
@@ -0,0 +1,10 @@
1
+ import { ISdkFactoryContextSync } from '../../sdkFactory/types';
2
+ import { ImpressionCountsPayload } from './types';
3
+ /**
4
+ * Converts `impressionCounts` data from cache into request payload.
5
+ */
6
+ export declare function fromImpressionCountsCollector(impressionsCount: Record<string, number>): ImpressionCountsPayload;
7
+ /**
8
+ * Submitter that periodically posts impression counts
9
+ */
10
+ export declare function impressionCountsSubmitterFactory(params: ISdkFactoryContextSync): import("../types").ISyncTask<[], void> | undefined;
@@ -0,0 +1,11 @@
1
+ import { ImpressionDTO } from '../../types';
2
+ import { ImpressionsPayload } from './types';
3
+ import { ISdkFactoryContextSync } from '../../sdkFactory/types';
4
+ /**
5
+ * Converts `impressions` data from cache into request payload.
6
+ */
7
+ export declare function fromImpressionsCollector(sendLabels: boolean, data: ImpressionDTO[]): ImpressionsPayload;
8
+ /**
9
+ * Submitter that periodically posts impressions data
10
+ */
11
+ export declare function impressionsSubmitterFactory(params: ISdkFactoryContextSync): import("../types").ISyncTask<[], void>;
@@ -0,0 +1,12 @@
1
+ import { ISyncTask } from '../types';
2
+ import { IRecorderCacheProducerSync } from '../../storages/types';
3
+ import { ILogger } from '../../logger/types';
4
+ import { IResponse } from '../../services/types';
5
+ /**
6
+ * Base function to create submitters, such as ImpressionsSubmitter and EventsSubmitter
7
+ */
8
+ export declare function submitterFactory<TState>(log: ILogger, postClient: (body: string) => Promise<IResponse>, sourceCache: IRecorderCacheProducerSync<TState>, postRate: number, dataName: string, fromCacheToPayload?: (cacheData: TState) => any, maxRetries?: number, debugLogs?: boolean): ISyncTask<[], void>;
9
+ /**
10
+ * Decorates a provided submitter with a first execution window
11
+ */
12
+ export declare function firstPushWindowDecorator(submitter: ISyncTask, firstPushWindow: number): ISyncTask<[], any>;
@@ -1,2 +1,2 @@
1
- import { ISyncManagerFactoryParams } from '../types';
2
- export declare function submitterManagerFactory(params: ISyncManagerFactoryParams): import("../types").ISyncTask<[], any>;
1
+ import { ISdkFactoryContextSync } from '../../sdkFactory/types';
2
+ export declare function submitterManagerFactory(params: ISdkFactoryContextSync): import("../types").ISyncTask<[], any>;
@@ -0,0 +1,24 @@
1
+ import { ISegmentsCacheSync, ISplitsCacheSync, ITelemetryCacheSync } from '../../storages/types';
2
+ import { TelemetryUsageStatsPayload, TelemetryConfigStatsPayload } from './types';
3
+ import { ISettings } from '../../types';
4
+ import { ISdkFactoryContextSync } from '../../sdkFactory/types';
5
+ /**
6
+ * Converts data from telemetry cache into /metrics/usage request payload.
7
+ */
8
+ export declare function telemetryCacheStatsAdapter(telemetry: ITelemetryCacheSync, splits: ISplitsCacheSync, segments: ISegmentsCacheSync): {
9
+ isEmpty(): boolean;
10
+ clear(): void;
11
+ state(): TelemetryUsageStatsPayload;
12
+ };
13
+ /**
14
+ * Converts data from telemetry cache and settings into /metrics/config request payload.
15
+ */
16
+ export declare function telemetryCacheConfigAdapter(telemetry: ITelemetryCacheSync, settings: ISettings): {
17
+ isEmpty(): boolean;
18
+ clear(): void;
19
+ state(): TelemetryConfigStatsPayload;
20
+ };
21
+ /**
22
+ * Submitter that periodically posts telemetry data
23
+ */
24
+ export declare function telemetrySubmitterFactory(params: ISdkFactoryContextSync): import("../types").ISyncTask<[], any> | undefined;
@@ -1,27 +0,0 @@
1
- import { ISyncTask, ITimeTracker } from '../types';
2
- import { ISplitApi } from '../../services/types';
3
- import { IStorageSync, TelemetryCacheSync } from '../../storages/types';
4
- import { TelemetryUsageStatsPayload, TelemetryConfigStatsPayload } from './types';
5
- import { IReadinessManager } from '../../readiness/types';
6
- import { ISettings } from '../../types';
7
- /**
8
- * Converts `impressions` data from cache into request payload.
9
- */
10
- export declare function telemetryCacheStatsAdapter({ splits, segments, telemetry }: IStorageSync & {
11
- telemetry: TelemetryCacheSync;
12
- }): {
13
- isEmpty(): boolean;
14
- clear(): void;
15
- state(): TelemetryUsageStatsPayload;
16
- };
17
- export declare function telemetryCacheConfigAdapter(settings: ISettings, telemetryCache: TelemetryCacheSync): {
18
- isEmpty(): boolean;
19
- clear(): void;
20
- state(): TelemetryConfigStatsPayload;
21
- };
22
- /**
23
- * Sync task that periodically posts impressions data
24
- */
25
- export declare function telemetrySyncTaskFactory(settings: ISettings, { postMetricsUsage, postMetricsConfig }: ISplitApi, storage: IStorageSync & {
26
- telemetry: TelemetryCacheSync;
27
- }, telemetryRefreshRate: number, readiness: IReadinessManager, latencyTracker?: ITimeTracker): ISyncTask;