@salesforce/lds-instrumentation 0.1.0-dev1
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/LICENSE.txt +82 -0
- package/dist/ldsInstrumentation.js +1582 -0
- package/dist/types/__mocks__/force/ldsGraphqlParser.d.ts +3 -0
- package/dist/types/__mocks__/o11y/activity.d.ts +12 -0
- package/dist/types/__mocks__/o11y/client.d.ts +11 -0
- package/dist/types/__mocks__/o11y/idleDetector.d.ts +18 -0
- package/dist/types/__mocks__/o11y/instrumentation.d.ts +15 -0
- package/dist/types/__mocks__/o11y_schema/sf_lds.d.ts +1 -0
- package/dist/types/main.d.ts +115 -0
- package/dist/types/metric-keys.d.ts +227 -0
- package/dist/types/utils/language.d.ts +13 -0
- package/dist/types/utils/lru-cache.d.ts +14 -0
- package/dist/types/utils/observability.d.ts +24 -0
- package/dist/types/utils/utils.d.ts +15 -0
- package/package.json +60 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare function stop(_userSchemaOrText?: any | string, _userData?: any): void;
|
|
2
|
+
declare function error(_error: Error, _userSchemaOrText?: any | string, _userData?: any): void;
|
|
3
|
+
declare function discard(): void;
|
|
4
|
+
declare function terminate(): void;
|
|
5
|
+
export declare const activity: {
|
|
6
|
+
stop: typeof stop;
|
|
7
|
+
error: typeof error;
|
|
8
|
+
discard: typeof discard;
|
|
9
|
+
terminate: typeof terminate;
|
|
10
|
+
getId: () => string;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { activity } from './activity';
|
|
2
|
+
export { instrumentation } from './instrumentation';
|
|
3
|
+
export { idleDetector } from './idleDetector';
|
|
4
|
+
export declare function getInstrumentation(_name: string): {
|
|
5
|
+
log: (_schema: any, _data?: any) => void;
|
|
6
|
+
error: (_error: unknown, _userSchemaOrText?: any, _userData?: any) => void;
|
|
7
|
+
startActivity: (_name: string) => any;
|
|
8
|
+
incrementCounter: (_operation: string, _increment?: number | undefined, _hasError?: boolean | undefined, _tags?: any) => void;
|
|
9
|
+
trackValue: (_operation: string, _value: number, _hasError?: boolean | undefined, _tags?: any) => void;
|
|
10
|
+
bucketValue: (_operation: string, _value: number, _buckets: number[]) => void;
|
|
11
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare function requestIdleDetectedCallback(_callback: any): void;
|
|
2
|
+
declare function declareNotifierTaskSingle(_name: string): {
|
|
3
|
+
isBusy: boolean;
|
|
4
|
+
done: () => void;
|
|
5
|
+
};
|
|
6
|
+
declare function declareNotifierTaskMulti(_name: string, _existingBusyCount?: number): {
|
|
7
|
+
isBusy: boolean;
|
|
8
|
+
add: () => void;
|
|
9
|
+
done: () => void;
|
|
10
|
+
};
|
|
11
|
+
declare function declarePollableTaskMulti(_name: string, _isBusyChecker: any): void;
|
|
12
|
+
export declare const idleDetector: {
|
|
13
|
+
requestIdleDetectedCallback: typeof requestIdleDetectedCallback;
|
|
14
|
+
declareNotifierTaskSingle: typeof declareNotifierTaskSingle;
|
|
15
|
+
declareNotifierTaskMulti: typeof declareNotifierTaskMulti;
|
|
16
|
+
declarePollableTaskMulti: typeof declarePollableTaskMulti;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare function log(_schema: any, _data?: any): void;
|
|
2
|
+
declare function error(_error: unknown, _userSchemaOrText?: any | string, _userData?: any): void;
|
|
3
|
+
declare function startActivity(_name: string): any;
|
|
4
|
+
declare function incrementCounter(_operation: string, _increment?: number, _hasError?: boolean, _tags?: any): void;
|
|
5
|
+
declare function trackValue(_operation: string, _value: number, _hasError?: boolean, _tags?: any): void;
|
|
6
|
+
declare function bucketValue(_operation: string, _value: number, _buckets: number[]): void;
|
|
7
|
+
export declare const instrumentation: {
|
|
8
|
+
log: typeof log;
|
|
9
|
+
error: typeof error;
|
|
10
|
+
startActivity: typeof startActivity;
|
|
11
|
+
incrementCounter: typeof incrementCounter;
|
|
12
|
+
trackValue: typeof trackValue;
|
|
13
|
+
bucketValue: typeof bucketValue;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const adapterUnfulfilledErrorSchema: {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { AdapterRequestContext, Luvio, InMemoryStore, Adapter, CacheMissOutOfTtlEvent, DataOutOfTtlDurationUpdateEvent } from '@luvio/engine';
|
|
2
|
+
import type { Activity, ActivityApiOptions, Instrumentation as o11yInstrumentation } from 'o11y/dist/modules/o11y/client/interfaces';
|
|
3
|
+
import type { Registration as LdsUiapiRegistration } from '@salesforce/lds-adapters-uiapi';
|
|
4
|
+
import type { Registration as LdsNetworkAdapterRegistration } from '@salesforce/lds-network-adapter';
|
|
5
|
+
import type { AdapterReport } from '@salesforce/lds-utils-adapters';
|
|
6
|
+
import type { ObservabilityContext } from '@salesforce/nimbus-plugin-lds';
|
|
7
|
+
export * as METRIC_KEYS from './metric-keys';
|
|
8
|
+
export { LRUCache } from './utils/lru-cache';
|
|
9
|
+
interface AdapterMetadata {
|
|
10
|
+
apiFamily: string;
|
|
11
|
+
name: string;
|
|
12
|
+
ttl?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare class Instrumentation {
|
|
15
|
+
/**
|
|
16
|
+
* Injected to LDS for Luvio specific instrumentation.
|
|
17
|
+
*
|
|
18
|
+
* @param context The transaction context.
|
|
19
|
+
*/
|
|
20
|
+
instrumentLuvio(_context: unknown): void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Provide this method for the instrument option for a Luvio instance.
|
|
24
|
+
* @param context The transaction context.
|
|
25
|
+
*/
|
|
26
|
+
export declare function instrumentLuvio(context: unknown): void;
|
|
27
|
+
/**
|
|
28
|
+
* W-13639107
|
|
29
|
+
* Logs when object info has changed
|
|
30
|
+
*/
|
|
31
|
+
export declare function logObjectInfoChanged(): void;
|
|
32
|
+
export type ReportObserver = (report: AdapterReport) => void;
|
|
33
|
+
interface AdapterInstrumentationOptions {
|
|
34
|
+
trackL1Hits: boolean;
|
|
35
|
+
trackL2Hits: boolean;
|
|
36
|
+
trackCacheMisses: boolean;
|
|
37
|
+
reportObserver?: ReportObserver;
|
|
38
|
+
}
|
|
39
|
+
export interface RequestCorrelator {
|
|
40
|
+
observabilityContext?: ObservabilityContext;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Starts an o11y Activity using the supplied o11y Instrumention and adapterName.
|
|
44
|
+
* If a requestContext is supplied, we check for the existence of a requestCorrelator containing an ObservabilityContext.
|
|
45
|
+
* If an ObservabilityContext is defined, we build an object that conforms to the ApiOptions interface required by the startActivity API
|
|
46
|
+
*/
|
|
47
|
+
export declare function startAdapterActivity(instrumentation: o11yInstrumentation, adapterName: string, requestContext?: AdapterRequestContext): Activity;
|
|
48
|
+
export type ExecuteAsyncActivityOptions = {
|
|
49
|
+
LOG_ERROR_ONLY?: boolean;
|
|
50
|
+
ERROR_SCOPE?: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Starts an async o11y Activity using ldsInstrumentation.
|
|
54
|
+
*
|
|
55
|
+
* Heavily borrowed from o11y asyncActivity, but actually swallows the error instead of rethrowing.
|
|
56
|
+
*
|
|
57
|
+
*/
|
|
58
|
+
export declare function executeAsyncActivity<T>(name: string, execute: (act: Activity) => Promise<T>, options?: ExecuteAsyncActivityOptions & ActivityApiOptions): Promise<T | undefined>;
|
|
59
|
+
export declare function instrumentAdapter<C, D>(adapter: Adapter<C, D>, metadata: AdapterMetadata, adapterInstrumentationOptions?: AdapterInstrumentationOptions): Adapter<C, D>;
|
|
60
|
+
/**
|
|
61
|
+
* Wraps methods to collect runtime performance using o11y's trackValue API
|
|
62
|
+
* @param obj Object instance containing the methods to instrument
|
|
63
|
+
* @param methods array containing objects with keys for the method name and the metric key to use in o11y
|
|
64
|
+
*/
|
|
65
|
+
export declare function instrumentMethods(obj: any, methods: {
|
|
66
|
+
methodName: string;
|
|
67
|
+
metricKey: string;
|
|
68
|
+
}[]): void;
|
|
69
|
+
/**
|
|
70
|
+
* Logs an error to Splunk using o11y
|
|
71
|
+
*/
|
|
72
|
+
export declare function logError(err: Error | string): void;
|
|
73
|
+
/**
|
|
74
|
+
* Calls instrumentation/service telemetry counter
|
|
75
|
+
* @param name Name of the metric
|
|
76
|
+
* @param value number to increment by, if undefined increment by 1
|
|
77
|
+
*/
|
|
78
|
+
export declare function incrementCounterMetric(name: string, number?: number): void;
|
|
79
|
+
/**
|
|
80
|
+
* Calls instrumentation/service telemetry percentileHistogram
|
|
81
|
+
* @param name Name of the metric
|
|
82
|
+
* @param value number used to update the percentileHistogram
|
|
83
|
+
*/
|
|
84
|
+
export declare function updatePercentileHistogramMetric(name: string, value: number): void;
|
|
85
|
+
export declare function incrementGetRecordNormalInvokeCount(): void;
|
|
86
|
+
export declare function incrementGetRecordNotifyChangeAllowCount(): void;
|
|
87
|
+
export declare function incrementGetRecordNotifyChangeDropCount(): void;
|
|
88
|
+
export declare function incrementNotifyRecordUpdateAvailableAllowCount(): void;
|
|
89
|
+
export declare function incrementNotifyRecordUpdateAvailableDropCount(): void;
|
|
90
|
+
export declare function incrementStateCreatedCount(): void;
|
|
91
|
+
/**
|
|
92
|
+
* Sets up instrumentation for @salesforce/lds-adapters-uiapi
|
|
93
|
+
*/
|
|
94
|
+
export declare function setLdsAdaptersUiapiInstrumentation(uiapiRegistration: LdsUiapiRegistration): void;
|
|
95
|
+
/**
|
|
96
|
+
* Sets up instrumentation for @salesforce/lds-network-adapter
|
|
97
|
+
*/
|
|
98
|
+
export declare function setLdsNetworkAdapterInstrumentation(networkAdapterRegistration: LdsNetworkAdapterRegistration): void;
|
|
99
|
+
/**
|
|
100
|
+
* Provides concrete implementations using o11y/client for instrumentation hooks
|
|
101
|
+
*/
|
|
102
|
+
export declare function setInstrumentationHooks(): void;
|
|
103
|
+
/**
|
|
104
|
+
* Initialize the instrumentation and instrument the LDS instance and the InMemoryStore.
|
|
105
|
+
*
|
|
106
|
+
* @param luvio The Luvio instance to instrument.
|
|
107
|
+
* @param store The InMemoryStore to instrument.
|
|
108
|
+
*/
|
|
109
|
+
export declare function setupInstrumentation(luvio: Luvio, store: InMemoryStore): void;
|
|
110
|
+
export declare function instrumentStoreMethods(luvio: Luvio, _store: InMemoryStore): void;
|
|
111
|
+
export declare function handleIngestedNewData(event: CacheMissOutOfTtlEvent): void;
|
|
112
|
+
export declare function handleOnDataOutOfTtlDurationUpdate(event: DataOutOfTtlDurationUpdateEvent): void;
|
|
113
|
+
export declare function setStoreEventObservers(store: InMemoryStore): void;
|
|
114
|
+
export declare function onIdleDetected(callback: (timestamp: number) => void): void;
|
|
115
|
+
export declare const instrumentation: Instrumentation;
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
export declare const ADAPTER_CACHE_HIT_COUNT_METRIC_NAME = "cache-hit-count";
|
|
2
|
+
export declare const ADAPTER_CACHE_HIT_DURATION_METRIC_NAME = "cache-hit-duration";
|
|
3
|
+
export declare const ADAPTER_CACHE_HIT_L2_COUNT_METRIC_NAME = "cache-hit-l2-count";
|
|
4
|
+
export declare const ADAPTER_CACHE_HIT_L2_DURATION_METRIC_NAME = "cache-hit-l2-duration";
|
|
5
|
+
export declare const ADAPTER_CACHE_MISS_COUNT_METRIC_NAME = "cache-miss-count";
|
|
6
|
+
export declare const ADAPTER_CACHE_MISS_DURATION_METRIC_NAME = "cache-miss-duration";
|
|
7
|
+
export declare const ADAPTER_CACHE_MISS_OUT_OF_TTL_COUNT_METRIC_NAME = "cache-miss-out-of-ttl-count";
|
|
8
|
+
export declare const ADAPTER_CACHE_MISS_OUT_OF_TTL_DURATION_METRIC_NAME = "cache-miss-out-of-ttl-duration";
|
|
9
|
+
export declare const REPRESENTATION_CACHE_MISS_OUT_OF_TTL_DATA_CHANGED_COUNT_METRIC_NAME = "cache-miss-out-of-ttl-data-changed-count";
|
|
10
|
+
export declare const REPRESENTATION_CACHE_MISS_OUT_OF_TTL_DATA_UNCHANGED_COUNT_METRIC_NAME = "cache-miss-out-of-ttl-data-unchanged-count";
|
|
11
|
+
export declare const REPRESENTATION_CACHE_MISS_OUT_OF_TTL_DATA_CHANGED_DURATION_METRIC_NAME = "cache-miss-out-of-ttl-data-changed-duration";
|
|
12
|
+
export declare const REPRESENTATION_CACHE_MISS_OUT_OF_TTL_DATA_UNCHANGED_DURATION_METRIC_NAME = "cache-miss-out-of-ttl-data-unchanged-duration";
|
|
13
|
+
/**
|
|
14
|
+
* W-8121791
|
|
15
|
+
* Number of subqueries used when aggregateUi is invoked for getRecord
|
|
16
|
+
*/
|
|
17
|
+
export declare const AGGREGATE_UI_CHUNK_COUNT = "aggregate-ui-chunk-count";
|
|
18
|
+
/**
|
|
19
|
+
* W-6981216
|
|
20
|
+
* Counter for overall LDS cache hits.
|
|
21
|
+
* Note: This is also being recorded in AILTN logging.
|
|
22
|
+
*/
|
|
23
|
+
export declare const CACHE_HIT_COUNT = "cache-hit-count";
|
|
24
|
+
/**
|
|
25
|
+
* W-6981216
|
|
26
|
+
* Counter for overall LDS cache hits.
|
|
27
|
+
* Note: This is also being recorded in AILTN logging.
|
|
28
|
+
*/
|
|
29
|
+
export declare const CACHE_MISS_COUNT = "cache-miss-count";
|
|
30
|
+
/**
|
|
31
|
+
* W-9949353
|
|
32
|
+
* Used to track how often we dedupe HTTP requests
|
|
33
|
+
* Invoked when an HTTP request is deduped against an already in-flight request
|
|
34
|
+
*/
|
|
35
|
+
export declare const DUPLICATE_REQUEST_COUNT = "duplicate-request-count";
|
|
36
|
+
/**
|
|
37
|
+
* W-7667066
|
|
38
|
+
* This count represents the number of times getRecord() was invoked, but not including
|
|
39
|
+
* executeAggregateUi calls. It can be represented as the sum of the Aura Action invocations
|
|
40
|
+
* GetRecordWithLayouts and GetRecordWithFields.
|
|
41
|
+
*/
|
|
42
|
+
export declare const GET_RECORD_NORMAL_INVOKE_COUNT = "get-record-normal-invoke-count";
|
|
43
|
+
/**
|
|
44
|
+
* W-7667066
|
|
45
|
+
* This count represents the number of times getRecord() was invoked, with a large enough payload
|
|
46
|
+
* that executeAggregateUi was used.
|
|
47
|
+
*/
|
|
48
|
+
export declare const GET_RECORD_AGGREGATE_INVOKE_COUNT = "get-record-aggregate-invoke-count";
|
|
49
|
+
/**
|
|
50
|
+
* W-7301684
|
|
51
|
+
* Counter for when getRecordNotifyChange api calls are allowed through.
|
|
52
|
+
*/
|
|
53
|
+
export declare const GET_RECORD_NOTIFY_CHANGE_ALLOW_COUNT = "get-record-notify-change-allow-count";
|
|
54
|
+
/**
|
|
55
|
+
* W-7301684
|
|
56
|
+
* Counter for when getRecordNotifyChange api calls are dropped/throttled.
|
|
57
|
+
*/
|
|
58
|
+
export declare const GET_RECORD_NOTIFY_CHANGE_DROP_COUNT = "get-record-notify-change-drop-count";
|
|
59
|
+
/**
|
|
60
|
+
* W-11118785
|
|
61
|
+
* Counter for when notifyRecordUpdateAvailable api calls are allowed through.
|
|
62
|
+
*/
|
|
63
|
+
export declare const NOTIFY_RECORD_UPDATE_AVAILABLE_ALLOW_COUNT = "notify-record-update-available-allow-count";
|
|
64
|
+
/**
|
|
65
|
+
* W-11118785
|
|
66
|
+
* Counter for when notifyRecordUpdateAvailable api calls are dropped/throttled.
|
|
67
|
+
*/
|
|
68
|
+
export declare const NOTIFY_RECORD_UPDATE_AVAILABLE_DROP_COUNT = "notify-record-update-available-drop-count";
|
|
69
|
+
/**
|
|
70
|
+
* W-8278006
|
|
71
|
+
* Counter for rate limiting telemetry. Is updated whenever the network adapter hits the specified limit.
|
|
72
|
+
*/
|
|
73
|
+
export declare const NETWORK_RATE_LIMIT_EXCEEDED_COUNT = "network-rate-limit-exceeded-count";
|
|
74
|
+
/**
|
|
75
|
+
* W-6981216
|
|
76
|
+
* Timer to measure performance for Luvio.storeBroadcast() method.
|
|
77
|
+
*/
|
|
78
|
+
export declare const STORE_BROADCAST_DURATION = "store-broadcast-duration";
|
|
79
|
+
/**
|
|
80
|
+
* W-6981216
|
|
81
|
+
* Timer to measure performance for Luvio.storeIngest() method.
|
|
82
|
+
*/
|
|
83
|
+
export declare const STORE_INGEST_DURATION = "store-ingest-duration";
|
|
84
|
+
/**
|
|
85
|
+
* W-6981216
|
|
86
|
+
* Timer to measure performance for Luvio.storeLookup() method.
|
|
87
|
+
*/
|
|
88
|
+
export declare const STORE_LOOKUP_DURATION = "store-lookup-duration";
|
|
89
|
+
/**
|
|
90
|
+
* W-9805009
|
|
91
|
+
* Timer to measure performance for Luvio.storeSetTTLOverride() method.
|
|
92
|
+
*/
|
|
93
|
+
export declare const STORE_SET_TTL_OVERRIDE_DURATION = "store-set-ttl-override-duration";
|
|
94
|
+
/**
|
|
95
|
+
* W-9805009
|
|
96
|
+
* Timer to measure performance for Luvio.storeSetDefaultTTLOverride() method.
|
|
97
|
+
*/
|
|
98
|
+
export declare const STORE_SET_DEFAULT_TTL_OVERRIDE_DURATION = "store-set-default-ttl-override-duration";
|
|
99
|
+
/**
|
|
100
|
+
* W-11118785
|
|
101
|
+
* Timer to measure performance for Luvio.notifyStoreUpdateAvailable() method.
|
|
102
|
+
*/
|
|
103
|
+
export declare const NOTIFY_STORE_UPDATE_AVAILABLE_DURATION = "notify-store-update-available-duration";
|
|
104
|
+
/**
|
|
105
|
+
* W-6981216
|
|
106
|
+
* Counter for number of records in LDS store. Is updated by periodicLogger invocations.
|
|
107
|
+
* Note: This is also being recorded in AILTN logging.
|
|
108
|
+
*/
|
|
109
|
+
export declare const STORE_SIZE_COUNT = "store-size-count";
|
|
110
|
+
/**
|
|
111
|
+
* W-6981216
|
|
112
|
+
* Counter for number of LDS snapshot subscription. Is updated by periodicLogger invocations.
|
|
113
|
+
* Note: This is also being recorded in AILTN logging.
|
|
114
|
+
*/
|
|
115
|
+
export declare const STORE_SNAPSHOT_SUBSCRIPTIONS_COUNT = "store-snapshot-subscriptions-count";
|
|
116
|
+
/**
|
|
117
|
+
* W-6981216
|
|
118
|
+
* Counter for number of LDS watch subscriptions. Is updated by periodicLogger invocations.
|
|
119
|
+
* Note: This is also being recorded in AILTN logging.
|
|
120
|
+
*/
|
|
121
|
+
export declare const STORE_WATCH_SUBSCRIPTIONS_COUNT = "store-watch-subscriptions-count";
|
|
122
|
+
/**
|
|
123
|
+
* W-9131128
|
|
124
|
+
* Counter for graphQL get adapter response with mixed bag of both data and error in response
|
|
125
|
+
*/
|
|
126
|
+
export declare const GET_GRAPHQL_RESPONSE_MIXED = "get-graphql-response-mixed-count";
|
|
127
|
+
/**
|
|
128
|
+
* W-9537401
|
|
129
|
+
* Counter for Luvio store trim task invocation
|
|
130
|
+
*/
|
|
131
|
+
export declare const STORE_TRIM_TASK_COUNT = "store-trim-task-count";
|
|
132
|
+
/**
|
|
133
|
+
* W-9537401
|
|
134
|
+
* Timer to measure performance for Luvio store trim task
|
|
135
|
+
*/
|
|
136
|
+
export declare const STORE_TRIM_TASK_DURATION = "store-trim-task-duration";
|
|
137
|
+
/**
|
|
138
|
+
* W-9804037
|
|
139
|
+
* Counters for Luvio cache policy usage
|
|
140
|
+
* Note: Undefined cache policy defaults to different cache policies based on runtime
|
|
141
|
+
*/
|
|
142
|
+
export declare const CACHE_POLICY_COUNTERS: {
|
|
143
|
+
'cache-and-network': string;
|
|
144
|
+
'cache-then-network': string;
|
|
145
|
+
'no-cache': string;
|
|
146
|
+
'only-if-cached': string;
|
|
147
|
+
'stale-while-revalidate': string;
|
|
148
|
+
'valid-at': string;
|
|
149
|
+
};
|
|
150
|
+
export declare const CACHE_POLICY_UNDEFINED_COUNTER = "cache-policy-undefined";
|
|
151
|
+
export declare const STALE_TAG = "stale";
|
|
152
|
+
/**
|
|
153
|
+
* W-9804037
|
|
154
|
+
* Durable Store health metric
|
|
155
|
+
* Counter to track Durable Store read, write and error rates
|
|
156
|
+
*/
|
|
157
|
+
export declare const DURABLE_STORE_COUNT = "durable-store-count";
|
|
158
|
+
/**
|
|
159
|
+
* W-10490363
|
|
160
|
+
* GraphQL Eval health metric
|
|
161
|
+
* Counter to track Success and Error Rate on Eval
|
|
162
|
+
*/
|
|
163
|
+
export declare const GRAPHQL_ADAPTER_COUNT = "graphql-adapter-count";
|
|
164
|
+
/**
|
|
165
|
+
* Counter for tracking invalid record type IDs
|
|
166
|
+
*/
|
|
167
|
+
export declare const RECORD_TYPE_ID_IS_NULL_COUNT = "record-type-id-is-null-count";
|
|
168
|
+
/**
|
|
169
|
+
* W-12293528
|
|
170
|
+
* GraphQL health metric
|
|
171
|
+
* Counter to track size of the top-level GraphQL object
|
|
172
|
+
*/
|
|
173
|
+
export declare const STORE_GRAPHQL_SIZE_COUNT = "store-graphql-size-count";
|
|
174
|
+
/**
|
|
175
|
+
* W-12293528
|
|
176
|
+
* GraphQL health metric
|
|
177
|
+
* Counter to track validation errors in query
|
|
178
|
+
*/
|
|
179
|
+
export declare const GRAPHQL_QUERY_VALIDATION_ERROR_COUNT = "graphql-query-validation-error-count";
|
|
180
|
+
/**
|
|
181
|
+
* W-12293528
|
|
182
|
+
* GraphQL health metric
|
|
183
|
+
* Counter to track syntax errors in query
|
|
184
|
+
*/
|
|
185
|
+
export declare const GRAPHQL_QUERY_SYNTAX_ERROR_COUNT = "graphql-query-syntax-error-count";
|
|
186
|
+
/**
|
|
187
|
+
* W-12293528
|
|
188
|
+
* GraphQL health metric
|
|
189
|
+
* Counter to track miscellaneous errors in query
|
|
190
|
+
*/
|
|
191
|
+
export declare const GRAPHQL_QUERY_OTHER_ERROR_COUNT = "graphql-query-other-error-count";
|
|
192
|
+
/**
|
|
193
|
+
* W-12025795
|
|
194
|
+
* GraphQL metric
|
|
195
|
+
* Counter to track usage of legacy adapter
|
|
196
|
+
*/
|
|
197
|
+
export declare const GRAPHQL_LEGACY_ADAPTER_USAGE_COUNT = "graphql-legacy-adapter-usage-count";
|
|
198
|
+
/**
|
|
199
|
+
* W-12025795
|
|
200
|
+
* GraphQL metric
|
|
201
|
+
* Counter to track errors in usage of legacy adapter
|
|
202
|
+
*/
|
|
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";
|
|
216
|
+
/**
|
|
217
|
+
* W-18777099
|
|
218
|
+
* Prefetch Using State Managers Activity Tracking
|
|
219
|
+
* Activity name to track errors from prefetch data for top entities using state managers
|
|
220
|
+
*/
|
|
221
|
+
export declare const PREFETCH_USING_STATE_MANAGERS = "prefetch-using-state-managers";
|
|
222
|
+
/**
|
|
223
|
+
* W-18812516
|
|
224
|
+
* State Manager metric
|
|
225
|
+
* Counter to track number of state managers created
|
|
226
|
+
*/
|
|
227
|
+
export declare const STATE_CREATED_COUNT = "state-created-count";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare const create: {
|
|
2
|
+
(o: object | null): any;
|
|
3
|
+
(o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
|
|
4
|
+
}, keys: {
|
|
5
|
+
(o: object): string[];
|
|
6
|
+
(o: {}): string[];
|
|
7
|
+
};
|
|
8
|
+
declare const isArray: (arg: any) => arg is any[];
|
|
9
|
+
declare const parse: (text: string, reviver?: ((this: any, key: string, value: any) => any) | undefined) => any, stringify: {
|
|
10
|
+
(value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string;
|
|
11
|
+
(value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string;
|
|
12
|
+
};
|
|
13
|
+
export { create as ObjectCreate, keys as ObjectKeys, isArray as ArrayIsArray, stringify as JSONStringify, parse as JSONParse, };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inspired by https://www.npmjs.com/package/hashlru
|
|
3
|
+
*/
|
|
4
|
+
export declare class LRUCache {
|
|
5
|
+
private oldCache;
|
|
6
|
+
private newCache;
|
|
7
|
+
private size;
|
|
8
|
+
private limit;
|
|
9
|
+
constructor(limit: number);
|
|
10
|
+
private checkSize;
|
|
11
|
+
get(key: string): any;
|
|
12
|
+
set(key: string, value: any): void;
|
|
13
|
+
delete(key: string): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observability / Critical Availability Program (230+)
|
|
3
|
+
*
|
|
4
|
+
* This file is intended to be used as a consolidated place for all definitions, functions,
|
|
5
|
+
* and helpers related to "M1"[1].
|
|
6
|
+
*
|
|
7
|
+
* Below are the R.E.A.D.S. metrics for the Lightning Data Service, defined here[2].
|
|
8
|
+
*
|
|
9
|
+
* [1] Search "[M1] Lightning Data Service Design Spike" in Quip
|
|
10
|
+
* [2] Search "Lightning Data Service R.E.A.D.S. Metrics" in Quip
|
|
11
|
+
*/
|
|
12
|
+
export declare const OBSERVABILITY_NAMESPACE = "LIGHTNING.lds.service";
|
|
13
|
+
export declare const ADAPTER_INVOCATION_COUNT_METRIC_NAME = "request";
|
|
14
|
+
export declare const ADAPTER_ERROR_COUNT_METRIC_NAME = "error";
|
|
15
|
+
/**
|
|
16
|
+
* W-8828410
|
|
17
|
+
* Counter for the number of UnfulfilledSnapshotErrors the luvio engine has.
|
|
18
|
+
*/
|
|
19
|
+
export declare const TOTAL_ADAPTER_ERROR_COUNT = "error";
|
|
20
|
+
/**
|
|
21
|
+
* W-8828410
|
|
22
|
+
* Counter for the number of invocations made into LDS by a wire adapter.
|
|
23
|
+
*/
|
|
24
|
+
export declare const TOTAL_ADAPTER_REQUEST_SUCCESS_COUNT = "request";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A deterministic JSON stringify implementation. Heavily adapted from https://github.com/epoberezkin/fast-json-stable-stringify.
|
|
3
|
+
* This is needed because insertion order for JSON.stringify(object) affects output:
|
|
4
|
+
* JSON.stringify({a: 1, b: 2})
|
|
5
|
+
* "{"a":1,"b":2}"
|
|
6
|
+
* JSON.stringify({b: 2, a: 1})
|
|
7
|
+
* "{"b":2,"a":1}"
|
|
8
|
+
* Modified from the apex implementation to sort arrays non-destructively.
|
|
9
|
+
* @param data Data to be JSON-stringified.
|
|
10
|
+
* @returns JSON.stringified value with consistent ordering of keys.
|
|
11
|
+
*/
|
|
12
|
+
export declare function stableJSONStringify(node: any): string | undefined;
|
|
13
|
+
export declare function isPromise<D>(value: D | Promise<D> | null): value is Promise<D>;
|
|
14
|
+
export declare function isAdapterError(error: unknown): boolean;
|
|
15
|
+
export declare function throttle(callback: () => void, ms: number): () => void;
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@salesforce/lds-instrumentation",
|
|
3
|
+
"version": "0.1.0-dev1",
|
|
4
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
|
+
"description": "Instrumentation utils for Lightning Data Service",
|
|
6
|
+
"main": "dist/ldsInstrumentation.js",
|
|
7
|
+
"module": "dist/ldsInstrumentation.js",
|
|
8
|
+
"types": "dist/types/main.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/types/main.d.ts",
|
|
15
|
+
"import": "./dist/ldsInstrumentation.js",
|
|
16
|
+
"default": "./dist/ldsInstrumentation.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"sfdc": {
|
|
20
|
+
"path": "forcelds/ldsInstrumentation/",
|
|
21
|
+
"publishedFileName": "ldsInstrumentation.js",
|
|
22
|
+
"overrides": {
|
|
23
|
+
"artifactDirectory": "dist"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"prepare": "yarn build",
|
|
28
|
+
"build": "rollup --bundleConfigAsCjs --config rollup.config.js",
|
|
29
|
+
"clean": "rm -rf dist",
|
|
30
|
+
"test:unit": "jest",
|
|
31
|
+
"test:debug": "node --inspect-brk ../../node_modules/.bin/jest --runInBand",
|
|
32
|
+
"test:size": "luvioBundlesize",
|
|
33
|
+
"release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-instrumentation"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@salesforce/lds-bindings": "^0.1.0-dev1",
|
|
37
|
+
"@salesforce/lds-default-luvio": "^0.1.0-dev1",
|
|
38
|
+
"@salesforce/lds-utils-adapters": "^0.1.0-dev1",
|
|
39
|
+
"o11y": "250.7.0",
|
|
40
|
+
"o11y_schema": "256.126.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@salesforce/lds-adapters-uiapi": "^0.1.0-dev1",
|
|
44
|
+
"@salesforce/lds-network-adapter": "^0.1.0-dev1",
|
|
45
|
+
"@salesforce/nimbus-plugin-lds": "^0.1.0-dev1"
|
|
46
|
+
},
|
|
47
|
+
"luvioBundlesize": [
|
|
48
|
+
{
|
|
49
|
+
"path": "./dist/ldsInstrumentation.js",
|
|
50
|
+
"maxSize": {
|
|
51
|
+
"none": "64 kB",
|
|
52
|
+
"min": "27.2 kB",
|
|
53
|
+
"compressed": "12 kB"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"volta": {
|
|
58
|
+
"extends": "../../package.json"
|
|
59
|
+
}
|
|
60
|
+
}
|