@launchdarkly/o11y 1.3.1 → 1.4.1
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/CHANGELOG.md +22 -0
- package/dist/LDObserve-BQr7RYVC.js +130 -0
- package/dist/LDObserve-BQr7RYVC.js.map +1 -0
- package/dist/LDObserve.d.ts +73 -1
- package/dist/LDObserve.js +2 -2
- package/dist/LDRecord.d.ts +73 -1
- package/dist/LDRecord.js +43 -24
- package/dist/LDRecord.js.map +1 -1
- package/dist/buffer-CwCRPuMA.js +248 -0
- package/dist/buffer-CwCRPuMA.js.map +1 -0
- package/dist/{common-BjaGmQrE.js → common-D8kkCWo3.js} +721 -689
- package/dist/{common-BjaGmQrE.js.map → common-D8kkCWo3.js.map} +1 -1
- package/dist/index.d.ts +103 -5
- package/dist/index.js +335 -365
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +112 -112
- package/dist/index.umd.js.map +1 -1
- package/dist/{observe-D78YYNE1.js → observe-BCebRa17.js} +2055 -2044
- package/dist/{observe-D78YYNE1.js.map → observe-BCebRa17.js.map} +1 -1
- package/dist/observe.d.ts +21 -1
- package/dist/observe.js +4 -4
- package/dist/{record-BZHDLKsW.js → record-DG2IcHxO.js} +38 -47
- package/dist/{record-BZHDLKsW.js.map → record-DG2IcHxO.js.map} +1 -1
- package/dist/record.d.ts +24 -2
- package/dist/record.js +3 -3
- package/package.json +1 -1
- package/dist/LDObserve-DhF3vCDR.js +0 -92
- package/dist/LDObserve-DhF3vCDR.js.map +0 -1
- package/dist/buffer-BjzLorpP.js +0 -124
- package/dist/buffer-BjzLorpP.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -104,15 +104,80 @@ declare type AttributeValue = string | number | boolean | Array<null | undefined
|
|
|
104
104
|
|
|
105
105
|
declare class BufferedClass<T extends object> {
|
|
106
106
|
protected _sdk: T;
|
|
107
|
+
/** True once an SDK instance has been attached via `load`. */
|
|
107
108
|
protected _isLoaded: boolean;
|
|
109
|
+
/** True once the attached SDK has started and the buffer has drained. */
|
|
110
|
+
protected _isReady: boolean;
|
|
108
111
|
protected _callBuffer: Array<Event_2>;
|
|
109
112
|
protected _capacity: number;
|
|
110
113
|
protected _droppedEvents: number;
|
|
111
114
|
protected _exceededCapacity: boolean;
|
|
112
115
|
protected _logger: Logger;
|
|
116
|
+
private _pendingStart?;
|
|
117
|
+
/**
|
|
118
|
+
* The last start or stop queued on the attached SDK while it runs. Starts
|
|
119
|
+
* and stops run in call order, so the final state follows the last call.
|
|
120
|
+
*/
|
|
121
|
+
private _lastOp?;
|
|
113
122
|
protected _bufferCall(method: string, args: any[]): any;
|
|
123
|
+
/** Calls the attached SDK directly, logging instead of throwing. */
|
|
124
|
+
protected _callSdk(method: string, args: any[]): any;
|
|
114
125
|
protected _enqueue(event: Event_2): void;
|
|
115
|
-
|
|
126
|
+
/**
|
|
127
|
+
* Attach an SDK implementation. With `ready: false` (e.g. `manualStart`
|
|
128
|
+
* mode, or an SDK whose `start` is still running), telemetry keeps
|
|
129
|
+
* buffering until `markReady()` is called.
|
|
130
|
+
*/
|
|
131
|
+
load(sdk: T, { ready, started }?: BufferedLoadOptions): void;
|
|
132
|
+
private _runPendingStart;
|
|
133
|
+
/**
|
|
134
|
+
* Starts the attached SDK and drains the buffer. Before `load` the start
|
|
135
|
+
* is deferred. Starts and stops run in call order: a start made while a
|
|
136
|
+
* stop is queued runs after that stop, while overlapping starts with no
|
|
137
|
+
* stop between them share one SDK start.
|
|
138
|
+
*/
|
|
139
|
+
protected _start(): Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* Stops the attached SDK. Before `load` it cancels a deferred start. Once
|
|
142
|
+
* attached, every stop is queued: it waits for an earlier start or stop,
|
|
143
|
+
* and a later start waits for the SDK's stop (including any async
|
|
144
|
+
* shutdown) to finish. Errors are logged rather than thrown.
|
|
145
|
+
*/
|
|
146
|
+
protected _stop(stopSdk: () => unknown): Promise<void>;
|
|
147
|
+
/** Runs `op` once the previously queued start or stop has settled. */
|
|
148
|
+
private _queueOp;
|
|
149
|
+
/**
|
|
150
|
+
* Starts the attached SDK. Subclasses whose SDK owns a `start` method
|
|
151
|
+
* override this so a deferred start reaches the real implementation.
|
|
152
|
+
*/
|
|
153
|
+
protected _startSdk(): Promise<void>;
|
|
154
|
+
/**
|
|
155
|
+
* Drains the buffered calls into the attached SDK and lets subsequent
|
|
156
|
+
* calls run directly.
|
|
157
|
+
*/
|
|
158
|
+
protected markReady(): void;
|
|
159
|
+
/**
|
|
160
|
+
* Defers a start until `load` attaches an SDK. Returns a promise that
|
|
161
|
+
* resolves once the SDK has been attached, started and drained.
|
|
162
|
+
*/
|
|
163
|
+
protected _deferStart(): Promise<void>;
|
|
164
|
+
/** Cancels a deferred start so it never runs; awaiting callers resolve. */
|
|
165
|
+
protected _cancelPendingStart(): void;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
declare interface BufferedLoadOptions {
|
|
169
|
+
/**
|
|
170
|
+
* Whether the attached SDK has already been started.
|
|
171
|
+
* When `false` (e.g. `manualStart` mode), calls keep buffering until the
|
|
172
|
+
* SDK is started; a `start()` made before `load` runs at `load` time.
|
|
173
|
+
*/
|
|
174
|
+
ready?: boolean;
|
|
175
|
+
/**
|
|
176
|
+
* With `ready: true`, the attached SDK's own start while it is still
|
|
177
|
+
* running. It is queued like a `start()`, so a `stop()` made meanwhile
|
|
178
|
+
* waits for it instead of being undone by it.
|
|
179
|
+
*/
|
|
180
|
+
started?: Promise<unknown>;
|
|
116
181
|
}
|
|
117
182
|
|
|
118
183
|
declare type CanvasArg = SerializedCanvasArg | string | number | boolean | null | CanvasArg[];
|
|
@@ -180,14 +245,29 @@ declare type CommonOptions = {
|
|
|
180
245
|
*/
|
|
181
246
|
storageMode?: 'sessionStorage' | 'localStorage';
|
|
182
247
|
/**
|
|
183
|
-
* By default, session data is stored in the `
|
|
248
|
+
* By default, session data is stored in the `localStorage` of the browser.
|
|
184
249
|
* Set to `true` to store session data in a cookie instead.
|
|
185
250
|
* This can help with compliance for cookie-consent regulation.
|
|
186
251
|
*/
|
|
187
252
|
sessionCookie?: boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Set the `Domain` attribute of the session cookie so the same session can
|
|
255
|
+
* be continued on different subdomains (e.g. `app.example.com` and
|
|
256
|
+
* `checkout.example.com` both see a cookie set for `example.com`).
|
|
257
|
+
* Only applies when `sessionCookie` is set to `true`.
|
|
258
|
+
* By default, the cookie is scoped to the exact host that created it.
|
|
259
|
+
*/
|
|
260
|
+
sessionCookieDomain?: string;
|
|
188
261
|
/**
|
|
189
262
|
* Specifies if Highlight should not automatically initialize when the class is created.
|
|
190
263
|
* This should be used with `.start()` and `.stop()` if you want to control when Highlight records.
|
|
264
|
+
*
|
|
265
|
+
* While `start()` has not been called, calls that can be deferred (logs,
|
|
266
|
+
* errors, metrics, `track`) are kept in memory and delivered once
|
|
267
|
+
* `start()` runs. `start()` and `stop()` can safely be called before the
|
|
268
|
+
* SDK has initialized: a start made too early resolves once the SDK is
|
|
269
|
+
* attached. Calls that cannot be deferred (synchronous span callbacks) run
|
|
270
|
+
* their callback on a no-op span while the SDK is not started.
|
|
191
271
|
* @default false
|
|
192
272
|
*/
|
|
193
273
|
manualStart?: boolean;
|
|
@@ -597,7 +677,8 @@ declare class Highlight_2 {
|
|
|
597
677
|
getCurrentSessionURLWithTimestamp(): string;
|
|
598
678
|
getCurrentSessionURL(): string | null;
|
|
599
679
|
snapshot(element: HTMLCanvasElement): Promise<void>;
|
|
600
|
-
|
|
680
|
+
/** @deprecated Session feedback is no longer supported. This is a no-op. */
|
|
681
|
+
addSessionFeedback(_feedback: {
|
|
601
682
|
verbatim: string;
|
|
602
683
|
timestamp: string;
|
|
603
684
|
user_name?: string;
|
|
@@ -658,6 +739,7 @@ declare type HighlightClassOptions = {
|
|
|
658
739
|
sessionSecureID: string;
|
|
659
740
|
storageMode?: 'sessionStorage' | 'localStorage';
|
|
660
741
|
sessionCookie?: boolean;
|
|
742
|
+
sessionCookieDomain?: string;
|
|
661
743
|
sendMode?: 'webworker' | 'local';
|
|
662
744
|
otlpEndpoint?: HighlightOptions['otlpEndpoint'];
|
|
663
745
|
otel?: HighlightOptions['otel'];
|
|
@@ -1008,7 +1090,8 @@ declare interface HighlightPublicInterface {
|
|
|
1008
1090
|
getRecordingState: () => 'NotRecording' | 'Recording';
|
|
1009
1091
|
options: HighlightOptions | undefined;
|
|
1010
1092
|
/**
|
|
1011
|
-
*
|
|
1093
|
+
* @deprecated Session feedback is no longer supported. This is a no-op and
|
|
1094
|
+
* will be removed in a future major version.
|
|
1012
1095
|
*/
|
|
1013
1096
|
addSessionFeedback: (feedbackOptions: SessionFeedbackOptions) => void;
|
|
1014
1097
|
snapshot: (element: HTMLCanvasElement) => Promise<void>;
|
|
@@ -1157,6 +1240,7 @@ declare interface LDClientMin {
|
|
|
1157
1240
|
export declare let LDObserve: _LDObserve;
|
|
1158
1241
|
|
|
1159
1242
|
declare class _LDObserve extends BufferedClass<Observe_2> implements Observe_2 {
|
|
1243
|
+
protected _startSdk(): Promise<void>;
|
|
1160
1244
|
start(): Promise<void>;
|
|
1161
1245
|
stop(): Promise<void>;
|
|
1162
1246
|
recordGauge(metric: OTelMetric): any;
|
|
@@ -1166,6 +1250,7 @@ declare class _LDObserve extends BufferedClass<Observe_2> implements Observe_2 {
|
|
|
1166
1250
|
recordUpDownCounter(metric: OTelMetric): any;
|
|
1167
1251
|
startSpan(name: string, options: SpanOptions | ((span?: Span) => any), context?: Context | ((span?: Span) => any), fn?: (span?: Span) => any): any;
|
|
1168
1252
|
startManualSpan(name: string, options: SpanOptions | ((span: Span) => any), context?: Context | ((span: Span) => any), fn?: (span: Span) => any): any;
|
|
1253
|
+
private _logNoopSpanWarning;
|
|
1169
1254
|
register(client: LDClientMin, environmentMetadata: LDPluginEnvironmentMetadata): any;
|
|
1170
1255
|
recordLog(message: any, level: ConsoleMethods, metadata?: Attributes): any;
|
|
1171
1256
|
recordError(error: Error, message?: string, payload?: {
|
|
@@ -1184,7 +1269,9 @@ declare interface LDPlugin {
|
|
|
1184
1269
|
export declare let LDRecord: _LDRecord;
|
|
1185
1270
|
|
|
1186
1271
|
declare class _LDRecord extends BufferedClass<Record_3> implements Record_3 {
|
|
1272
|
+
private _deferredStartOptions?;
|
|
1187
1273
|
getSession(): SessionDetails | null;
|
|
1274
|
+
protected _startSdk(): Promise<void>;
|
|
1188
1275
|
start(options?: StartOptions): Promise<void>;
|
|
1189
1276
|
stop(): void;
|
|
1190
1277
|
addSessionProperties(properties: {
|
|
@@ -1543,10 +1630,15 @@ export declare class Observe extends Plugin_2<ObserveOptions> implements LDPlugi
|
|
|
1543
1630
|
declare interface Observe_2 {
|
|
1544
1631
|
/**
|
|
1545
1632
|
* Start the observability data capture when running in `manualStart` mode.
|
|
1633
|
+
* Can safely be called before the SDK has initialized (e.g. before the
|
|
1634
|
+
* plugin registers): the call resolves once the SDK is attached and
|
|
1635
|
+
* started, without throwing.
|
|
1546
1636
|
*/
|
|
1547
1637
|
start: () => Promise<void>;
|
|
1548
1638
|
/**
|
|
1549
1639
|
* Stop the observability data capture.
|
|
1640
|
+
* Can safely be called before the SDK has initialized; before `start()`
|
|
1641
|
+
* it cancels a pending start instead of throwing.
|
|
1550
1642
|
*/
|
|
1551
1643
|
stop: () => Promise<void>;
|
|
1552
1644
|
/**
|
|
@@ -1879,11 +1971,16 @@ declare interface Record_3 {
|
|
|
1879
1971
|
/**
|
|
1880
1972
|
* Start the session when running in `manualStart` mode.
|
|
1881
1973
|
* Can be used to force start a new session.
|
|
1974
|
+
* Can safely be called before the SDK has initialized (e.g. before the
|
|
1975
|
+
* plugin registers): the call resolves once the SDK is attached and
|
|
1976
|
+
* started, without throwing.
|
|
1882
1977
|
* @param options the session start options.
|
|
1883
1978
|
*/
|
|
1884
1979
|
start: (options?: StartOptions) => Promise<void>;
|
|
1885
1980
|
/**
|
|
1886
1981
|
* Stop the session recording.
|
|
1982
|
+
* Can safely be called before the SDK has initialized; before `start()`
|
|
1983
|
+
* it cancels a pending start instead of throwing.
|
|
1887
1984
|
*/
|
|
1888
1985
|
stop: () => void;
|
|
1889
1986
|
/**
|
|
@@ -2139,7 +2236,8 @@ declare class RecordSDK implements Record_3 {
|
|
|
2139
2236
|
getCurrentSessionURLWithTimestamp(): string;
|
|
2140
2237
|
getCurrentSessionURL(): string | null;
|
|
2141
2238
|
snapshot(element: HTMLCanvasElement): Promise<void>;
|
|
2142
|
-
|
|
2239
|
+
/** @deprecated Session feedback is no longer supported. This is a no-op. */
|
|
2240
|
+
addSessionFeedback(_feedback: {
|
|
2143
2241
|
verbatim: string;
|
|
2144
2242
|
timestamp: string;
|
|
2145
2243
|
user_name?: string;
|