@salesforce/lds-instrumentation 1.414.1 → 1.415.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.
- 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.
|
|
@@ -941,6 +944,23 @@ function logObjectInfoChanged() {
|
|
|
941
944
|
function logMessage(message) {
|
|
942
945
|
ldsInstrumentation.log(message);
|
|
943
946
|
}
|
|
947
|
+
// Take 1 out of N adapter invocations to PFT (Don't hug PFT to death $$$$)
|
|
948
|
+
const PFT_SAMPLING_RATE = 1000;
|
|
949
|
+
/**
|
|
950
|
+
* W-13639107
|
|
951
|
+
* Logs to PFT (Product Feature Taxonomy) when an adapter is invoked
|
|
952
|
+
*/
|
|
953
|
+
function logAdapterInvocationToPFT(adapterName) {
|
|
954
|
+
if (!pftAdapterInvocationDisabledGate.isOpen({ fallback: false }) &&
|
|
955
|
+
Math.random() * PFT_SAMPLING_RATE <= 1) {
|
|
956
|
+
ldsInstrumentation.log(pdpEventSchema, {
|
|
957
|
+
event_name: `luvioAdapter.invoked`,
|
|
958
|
+
productFeatureId: LDS_PRODUCT_FEATURE_ID,
|
|
959
|
+
contextName: 'adapter.name',
|
|
960
|
+
contextValue: adapterName,
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
}
|
|
944
964
|
/**
|
|
945
965
|
* Increment the counter based on the cache policy type for an adapter call
|
|
946
966
|
*
|
|
@@ -1107,6 +1127,9 @@ function instrumentAdapter(adapter, metadata, adapterInstrumentationOptions) {
|
|
|
1107
1127
|
updateRequestContext(activity, requestContext);
|
|
1108
1128
|
return runAdapterWithReport(metadata.name, adapter, config, requestContext || {}, (report) => {
|
|
1109
1129
|
const { executionTime } = report;
|
|
1130
|
+
if (report.result !== 'invalid-config') {
|
|
1131
|
+
logAdapterInvocationToPFT(adapterName);
|
|
1132
|
+
}
|
|
1110
1133
|
switch (report.result) {
|
|
1111
1134
|
case 'l1-hit': {
|
|
1112
1135
|
ldsInstrumentation.incrementCounter(ADAPTER_CACHE_HIT_COUNT_METRIC_NAME, 1);
|
|
@@ -1581,5 +1604,5 @@ function onIdleDetected(callback) {
|
|
|
1581
1604
|
}
|
|
1582
1605
|
const instrumentation = new Instrumentation();
|
|
1583
1606
|
|
|
1584
|
-
export { Instrumentation, LRUCache, metricKeys as METRIC_KEYS, executeAsyncActivity, handleIngestedNewData, handleOnDataOutOfTtlDurationUpdate, incrementCounterMetric, incrementGetRecordNormalInvokeCount, incrementGetRecordNotifyChangeAllowCount, incrementGetRecordNotifyChangeDropCount, incrementNotifyRecordUpdateAvailableAllowCount, incrementNotifyRecordUpdateAvailableDropCount, incrementStateCreatedCount, instrumentAdapter, instrumentLuvio, instrumentMethods, instrumentStoreMethods, instrumentation, logError, logMessage, logObjectInfoChanged, onIdleDetected, setInstrumentationHooks, setLdsAdaptersUiapiInstrumentation, setLdsNetworkAdapterInstrumentation, setStoreEventObservers, setupInstrumentation, startAdapterActivity, updatePercentileHistogramMetric };
|
|
1585
|
-
// version: 1.
|
|
1607
|
+
export { Instrumentation, LRUCache, metricKeys as METRIC_KEYS, executeAsyncActivity, handleIngestedNewData, handleOnDataOutOfTtlDurationUpdate, incrementCounterMetric, incrementGetRecordNormalInvokeCount, incrementGetRecordNotifyChangeAllowCount, incrementGetRecordNotifyChangeDropCount, incrementNotifyRecordUpdateAvailableAllowCount, incrementNotifyRecordUpdateAvailableDropCount, incrementStateCreatedCount, instrumentAdapter, instrumentLuvio, instrumentMethods, instrumentStoreMethods, instrumentation, logAdapterInvocationToPFT, logError, logMessage, logObjectInfoChanged, onIdleDetected, setInstrumentationHooks, setLdsAdaptersUiapiInstrumentation, setLdsNetworkAdapterInstrumentation, setStoreEventObservers, setupInstrumentation, startAdapterActivity, updatePercentileHistogramMetric };
|
|
1608
|
+
// version: 1.415.0-3636f2a7b2
|
package/dist/types/main.d.ts
CHANGED
|
@@ -30,6 +30,11 @@ export declare function instrumentLuvio(context: unknown): void;
|
|
|
30
30
|
*/
|
|
31
31
|
export declare function logObjectInfoChanged(): void;
|
|
32
32
|
export declare function logMessage(message: string): void;
|
|
33
|
+
/**
|
|
34
|
+
* W-13639107
|
|
35
|
+
* Logs to PFT (Product Feature Taxonomy) when an adapter is invoked
|
|
36
|
+
*/
|
|
37
|
+
export declare function logAdapterInvocationToPFT(adapterName: string): void;
|
|
33
38
|
export type ReportObserver = (report: AdapterReport) => void;
|
|
34
39
|
interface AdapterInstrumentationOptions {
|
|
35
40
|
trackL1Hits: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-instrumentation",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.415.0",
|
|
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.
|
|
37
|
-
"@salesforce/lds-default-luvio": "^1.
|
|
38
|
-
"@salesforce/lds-utils-adapters": "^1.
|
|
39
|
-
"o11y": "
|
|
40
|
-
"o11y_schema": "
|
|
36
|
+
"@salesforce/lds-bindings": "^1.415.0",
|
|
37
|
+
"@salesforce/lds-default-luvio": "^1.415.0",
|
|
38
|
+
"@salesforce/lds-utils-adapters": "^1.415.0",
|
|
39
|
+
"o11y": "262.6.0",
|
|
40
|
+
"o11y_schema": "260.37.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@salesforce/lds-adapters-uiapi": "^1.
|
|
44
|
-
"@salesforce/lds-network-adapter": "^1.
|
|
45
|
-
"@salesforce/nimbus-plugin-lds": "^1.
|
|
43
|
+
"@salesforce/lds-adapters-uiapi": "^1.415.0",
|
|
44
|
+
"@salesforce/lds-network-adapter": "^1.415.0",
|
|
45
|
+
"@salesforce/nimbus-plugin-lds": "^1.415.0"
|
|
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
|
}
|