@salesforce/lds-instrumentation 1.266.0-dev20 → 1.266.0-dev22

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.
@@ -619,6 +619,18 @@ const GRAPHQL_LEGACY_ADAPTER_USAGE_COUNT = 'graphql-legacy-adapter-usage-count';
619
619
  * Counter to track errors in usage of legacy adapter
620
620
  */
621
621
  const GRAPHQL_LEGACY_ADAPTER_ERRORS_IN_RESPONSE_COUNT = 'graphql-legacy-adapter-errors-in-response-count';
622
+ /**
623
+ * W-15022402
624
+ * Predictive Data loading predict() Activity Tracking
625
+ * Activity name to track duration, errors for predictive data loading's predict() function
626
+ */
627
+ const PREDICTIVE_DATA_LOADING_PREDICT = 'predictive-data-loading-predict';
628
+ /**
629
+ * W-15022402
630
+ * Predictive Data loading saveRequest() Activity Tracking
631
+ * Activity name to track duration, errors for predictive data loading's saveRequest() function
632
+ */
633
+ const PREDICTIVE_DATA_LOADING_SAVE_REQUEST = 'predictive-data-loading-save-request';
622
634
 
623
635
  var metricKeys = /*#__PURE__*/Object.freeze({
624
636
  __proto__: null,
@@ -652,6 +664,8 @@ var metricKeys = /*#__PURE__*/Object.freeze({
652
664
  NOTIFY_RECORD_UPDATE_AVAILABLE_ALLOW_COUNT: NOTIFY_RECORD_UPDATE_AVAILABLE_ALLOW_COUNT,
653
665
  NOTIFY_RECORD_UPDATE_AVAILABLE_DROP_COUNT: NOTIFY_RECORD_UPDATE_AVAILABLE_DROP_COUNT,
654
666
  NOTIFY_STORE_UPDATE_AVAILABLE_DURATION: NOTIFY_STORE_UPDATE_AVAILABLE_DURATION,
667
+ PREDICTIVE_DATA_LOADING_PREDICT: PREDICTIVE_DATA_LOADING_PREDICT,
668
+ PREDICTIVE_DATA_LOADING_SAVE_REQUEST: PREDICTIVE_DATA_LOADING_SAVE_REQUEST,
655
669
  RECORD_TYPE_ID_IS_NULL_COUNT: RECORD_TYPE_ID_IS_NULL_COUNT,
656
670
  REPRESENTATION_CACHE_MISS_OUT_OF_TTL_DATA_CHANGED_COUNT_METRIC_NAME: REPRESENTATION_CACHE_MISS_OUT_OF_TTL_DATA_CHANGED_COUNT_METRIC_NAME,
657
671
  REPRESENTATION_CACHE_MISS_OUT_OF_TTL_DATA_CHANGED_DURATION_METRIC_NAME: REPRESENTATION_CACHE_MISS_OUT_OF_TTL_DATA_CHANGED_DURATION_METRIC_NAME,
@@ -970,6 +984,44 @@ function startAdapterActivity(instrumentation, adapterName, requestContext) {
970
984
  }
971
985
  return instrumentation.startActivity(adapterName, apiOptions);
972
986
  }
987
+ const executeAsyncActivityDefaultOptions = {
988
+ LOG_ERROR_ONLY: false,
989
+ };
990
+ /**
991
+ * Starts an async o11y Activity using ldsInstrumentation.
992
+ *
993
+ * Heavily borrowed from o11y asyncActivity, but actually swallows the error instead of rethrowing.
994
+ *
995
+ */
996
+ async function executeAsyncActivity(name, execute, options) {
997
+ var _a, _b, _c, _d;
998
+ const normalizedOptions = Object.assign({}, executeAsyncActivityDefaultOptions, options);
999
+ const act = ldsInstrumentation.startActivity(name, options);
1000
+ let isError = false;
1001
+ try {
1002
+ return await execute(act);
1003
+ }
1004
+ catch (err) {
1005
+ act.error(err,
1006
+ // eslint-disable-next-line @salesforce/lds/no-optional-chaining
1007
+ (_a = normalizedOptions.errorPayload) === null || _a === void 0 ? void 0 : _a.schema,
1008
+ // eslint-disable-next-line @salesforce/lds/no-optional-chaining
1009
+ (_b = normalizedOptions.errorPayload) === null || _b === void 0 ? void 0 : _b.payload);
1010
+ isError = true;
1011
+ }
1012
+ finally {
1013
+ if (normalizedOptions.LOG_ERROR_ONLY && !isError) {
1014
+ act.discard();
1015
+ }
1016
+ else {
1017
+ act.stop(
1018
+ // eslint-disable-next-line @salesforce/lds/no-optional-chaining
1019
+ (_c = normalizedOptions === null || normalizedOptions === void 0 ? void 0 : normalizedOptions.stopPayload) === null || _c === void 0 ? void 0 : _c.schema,
1020
+ // eslint-disable-next-line @salesforce/lds/no-optional-chaining
1021
+ (_d = normalizedOptions === null || normalizedOptions === void 0 ? void 0 : normalizedOptions.stopPayload) === null || _d === void 0 ? void 0 : _d.payload);
1022
+ }
1023
+ }
1024
+ }
973
1025
  function instrumentAdapter(adapter, metadata, adapterInstrumentationOptions) {
974
1026
  const { apiFamily, name, ttl } = metadata;
975
1027
  let trackL1Hits = false;
@@ -1501,5 +1553,5 @@ function onIdleDetected(callback) {
1501
1553
  }
1502
1554
  const instrumentation = new Instrumentation();
1503
1555
 
1504
- export { Instrumentation, LRUCache, metricKeys as METRIC_KEYS, handleIngestedNewData, handleOnDataOutOfTtlDurationUpdate, incrementCounterMetric, incrementGetRecordNormalInvokeCount, incrementGetRecordNotifyChangeAllowCount, incrementGetRecordNotifyChangeDropCount, incrementNotifyRecordUpdateAvailableAllowCount, incrementNotifyRecordUpdateAvailableDropCount, instrumentAdapter, instrumentLuvio, instrumentMethods, instrumentStoreMethods, instrumentation, logObjectInfoChanged, onIdleDetected, setInstrumentationHooks, setLdsAdaptersUiapiInstrumentation, setLdsNetworkAdapterInstrumentation, setStoreEventObservers, setupInstrumentation, startAdapterActivity, updatePercentileHistogramMetric };
1505
- // version: 1.266.0-dev20-117d849b4
1556
+ export { Instrumentation, LRUCache, metricKeys as METRIC_KEYS, executeAsyncActivity, handleIngestedNewData, handleOnDataOutOfTtlDurationUpdate, incrementCounterMetric, incrementGetRecordNormalInvokeCount, incrementGetRecordNotifyChangeAllowCount, incrementGetRecordNotifyChangeDropCount, incrementNotifyRecordUpdateAvailableAllowCount, incrementNotifyRecordUpdateAvailableDropCount, instrumentAdapter, instrumentLuvio, instrumentMethods, instrumentStoreMethods, instrumentation, logObjectInfoChanged, onIdleDetected, setInstrumentationHooks, setLdsAdaptersUiapiInstrumentation, setLdsNetworkAdapterInstrumentation, setStoreEventObservers, setupInstrumentation, startAdapterActivity, updatePercentileHistogramMetric };
1557
+ // version: 1.266.0-dev22-06d4657e7
@@ -1,5 +1,5 @@
1
1
  import type { AdapterRequestContext, Luvio, InMemoryStore, Adapter, CacheMissOutOfTtlEvent, DataOutOfTtlDurationUpdateEvent } from '@luvio/engine';
2
- import type { Activity, Instrumentation as o11yInstrumentation } from 'o11y/dist/modules/o11y/client/interfaces';
2
+ import type { Activity, ActivityApiOptions, Instrumentation as o11yInstrumentation } from 'o11y/dist/modules/o11y/client/interfaces';
3
3
  import type { Registration as LdsUiapiRegistration } from '@salesforce/lds-adapters-uiapi';
4
4
  import type { Registration as LdsNetworkAdapterRegistration } from '@salesforce/lds-network-adapter';
5
5
  import type { AdapterReport } from '@salesforce/lds-utils-adapters';
@@ -45,6 +45,16 @@ export interface RequestCorrelator {
45
45
  * If an ObservabilityContext is defined, we build an object that conforms to the ApiOptions interface required by the startActivity API
46
46
  */
47
47
  export declare function startAdapterActivity(instrumentation: o11yInstrumentation, adapterName: string, requestContext?: AdapterRequestContext): Activity;
48
+ export type ExecuteAsyncActivityOptions = {
49
+ LOG_ERROR_ONLY?: boolean;
50
+ };
51
+ /**
52
+ * Starts an async o11y Activity using ldsInstrumentation.
53
+ *
54
+ * Heavily borrowed from o11y asyncActivity, but actually swallows the error instead of rethrowing.
55
+ *
56
+ */
57
+ export declare function executeAsyncActivity<T>(name: string, execute: (act: Activity) => Promise<T>, options?: ExecuteAsyncActivityOptions & ActivityApiOptions): Promise<T | undefined>;
48
58
  export declare function instrumentAdapter<C, D>(adapter: Adapter<C, D>, metadata: AdapterMetadata, adapterInstrumentationOptions?: AdapterInstrumentationOptions): Adapter<C, D>;
49
59
  /**
50
60
  * Wraps methods to collect runtime performance using o11y's trackValue API
@@ -201,3 +201,15 @@ export declare const GRAPHQL_LEGACY_ADAPTER_USAGE_COUNT = "graphql-legacy-adapte
201
201
  * Counter to track errors in usage of legacy adapter
202
202
  */
203
203
  export declare const GRAPHQL_LEGACY_ADAPTER_ERRORS_IN_RESPONSE_COUNT = "graphql-legacy-adapter-errors-in-response-count";
204
+ /**
205
+ * W-15022402
206
+ * Predictive Data loading predict() Activity Tracking
207
+ * Activity name to track duration, errors for predictive data loading's predict() function
208
+ */
209
+ export declare const PREDICTIVE_DATA_LOADING_PREDICT = "predictive-data-loading-predict";
210
+ /**
211
+ * W-15022402
212
+ * Predictive Data loading saveRequest() Activity Tracking
213
+ * Activity name to track duration, errors for predictive data loading's saveRequest() function
214
+ */
215
+ export declare const PREDICTIVE_DATA_LOADING_SAVE_REQUEST = "predictive-data-loading-save-request";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-instrumentation",
3
- "version": "1.266.0-dev20",
3
+ "version": "1.266.0-dev22",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "Instrumentation utils for Lightning Data Service",
6
6
  "main": "dist/ldsInstrumentation.js",
@@ -33,24 +33,24 @@
33
33
  "release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-instrumentation"
34
34
  },
35
35
  "dependencies": {
36
- "@salesforce/lds-bindings": "^1.266.0-dev20",
37
- "@salesforce/lds-default-luvio": "^1.266.0-dev20",
38
- "@salesforce/lds-utils-adapters": "^1.266.0-dev20",
36
+ "@salesforce/lds-bindings": "^1.266.0-dev22",
37
+ "@salesforce/lds-default-luvio": "^1.266.0-dev22",
38
+ "@salesforce/lds-utils-adapters": "^1.266.0-dev22",
39
39
  "o11y": "244.0.0",
40
40
  "o11y_schema": "248.40.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@salesforce/lds-adapters-uiapi": "^1.266.0-dev20",
44
- "@salesforce/lds-network-adapter": "^1.266.0-dev20",
45
- "@salesforce/nimbus-plugin-lds": "^1.266.0-dev20"
43
+ "@salesforce/lds-adapters-uiapi": "^1.266.0-dev22",
44
+ "@salesforce/lds-network-adapter": "^1.266.0-dev22",
45
+ "@salesforce/nimbus-plugin-lds": "^1.266.0-dev22"
46
46
  },
47
47
  "luvioBundlesize": [
48
48
  {
49
49
  "path": "./dist/ldsInstrumentation.js",
50
50
  "maxSize": {
51
- "none": "61 kB",
52
- "min": "26 kB",
53
- "compressed": "11 kB"
51
+ "none": "64 kB",
52
+ "min": "27 kB",
53
+ "compressed": "12 kB"
54
54
  }
55
55
  }
56
56
  ],