@salesforce/lds-instrumentation 1.140.0 → 1.141.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 +24 -3
- package/dist/types/main.d.ts +12 -1
- package/package.json +2 -2
|
@@ -927,6 +927,27 @@ function logAdapterCacheMissOutOfTtlDuration(name, config, currentCacheMissTimes
|
|
|
927
927
|
}
|
|
928
928
|
}
|
|
929
929
|
}
|
|
930
|
+
/**
|
|
931
|
+
* Starts an o11y Activity using the supplied o11y Instrumention and adapterName.
|
|
932
|
+
* If a requestContext is supplied, we check for the existence of a requestCorrelator containing an ObservabilityContext.
|
|
933
|
+
* If an ObservabilityContext is defined, we build an object that conforms to the ApiOptions interface required by the startActivity API
|
|
934
|
+
*/
|
|
935
|
+
function startAdapterActivity(instrumentation, adapterName, requestContext) {
|
|
936
|
+
if (requestContext === undefined ||
|
|
937
|
+
requestContext.requestCorrelator === undefined ||
|
|
938
|
+
requestContext.requestCorrelator.observabilityContext === undefined) {
|
|
939
|
+
return instrumentation.startActivity(adapterName);
|
|
940
|
+
}
|
|
941
|
+
const { traceId, ...rest } = requestContext.requestCorrelator
|
|
942
|
+
.observabilityContext;
|
|
943
|
+
const apiOptions = {
|
|
944
|
+
instrumentationContext: rest,
|
|
945
|
+
};
|
|
946
|
+
if (traceId !== undefined) {
|
|
947
|
+
apiOptions.instrumentationContext.parentId = traceId;
|
|
948
|
+
}
|
|
949
|
+
return instrumentation.startActivity(adapterName, apiOptions);
|
|
950
|
+
}
|
|
930
951
|
function instrumentAdapter(adapter, metadata, adapterInstrumentationOptions) {
|
|
931
952
|
const { apiFamily, name, ttl } = metadata;
|
|
932
953
|
let trackL1Hits = false;
|
|
@@ -986,7 +1007,7 @@ function instrumentAdapter(adapter, metadata, adapterInstrumentationOptions) {
|
|
|
986
1007
|
// increment cache policy metrics
|
|
987
1008
|
incrementAdapterCachePolicyType(requestContext);
|
|
988
1009
|
// start collecting
|
|
989
|
-
const activity = ldsInstrumentation
|
|
1010
|
+
const activity = startAdapterActivity(ldsInstrumentation, adapterName, requestContext);
|
|
990
1011
|
return runAdapterWithReport(metadata.name, adapter, config, requestContext || {}, (report) => {
|
|
991
1012
|
const { executionTime } = report;
|
|
992
1013
|
switch (report.result) {
|
|
@@ -1427,5 +1448,5 @@ function setStoreEventObservers(store) {
|
|
|
1427
1448
|
}
|
|
1428
1449
|
const instrumentation = new Instrumentation();
|
|
1429
1450
|
|
|
1430
|
-
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, updatePercentileHistogramMetric };
|
|
1431
|
-
// version: 1.
|
|
1451
|
+
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.141.0-f0b9250ae
|
package/dist/types/main.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { Luvio, InMemoryStore, Adapter, CacheMissOutOfTtlEvent, DataOutOfTtlDurationUpdateEvent } from '@luvio/engine';
|
|
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
3
|
import type { Registration as LdsUiapiRegistration } from '@salesforce/lds-adapters-uiapi';
|
|
3
4
|
import type { Registration as LdsNetworkAdapterRegistration } from '@salesforce/lds-network-adapter';
|
|
4
5
|
import type { AdapterReport } from '@salesforce/lds-utils-adapters';
|
|
6
|
+
import type { ObservabilityContext } from '@salesforce/nimbus-plugin-lds';
|
|
5
7
|
export * as METRIC_KEYS from './metric-keys';
|
|
6
8
|
export { LRUCache } from './utils/lru-cache';
|
|
7
9
|
interface AdapterMetadata {
|
|
@@ -28,6 +30,15 @@ interface AdapterInstrumentationOptions {
|
|
|
28
30
|
trackL2Hits: boolean;
|
|
29
31
|
reportObserver?: ReportObserver;
|
|
30
32
|
}
|
|
33
|
+
export interface RequestCorrelator {
|
|
34
|
+
observabilityContext?: ObservabilityContext;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Starts an o11y Activity using the supplied o11y Instrumention and adapterName.
|
|
38
|
+
* If a requestContext is supplied, we check for the existence of a requestCorrelator containing an ObservabilityContext.
|
|
39
|
+
* If an ObservabilityContext is defined, we build an object that conforms to the ApiOptions interface required by the startActivity API
|
|
40
|
+
*/
|
|
41
|
+
export declare function startAdapterActivity(instrumentation: o11yInstrumentation, adapterName: string, requestContext?: AdapterRequestContext): Activity;
|
|
31
42
|
export declare function instrumentAdapter<C, D>(adapter: Adapter<C, D>, metadata: AdapterMetadata, adapterInstrumentationOptions?: AdapterInstrumentationOptions): Adapter<C, D>;
|
|
32
43
|
/**
|
|
33
44
|
* Wraps methods to collect runtime performance using o11y's trackValue API
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-instrumentation",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.141.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "Instrumentation utils for Lightning Data Service",
|
|
6
6
|
"main": "dist/ldsInstrumentation.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"path": "./dist/ldsInstrumentation.js",
|
|
49
49
|
"maxSize": {
|
|
50
50
|
"none": "60 kB",
|
|
51
|
-
"min": "
|
|
51
|
+
"min": "26 kB",
|
|
52
52
|
"compressed": "11 kB"
|
|
53
53
|
}
|
|
54
54
|
}
|