@salesforce/lds-instrumentation 1.404.0-dev7 → 1.404.0-dev9
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/dist/ldsInstrumentation.js +25 -2
- package/dist/types/main.d.ts +5 -0
- package/package.json +10 -10
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
/* proxy-compat-disable */
|
|
15
15
|
import { getInstrumentation, idleDetector } from 'o11y/client';
|
|
16
16
|
import { adapterUnfulfilledErrorSchema } from 'o11y_schema/sf_lds';
|
|
17
|
+
import { pdpEventSchema } from 'o11y_schema/sf_pdp';
|
|
18
|
+
import pftAdapterInvocationDisabledGate from '@salesforce/gate/lds.pft.adapterInvocation.disabled';
|
|
17
19
|
import { ADAPTER_UNFULFILLED_ERROR, instrument } from 'force/ldsBindings';
|
|
18
20
|
|
|
19
21
|
var SnapshotState;
|
|
@@ -874,6 +876,7 @@ const GRAPHQL_RECORDS_KEY = 'GraphQL::graphql__uiapi__query';
|
|
|
874
876
|
const ldsInstrumentation = getInstrumentation(NAMESPACE);
|
|
875
877
|
const observabilityInstrumentation = getInstrumentation(OBSERVABILITY_NAMESPACE);
|
|
876
878
|
const stateManagersInstrumentation = getInstrumentation(STATE_MANAGERS_NAMESPACE);
|
|
879
|
+
const LDS_PRODUCT_FEATURE_ID = 'aJCEE0000000mBk4AI'; // Product Feature ID for Lightning Data Service
|
|
877
880
|
class Instrumentation {
|
|
878
881
|
/**
|
|
879
882
|
* Injected to LDS for Luvio specific instrumentation.
|
|
@@ -938,6 +941,23 @@ function logAdapterRequestError(context) {
|
|
|
938
941
|
function logObjectInfoChanged() {
|
|
939
942
|
ldsInstrumentation.log('objectInfoChanged');
|
|
940
943
|
}
|
|
944
|
+
// Take 1 out of N adapter invocations to PFT (Don't hug PFT to death $$$$)
|
|
945
|
+
const PFT_SAMPLING_RATE = 1000;
|
|
946
|
+
/**
|
|
947
|
+
* W-13639107
|
|
948
|
+
* Logs to PFT (Product Feature Taxonomy) when an adapter is invoked
|
|
949
|
+
*/
|
|
950
|
+
function logAdapterInvocationToPFT(adapterName) {
|
|
951
|
+
if (!pftAdapterInvocationDisabledGate.isOpen({ fallback: false }) &&
|
|
952
|
+
Math.random() * PFT_SAMPLING_RATE <= 1) {
|
|
953
|
+
ldsInstrumentation.log(pdpEventSchema, {
|
|
954
|
+
event_name: `luvioAdapter.invoked`,
|
|
955
|
+
productFeatureId: LDS_PRODUCT_FEATURE_ID,
|
|
956
|
+
contextName: 'adapter.name',
|
|
957
|
+
contextValue: adapterName,
|
|
958
|
+
});
|
|
959
|
+
}
|
|
960
|
+
}
|
|
941
961
|
/**
|
|
942
962
|
* Increment the counter based on the cache policy type for an adapter call
|
|
943
963
|
*
|
|
@@ -1104,6 +1124,9 @@ function instrumentAdapter(adapter, metadata, adapterInstrumentationOptions) {
|
|
|
1104
1124
|
updateRequestContext(activity, requestContext);
|
|
1105
1125
|
return runAdapterWithReport(metadata.name, adapter, config, requestContext || {}, (report) => {
|
|
1106
1126
|
const { executionTime } = report;
|
|
1127
|
+
if (report.result !== 'invalid-config') {
|
|
1128
|
+
logAdapterInvocationToPFT(adapterName);
|
|
1129
|
+
}
|
|
1107
1130
|
switch (report.result) {
|
|
1108
1131
|
case 'l1-hit': {
|
|
1109
1132
|
ldsInstrumentation.incrementCounter(ADAPTER_CACHE_HIT_COUNT_METRIC_NAME, 1);
|
|
@@ -1578,5 +1601,5 @@ function onIdleDetected(callback) {
|
|
|
1578
1601
|
}
|
|
1579
1602
|
const instrumentation = new Instrumentation();
|
|
1580
1603
|
|
|
1581
|
-
export { Instrumentation, LRUCache, metricKeys as METRIC_KEYS, executeAsyncActivity, handleIngestedNewData, handleOnDataOutOfTtlDurationUpdate, incrementCounterMetric, incrementGetRecordNormalInvokeCount, incrementGetRecordNotifyChangeAllowCount, incrementGetRecordNotifyChangeDropCount, incrementNotifyRecordUpdateAvailableAllowCount, incrementNotifyRecordUpdateAvailableDropCount, incrementStateCreatedCount, instrumentAdapter, instrumentLuvio, instrumentMethods, instrumentStoreMethods, instrumentation, logError, logObjectInfoChanged, onIdleDetected, setInstrumentationHooks, setLdsAdaptersUiapiInstrumentation, setLdsNetworkAdapterInstrumentation, setStoreEventObservers, setupInstrumentation, startAdapterActivity, updatePercentileHistogramMetric };
|
|
1582
|
-
// version: 1.404.0-
|
|
1604
|
+
export { Instrumentation, LRUCache, metricKeys as METRIC_KEYS, executeAsyncActivity, handleIngestedNewData, handleOnDataOutOfTtlDurationUpdate, incrementCounterMetric, incrementGetRecordNormalInvokeCount, incrementGetRecordNotifyChangeAllowCount, incrementGetRecordNotifyChangeDropCount, incrementNotifyRecordUpdateAvailableAllowCount, incrementNotifyRecordUpdateAvailableDropCount, incrementStateCreatedCount, instrumentAdapter, instrumentLuvio, instrumentMethods, instrumentStoreMethods, instrumentation, logAdapterInvocationToPFT, logError, logObjectInfoChanged, onIdleDetected, setInstrumentationHooks, setLdsAdaptersUiapiInstrumentation, setLdsNetworkAdapterInstrumentation, setStoreEventObservers, setupInstrumentation, startAdapterActivity, updatePercentileHistogramMetric };
|
|
1605
|
+
// version: 1.404.0-dev9-0713cc66e9
|
package/dist/types/main.d.ts
CHANGED
|
@@ -29,6 +29,11 @@ export declare function instrumentLuvio(context: unknown): void;
|
|
|
29
29
|
* Logs when object info has changed
|
|
30
30
|
*/
|
|
31
31
|
export declare function logObjectInfoChanged(): void;
|
|
32
|
+
/**
|
|
33
|
+
* W-13639107
|
|
34
|
+
* Logs to PFT (Product Feature Taxonomy) when an adapter is invoked
|
|
35
|
+
*/
|
|
36
|
+
export declare function logAdapterInvocationToPFT(adapterName: string): void;
|
|
32
37
|
export type ReportObserver = (report: AdapterReport) => void;
|
|
33
38
|
interface AdapterInstrumentationOptions {
|
|
34
39
|
trackL1Hits: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-instrumentation",
|
|
3
|
-
"version": "1.404.0-
|
|
3
|
+
"version": "1.404.0-dev9",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "Instrumentation utils for Lightning Data Service",
|
|
6
6
|
"main": "dist/ldsInstrumentation.js",
|
|
@@ -33,23 +33,23 @@
|
|
|
33
33
|
"release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-instrumentation"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@salesforce/lds-bindings": "^1.404.0-
|
|
37
|
-
"@salesforce/lds-default-luvio": "^1.404.0-
|
|
38
|
-
"@salesforce/lds-utils-adapters": "^1.404.0-
|
|
39
|
-
"o11y": "
|
|
40
|
-
"o11y_schema": "
|
|
36
|
+
"@salesforce/lds-bindings": "^1.404.0-dev9",
|
|
37
|
+
"@salesforce/lds-default-luvio": "^1.404.0-dev9",
|
|
38
|
+
"@salesforce/lds-utils-adapters": "^1.404.0-dev9",
|
|
39
|
+
"o11y": "260.24.0",
|
|
40
|
+
"o11y_schema": "260.37.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@salesforce/lds-adapters-uiapi": "^1.404.0-
|
|
44
|
-
"@salesforce/lds-network-adapter": "^1.404.0-
|
|
45
|
-
"@salesforce/nimbus-plugin-lds": "^1.404.0-
|
|
43
|
+
"@salesforce/lds-adapters-uiapi": "^1.404.0-dev9",
|
|
44
|
+
"@salesforce/lds-network-adapter": "^1.404.0-dev9",
|
|
45
|
+
"@salesforce/nimbus-plugin-lds": "^1.404.0-dev9"
|
|
46
46
|
},
|
|
47
47
|
"luvioBundlesize": [
|
|
48
48
|
{
|
|
49
49
|
"path": "./dist/ldsInstrumentation.js",
|
|
50
50
|
"maxSize": {
|
|
51
51
|
"none": "64 kB",
|
|
52
|
-
"min": "
|
|
52
|
+
"min": "28 kB",
|
|
53
53
|
"compressed": "12 kB"
|
|
54
54
|
}
|
|
55
55
|
}
|