@salesforce/lds-instrumentation 1.145.0 → 1.146.0

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.
@@ -91,7 +91,7 @@ var FragmentReadResultState;
91
91
  ({
92
92
  state: FragmentReadResultState.Missing,
93
93
  });
94
- // engine version: 0.142.4-be29f4f3
94
+ // engine version: 0.143.0-384dfa26
95
95
 
96
96
  const DurableEnvironmentEventDiscriminator = 'durable';
97
97
  function isDurableEnvironmentEvent(event) {
@@ -952,9 +952,11 @@ function instrumentAdapter(adapter, metadata, adapterInstrumentationOptions) {
952
952
  const { apiFamily, name, ttl } = metadata;
953
953
  let trackL1Hits = false;
954
954
  let trackL2Hits = false;
955
+ let trackCacheMisses = false;
955
956
  let reportObserver = undefined;
956
957
  if (adapterInstrumentationOptions !== undefined) {
957
- ({ trackL1Hits, trackL2Hits, reportObserver } = adapterInstrumentationOptions);
958
+ ({ trackL1Hits, trackL2Hits, trackCacheMisses, reportObserver } =
959
+ adapterInstrumentationOptions);
958
960
  }
959
961
  const adapterName = normalizeAdapterName(name, apiFamily);
960
962
  /**
@@ -1042,10 +1044,14 @@ function instrumentAdapter(adapter, metadata, adapterInstrumentationOptions) {
1042
1044
  case 'cache-miss':
1043
1045
  {
1044
1046
  ldsInstrumentation.trackValue(cacheMissDurationByAdapterMetric, executionTime);
1045
- // TODO [W-10484306]: Remove typecasting after this type bug is solved
1046
- activity.stop('cache-miss');
1047
1047
  ldsInstrumentation.incrementCounter(ADAPTER_CACHE_MISS_COUNT_METRIC_NAME, 1);
1048
1048
  ldsInstrumentation.incrementCounter(cacheMissCountByAdapterMetric, 1);
1049
+ if (trackCacheMisses) {
1050
+ activity.stop('cache-miss');
1051
+ }
1052
+ else {
1053
+ activity.discard();
1054
+ }
1049
1055
  if (ttl !== undefined) {
1050
1056
  logAdapterCacheMissOutOfTtlDuration(adapterName, config, Date.now(), ttl, cacheMissOutOfTtlCountByAdapterMetric, cacheMissOutOfTtlDurationByAdapterMetric);
1051
1057
  }
@@ -1060,7 +1066,6 @@ function instrumentAdapter(adapter, metadata, adapterInstrumentationOptions) {
1060
1066
  if (isAdapterError(error)) {
1061
1067
  activity.error(error);
1062
1068
  }
1063
- // TODO [W-10484306]: Remove typecasting after this type bug is solved
1064
1069
  activity.stop('error');
1065
1070
  }
1066
1071
  break;
@@ -1381,7 +1386,6 @@ function setupInstrumentation(luvio, store) {
1381
1386
  setupStoreStatsCollection(luvio, instrumentStoreStatsCallback(store));
1382
1387
  setStoreScheduler(store);
1383
1388
  setStoreEventObservers(store);
1384
- // TODO [W-10061321]: use periodic logger to log aggregated store stats
1385
1389
  }
1386
1390
  function instrumentStoreMethods(luvio, _store) {
1387
1391
  instrumentMethods(luvio, [
@@ -1449,4 +1453,4 @@ function setStoreEventObservers(store) {
1449
1453
  const instrumentation = new Instrumentation();
1450
1454
 
1451
1455
  export { Instrumentation, LRUCache, metricKeys as METRIC_KEYS, handleIngestedNewData, handleOnDataOutOfTtlDurationUpdate, incrementCounterMetric, incrementGetRecordNormalInvokeCount, incrementGetRecordNotifyChangeAllowCount, incrementGetRecordNotifyChangeDropCount, incrementNotifyRecordUpdateAvailableAllowCount, incrementNotifyRecordUpdateAvailableDropCount, instrumentAdapter, instrumentLuvio, instrumentMethods, instrumentStoreMethods, instrumentation, setInstrumentationHooks, setLdsAdaptersUiapiInstrumentation, setLdsNetworkAdapterInstrumentation, setStoreEventObservers, setupInstrumentation, startAdapterActivity, updatePercentileHistogramMetric };
1452
- // version: 1.145.0-a93c76713
1456
+ // version: 1.146.0-6ca270a7a
@@ -28,6 +28,7 @@ export type ReportObserver = (report: AdapterReport) => void;
28
28
  interface AdapterInstrumentationOptions {
29
29
  trackL1Hits: boolean;
30
30
  trackL2Hits: boolean;
31
+ trackCacheMisses: boolean;
31
32
  reportObserver?: ReportObserver;
32
33
  }
33
34
  export interface RequestCorrelator {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-instrumentation",
3
- "version": "1.145.0",
3
+ "version": "1.146.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "Instrumentation utils for Lightning Data Service",
6
6
  "main": "dist/ldsInstrumentation.js",