@logbrew/sdk 0.1.3 → 0.1.4
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/README.md +336 -2
- package/examples/real-user-smoke.cjs +15 -1
- package/examples/real-user-smoke.mjs +15 -1
- package/index.cjs +1358 -28
- package/index.d.cts +461 -6
- package/index.d.ts +461 -6
- package/index.js +13 -0
- package/issue-stack.cjs +149 -0
- package/opentelemetry.cjs +1080 -0
- package/package.json +28 -1
- package/release-artifacts-build.cjs +227 -0
- package/release-artifacts-common.js +82 -0
- package/release-artifacts-symbolication.js +550 -0
- package/release-artifacts-upload.js +380 -0
- package/release-artifacts.js +766 -0
- package/support-ticket.cjs +175 -0
- package/trace-context.cjs +217 -0
- package/vite-release-artifacts.cjs +152 -0
- package/vite-release-artifacts.d.cts +44 -0
- package/vite-release-artifacts.d.ts +44 -0
- package/vite-release-artifacts.js +6 -0
package/index.d.cts
CHANGED
|
@@ -18,6 +18,14 @@ export type TraceparentContext = {
|
|
|
18
18
|
sampled: boolean;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
+
/** Minimal active trace shape accepted by logger adapters for correlation metadata. */
|
|
22
|
+
export type LogCorrelationTraceContext = {
|
|
23
|
+
traceId: string;
|
|
24
|
+
spanId: string;
|
|
25
|
+
parentSpanId?: string;
|
|
26
|
+
sampled?: boolean;
|
|
27
|
+
};
|
|
28
|
+
|
|
21
29
|
/** Inputs for creating a W3C traceparent value from known trace/span ids. */
|
|
22
30
|
export type TraceparentInput = {
|
|
23
31
|
traceId: string;
|
|
@@ -25,13 +33,176 @@ export type TraceparentInput = {
|
|
|
25
33
|
traceFlags?: string;
|
|
26
34
|
};
|
|
27
35
|
|
|
36
|
+
/** Privacy-bounded W3C tracestate entry for explicit propagation. */
|
|
37
|
+
export type TracestateEntry = {
|
|
38
|
+
key: string;
|
|
39
|
+
value: string;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** W3C baggage entry for explicit propagation. */
|
|
43
|
+
export type BaggageEntry = {
|
|
44
|
+
key: string;
|
|
45
|
+
value: string;
|
|
46
|
+
properties?: string[];
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/** Inputs for creating an explicit W3C trace context header carrier. */
|
|
50
|
+
export type TraceContextInput = TraceparentInput & {
|
|
51
|
+
tracestate?: string | TracestateEntry[];
|
|
52
|
+
baggage?: string | BaggageEntry[];
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/** Minimal OpenTelemetry SpanContext-like shape copied by dependency-free bridge helpers. */
|
|
56
|
+
export type OpenTelemetrySpanContextLike = {
|
|
57
|
+
traceId?: unknown;
|
|
58
|
+
spanId?: unknown;
|
|
59
|
+
traceFlags?: unknown;
|
|
60
|
+
isValid?: boolean;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/** Minimal OpenTelemetry Span-like shape accepted by dependency-free bridge helpers. */
|
|
64
|
+
export type OpenTelemetrySpanLike = {
|
|
65
|
+
spanContext?: () => OpenTelemetrySpanContextLike | null | undefined;
|
|
66
|
+
getSpanContext?: () => OpenTelemetrySpanContextLike | null | undefined;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/** Minimal OpenTelemetry API-like shape used for the current active span helper. */
|
|
70
|
+
export type OpenTelemetryApiLike = {
|
|
71
|
+
trace?: {
|
|
72
|
+
getActiveSpan?: () => OpenTelemetrySpanLike | null | undefined;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/** OpenTelemetry high-resolution time tuple accepted by dependency-free ReadableSpan helpers. */
|
|
77
|
+
export type OpenTelemetryHrTimeLike = readonly [number, number];
|
|
78
|
+
|
|
79
|
+
/** Minimal OpenTelemetry event-like shape summarized from ended spans. */
|
|
80
|
+
export type OpenTelemetryTimedEventLike = {
|
|
81
|
+
name?: unknown;
|
|
82
|
+
time?: OpenTelemetryHrTimeLike | number | Date;
|
|
83
|
+
timestamp?: OpenTelemetryHrTimeLike | number | Date;
|
|
84
|
+
attributes?: Record<string, unknown>;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/** Minimal OpenTelemetry link-like shape summarized from ended spans. */
|
|
88
|
+
export type OpenTelemetrySpanLinkLike = {
|
|
89
|
+
context?: OpenTelemetrySpanContextLike | null | undefined;
|
|
90
|
+
spanContext?: OpenTelemetrySpanContextLike | null | undefined;
|
|
91
|
+
attributes?: Record<string, unknown>;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/** Minimal OpenTelemetry ReadableSpan-like shape accepted by dependency-free bridge helpers. */
|
|
95
|
+
export type OpenTelemetryReadableSpanLike = {
|
|
96
|
+
name?: unknown;
|
|
97
|
+
kind?: unknown;
|
|
98
|
+
spanContext?: () => OpenTelemetrySpanContextLike | null | undefined;
|
|
99
|
+
parentSpanContext?: OpenTelemetrySpanContextLike | null | undefined;
|
|
100
|
+
parentSpanId?: unknown;
|
|
101
|
+
startTime?: OpenTelemetryHrTimeLike | number | Date;
|
|
102
|
+
endTime?: OpenTelemetryHrTimeLike | number | Date;
|
|
103
|
+
duration?: OpenTelemetryHrTimeLike;
|
|
104
|
+
status?: { code?: unknown };
|
|
105
|
+
attributes?: Record<string, unknown>;
|
|
106
|
+
events?: OpenTelemetryTimedEventLike[];
|
|
107
|
+
links?: OpenTelemetrySpanLinkLike[];
|
|
108
|
+
resource?: { attributes?: Record<string, unknown> };
|
|
109
|
+
instrumentationScope?: { name?: unknown; version?: unknown };
|
|
110
|
+
droppedAttributesCount?: unknown;
|
|
111
|
+
droppedEventsCount?: unknown;
|
|
112
|
+
droppedLinksCount?: unknown;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/** Options for creating a LogBrew child trace from OpenTelemetry context. */
|
|
116
|
+
export type OpenTelemetryTraceContextOptions = {
|
|
117
|
+
spanId?: string;
|
|
118
|
+
spanIdFactory?: () => string;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/** Options for reading OpenTelemetry's current active span without requiring an OTel dependency. */
|
|
122
|
+
export type CurrentOpenTelemetryTraceContextOptions = OpenTelemetryTraceContextOptions & {
|
|
123
|
+
openTelemetryApi?: OpenTelemetryApiLike;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
/** Options for privacy-bounded OpenTelemetry ReadableSpan conversion. */
|
|
127
|
+
export type OpenTelemetryReadableSpanOptions = {
|
|
128
|
+
/** Additional safe span attribute keys to copy; sensitive keys remain blocked. */
|
|
129
|
+
attributeKeys?: string[];
|
|
130
|
+
/** Capture unsampled spans. Defaults to false to follow common OTel processor behavior. */
|
|
131
|
+
captureUnsampled?: boolean;
|
|
132
|
+
/** Additional safe span event attribute keys to copy; sensitive keys remain blocked. */
|
|
133
|
+
eventAttributeKeys?: string[];
|
|
134
|
+
/** Include privacy-bounded span event summaries. Defaults to true. */
|
|
135
|
+
includeSpanEvents?: boolean;
|
|
136
|
+
/** Include privacy-bounded span link summaries. Defaults to true. */
|
|
137
|
+
includeSpanLinks?: boolean;
|
|
138
|
+
/** Additional safe span link attribute keys to copy; sensitive keys remain blocked. */
|
|
139
|
+
linkAttributeKeys?: string[];
|
|
140
|
+
/** Primitive app metadata merged into every converted span. */
|
|
141
|
+
metadata?: Metadata;
|
|
142
|
+
/** Additional safe resource attribute keys to copy; sensitive keys remain blocked. */
|
|
143
|
+
resourceAttributeKeys?: string[];
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
/** Configuration for an opt-in OpenTelemetry SpanProcessor-compatible LogBrew bridge. */
|
|
147
|
+
export type OpenTelemetrySpanProcessorConfig = OpenTelemetryReadableSpanOptions & {
|
|
148
|
+
client: LogBrewClient;
|
|
149
|
+
transport?: Transport;
|
|
150
|
+
flushOnForceFlush?: boolean;
|
|
151
|
+
/** Emit one privacy-bounded synthetic trace summary span per trace on forceFlush/shutdown. Defaults to false. */
|
|
152
|
+
includeTraceSummary?: boolean;
|
|
153
|
+
timestamp?: () => string;
|
|
154
|
+
eventIdPrefix?: string;
|
|
155
|
+
spanFilter?: (span: unknown) => boolean | void;
|
|
156
|
+
onError?: (error: unknown) => void;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/** Configuration for an opt-in OpenTelemetry SpanExporter-compatible LogBrew bridge. */
|
|
160
|
+
export type OpenTelemetrySpanExporterConfig = OpenTelemetryReadableSpanOptions & {
|
|
161
|
+
client: LogBrewClient;
|
|
162
|
+
transport?: Transport;
|
|
163
|
+
/** Flush with the provided transport during export. Defaults to true when a transport is supplied. */
|
|
164
|
+
flushOnExport?: boolean;
|
|
165
|
+
/** Emit one privacy-bounded synthetic trace summary span per exported batch. Defaults to false. */
|
|
166
|
+
includeTraceSummary?: boolean;
|
|
167
|
+
timestamp?: () => string;
|
|
168
|
+
eventIdPrefix?: string;
|
|
169
|
+
spanFilter?: (span: unknown) => boolean | void;
|
|
170
|
+
onError?: (error: unknown) => void;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
/** Minimal OpenTelemetry export result shape; success is code 0, failure is code 1. */
|
|
174
|
+
export type OpenTelemetryExportResult = {
|
|
175
|
+
code: number;
|
|
176
|
+
error?: Error;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/** SpanExporter-compatible handle for app-owned OpenTelemetry processors. */
|
|
180
|
+
export type OpenTelemetrySpanExporterHandle = {
|
|
181
|
+
export(
|
|
182
|
+
spans: readonly (OpenTelemetryReadableSpanLike | unknown)[],
|
|
183
|
+
resultCallback: (result: OpenTelemetryExportResult) => void
|
|
184
|
+
): void;
|
|
185
|
+
forceFlush(): Promise<void>;
|
|
186
|
+
shutdown(): Promise<void>;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
/** SpanProcessor-compatible handle for app-owned OpenTelemetry setup. */
|
|
190
|
+
export type OpenTelemetrySpanProcessorHandle = {
|
|
191
|
+
onStart(span: unknown, parentContext: unknown): void;
|
|
192
|
+
onEnd(span: OpenTelemetryReadableSpanLike | unknown): void;
|
|
193
|
+
forceFlush(): Promise<void>;
|
|
194
|
+
shutdown(): Promise<void>;
|
|
195
|
+
};
|
|
196
|
+
|
|
28
197
|
/** Span fields supplied when deriving LogBrew span attributes from traceparent. */
|
|
29
198
|
export type TraceparentSpanInput = {
|
|
30
199
|
name: string;
|
|
31
200
|
spanId: string;
|
|
32
201
|
status: "ok" | "error";
|
|
33
202
|
durationMs?: number;
|
|
203
|
+
links?: SpanLinkSummary[];
|
|
34
204
|
metadata?: Metadata;
|
|
205
|
+
events?: SpanEventSummary[];
|
|
35
206
|
};
|
|
36
207
|
|
|
37
208
|
/** Public release event attributes. */
|
|
@@ -49,12 +220,54 @@ export type EnvironmentAttributes = {
|
|
|
49
220
|
metadata?: Metadata;
|
|
50
221
|
};
|
|
51
222
|
|
|
223
|
+
/** Privacy-bounded generated JavaScript frame attached to an issue. */
|
|
224
|
+
export type IssueStackFrame = {
|
|
225
|
+
/** Query-free generated filename or URL with local absolute prefixes removed. */
|
|
226
|
+
filename: string;
|
|
227
|
+
/** One-based generated source line. */
|
|
228
|
+
line: number;
|
|
229
|
+
/** One-based generated source column. */
|
|
230
|
+
column: number;
|
|
231
|
+
/** Optional release-artifact Debug ID matched to this generated file. */
|
|
232
|
+
debugId?: string;
|
|
233
|
+
};
|
|
234
|
+
|
|
52
235
|
/** Public issue event attributes. */
|
|
53
236
|
export type IssueAttributes = {
|
|
54
237
|
title: string;
|
|
55
238
|
level: SeverityInput;
|
|
56
239
|
message?: string;
|
|
240
|
+
/** Ordered privacy-bounded generated frames, capped at 32. */
|
|
241
|
+
stackFrames?: IssueStackFrame[];
|
|
242
|
+
metadata?: Metadata;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
/** Options for creating privacy-bounded issue attributes from a JavaScript error. */
|
|
246
|
+
export type JavaScriptErrorIssueOptions = {
|
|
247
|
+
title?: string;
|
|
248
|
+
level?: SeverityInput;
|
|
249
|
+
message?: string;
|
|
57
250
|
metadata?: Metadata;
|
|
251
|
+
/** Metadata source label. Defaults to `javascript.error`. */
|
|
252
|
+
source?: string;
|
|
253
|
+
/** Active trace copied into primitive correlation metadata. */
|
|
254
|
+
trace?: LogCorrelationTraceContext | null;
|
|
255
|
+
/** Release name associated with the runtime error. */
|
|
256
|
+
release?: string;
|
|
257
|
+
/** Environment associated with the runtime error. */
|
|
258
|
+
environment?: string;
|
|
259
|
+
/** Service associated with the runtime error. */
|
|
260
|
+
service?: string;
|
|
261
|
+
/** Runtime label such as `browser`, `node`, or `react-native`. */
|
|
262
|
+
runtime?: string;
|
|
263
|
+
/** Platform label such as `web`, `ios`, or `android`. */
|
|
264
|
+
platform?: string;
|
|
265
|
+
/** Map of sanitized frame filenames or minified URLs to release-artifact Debug IDs. */
|
|
266
|
+
debugIdMap?: Record<string, string>;
|
|
267
|
+
/** Optional stable app-owned grouping fingerprint. Keep it safe and low-cardinality. */
|
|
268
|
+
fingerprint?: string;
|
|
269
|
+
/** Include raw stack text only when the app has explicitly approved it. Defaults to false. */
|
|
270
|
+
includeErrorStack?: boolean;
|
|
58
271
|
};
|
|
59
272
|
|
|
60
273
|
/** Public log event attributes. */
|
|
@@ -108,6 +321,7 @@ export type PinoDestinationConfig = {
|
|
|
108
321
|
client: LogBrewClient;
|
|
109
322
|
logger?: string;
|
|
110
323
|
metadata?: Metadata;
|
|
324
|
+
traceProvider?: () => LogCorrelationTraceContext | null | undefined;
|
|
111
325
|
transport?: Transport;
|
|
112
326
|
flushOnWrite?: boolean;
|
|
113
327
|
includeErrorStack?: boolean;
|
|
@@ -139,6 +353,7 @@ export type WinstonTransportConfig = {
|
|
|
139
353
|
client: LogBrewClient;
|
|
140
354
|
logger?: string;
|
|
141
355
|
metadata?: Metadata;
|
|
356
|
+
traceProvider?: () => LogCorrelationTraceContext | null | undefined;
|
|
142
357
|
transport?: Transport;
|
|
143
358
|
flushOnWrite?: boolean;
|
|
144
359
|
includeErrorStack?: boolean;
|
|
@@ -165,6 +380,21 @@ export type WinstonTransportHandle = {
|
|
|
165
380
|
end(callback?: () => void): unknown;
|
|
166
381
|
};
|
|
167
382
|
|
|
383
|
+
/** Privacy-bounded milestone recorded inside a span. */
|
|
384
|
+
export type SpanEventSummary = {
|
|
385
|
+
name: string;
|
|
386
|
+
timestamp?: string;
|
|
387
|
+
metadata?: Metadata;
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
/** Privacy-bounded reference from this span to another trace/span. */
|
|
391
|
+
export type SpanLinkSummary = {
|
|
392
|
+
traceId: string;
|
|
393
|
+
spanId: string;
|
|
394
|
+
sampled?: boolean;
|
|
395
|
+
metadata?: Metadata;
|
|
396
|
+
};
|
|
397
|
+
|
|
168
398
|
/** Public span event attributes. */
|
|
169
399
|
export type SpanAttributes = {
|
|
170
400
|
name: string;
|
|
@@ -173,6 +403,8 @@ export type SpanAttributes = {
|
|
|
173
403
|
parentSpanId?: string;
|
|
174
404
|
status: "ok" | "error";
|
|
175
405
|
durationMs?: number;
|
|
406
|
+
events?: SpanEventSummary[];
|
|
407
|
+
links?: SpanLinkSummary[];
|
|
176
408
|
metadata?: Metadata;
|
|
177
409
|
};
|
|
178
410
|
|
|
@@ -214,6 +446,67 @@ export type TimelineAttributesOptions = {
|
|
|
214
446
|
metadata?: Metadata;
|
|
215
447
|
};
|
|
216
448
|
|
|
449
|
+
/** Planned backend support-ticket sources accepted by explicit draft helpers. */
|
|
450
|
+
export type SupportTicketSource = "cli" | "sdk" | "website" | "docs" | "mobile";
|
|
451
|
+
|
|
452
|
+
/** Planned backend support-ticket categories accepted by explicit draft helpers. */
|
|
453
|
+
export type SupportTicketCategory =
|
|
454
|
+
| "sdk_install_failure"
|
|
455
|
+
| "ingest_failure"
|
|
456
|
+
| "auth_failure"
|
|
457
|
+
| "project_setup"
|
|
458
|
+
| "dashboard_issue"
|
|
459
|
+
| "docs_confusion"
|
|
460
|
+
| "cli_issue"
|
|
461
|
+
| "mobile_issue"
|
|
462
|
+
| "billing_question"
|
|
463
|
+
| "other";
|
|
464
|
+
|
|
465
|
+
/** JSON-like diagnostics input sanitized before a support-ticket draft is returned. */
|
|
466
|
+
export type SupportDiagnosticsValue =
|
|
467
|
+
| string
|
|
468
|
+
| number
|
|
469
|
+
| boolean
|
|
470
|
+
| null
|
|
471
|
+
| SupportDiagnosticsValue[]
|
|
472
|
+
| { [key: string]: SupportDiagnosticsValue };
|
|
473
|
+
|
|
474
|
+
/** Explicit local-only support-ticket draft input. This does not open a ticket. */
|
|
475
|
+
export type SupportTicketDraftInput = {
|
|
476
|
+
source: SupportTicketSource;
|
|
477
|
+
category: SupportTicketCategory;
|
|
478
|
+
title: string;
|
|
479
|
+
description: string;
|
|
480
|
+
projectId?: string;
|
|
481
|
+
environment?: string;
|
|
482
|
+
runtime?: string;
|
|
483
|
+
framework?: string;
|
|
484
|
+
sdkPackage?: string;
|
|
485
|
+
sdkVersion?: string;
|
|
486
|
+
release?: string;
|
|
487
|
+
traceId?: string;
|
|
488
|
+
eventId?: string;
|
|
489
|
+
diagnostics?: Record<string, unknown>;
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
/** Planned backend create payload produced locally for explicit user or agent action. */
|
|
493
|
+
export type SupportTicketDraft = {
|
|
494
|
+
source: SupportTicketSource;
|
|
495
|
+
category: SupportTicketCategory;
|
|
496
|
+
title: string;
|
|
497
|
+
description: string;
|
|
498
|
+
project_id?: string;
|
|
499
|
+
environment?: string;
|
|
500
|
+
runtime?: string;
|
|
501
|
+
framework?: string;
|
|
502
|
+
sdk_package?: string;
|
|
503
|
+
sdk_version?: string;
|
|
504
|
+
release?: string;
|
|
505
|
+
trace_id?: string;
|
|
506
|
+
event_id?: string;
|
|
507
|
+
diagnostics?: Record<string, SupportDiagnosticsValue>;
|
|
508
|
+
};
|
|
509
|
+
|
|
217
510
|
/** Public metric event attributes. Use low-cardinality metadata only. */
|
|
218
511
|
export type MetricAttributes = {
|
|
219
512
|
name: string;
|
|
@@ -244,12 +537,40 @@ export type Event =
|
|
|
244
537
|
/** Drop-only event filter called after validation and before an event is queued. */
|
|
245
538
|
export type EventFilter = (event: Event) => boolean | void;
|
|
246
539
|
|
|
540
|
+
/** Canonical compact event record exchanged with an app-owned synchronous persistence adapter. */
|
|
541
|
+
export type StoredEvent = {
|
|
542
|
+
event: Event;
|
|
543
|
+
serializedEvent: string;
|
|
544
|
+
eventBytes: number;
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
/** Explicit synchronous persistence seam used to recover and acknowledge queued events safely. */
|
|
548
|
+
export type EventStore = {
|
|
549
|
+
load(): StoredEvent[];
|
|
550
|
+
append(record: StoredEvent): void;
|
|
551
|
+
acknowledge(count: number): void;
|
|
552
|
+
purge(): void;
|
|
553
|
+
close(): void;
|
|
554
|
+
};
|
|
555
|
+
|
|
556
|
+
/** Queue drop notification emitted when a bounded in-memory queue is full. */
|
|
557
|
+
export type DroppedEvent = {
|
|
558
|
+
reason: "event_too_large" | "queue_bytes_overflow" | "queue_overflow";
|
|
559
|
+
eventType: Event["type"];
|
|
560
|
+
eventId: string;
|
|
561
|
+
droppedEvents: number;
|
|
562
|
+
};
|
|
563
|
+
|
|
247
564
|
/** Stable transport response returned from flush and shutdown operations. */
|
|
248
565
|
export type TransportResponse = {
|
|
249
566
|
/** Final HTTP-like status returned by the transport. */
|
|
250
567
|
statusCode: number;
|
|
251
568
|
/** Number of transport attempts used for the flush. */
|
|
252
569
|
attempts: number;
|
|
570
|
+
/** Number of distinct batches acknowledged; client flush/shutdown responses always include it. */
|
|
571
|
+
batches?: number;
|
|
572
|
+
/** Optional retry delay from a rate-limit response, in milliseconds. */
|
|
573
|
+
retryAfterMs?: number;
|
|
253
574
|
};
|
|
254
575
|
|
|
255
576
|
/** Minimal transport interface accepted by flush and shutdown operations. */
|
|
@@ -257,10 +578,54 @@ export type Transport = {
|
|
|
257
578
|
send(apiKey: string, body: string): TransportResponse | Promise<TransportResponse>;
|
|
258
579
|
};
|
|
259
580
|
|
|
581
|
+
/** Content-free bounded delivery state with no event or sensitive transport fields. */
|
|
582
|
+
export type DeliveryHealthSnapshot = Readonly<{
|
|
583
|
+
/** Stable schema discriminator for JSON consumers. */
|
|
584
|
+
schemaVersion: 1;
|
|
585
|
+
automaticDelivery: boolean;
|
|
586
|
+
lifecycle: "active" | "shutting_down" | "closed";
|
|
587
|
+
deliveryState: "idle" | "queued" | "scheduled" | "in_flight" | "retrying" | "paused" | "accepted" | "failed" | "dropped";
|
|
588
|
+
storage: "memory" | "persistent";
|
|
589
|
+
queueEvents: number;
|
|
590
|
+
queueBytes: number;
|
|
591
|
+
/** Events and compact bytes loaded from persistence when this client started. */
|
|
592
|
+
hydratedEvents: number;
|
|
593
|
+
hydratedBytes: number;
|
|
594
|
+
droppedEvents: number;
|
|
595
|
+
droppedByReason: Readonly<{
|
|
596
|
+
event_too_large: number;
|
|
597
|
+
queue_bytes_overflow: number;
|
|
598
|
+
queue_overflow: number;
|
|
599
|
+
}>;
|
|
600
|
+
lastDropReason: "none" | "event_too_large" | "queue_bytes_overflow" | "queue_overflow";
|
|
601
|
+
scheduled: boolean;
|
|
602
|
+
inFlight: boolean;
|
|
603
|
+
coalesced: boolean;
|
|
604
|
+
pendingOperations: number;
|
|
605
|
+
lastOutcome: "idle" | "empty" | "accepted" | "failed";
|
|
606
|
+
lastStatusClass: "none" | "success" | "client_error" | "server_error" | "network_error" | "transport_error" | "invalid_response" | "other_status";
|
|
607
|
+
pausedReason: "none" | "authentication" | "rate_limit" | "non_retryable";
|
|
608
|
+
consecutiveFailures: number;
|
|
609
|
+
/** Bounded transient retry delay; zero when no automatic retry is scheduled. */
|
|
610
|
+
retryDelayMs: number;
|
|
611
|
+
flushes: number;
|
|
612
|
+
failures: number;
|
|
613
|
+
attempts: number;
|
|
614
|
+
batches: number;
|
|
615
|
+
/** Events durably acknowledged since this client was created. */
|
|
616
|
+
acceptedEvents: number;
|
|
617
|
+
/** Bounded monotonic-within-client Unix milliseconds; zero until the transition occurs. */
|
|
618
|
+
lastAttemptAtUnixMs: number;
|
|
619
|
+
lastAcceptedAtUnixMs: number;
|
|
620
|
+
lastDroppedAtUnixMs: number;
|
|
621
|
+
}>;
|
|
622
|
+
|
|
260
623
|
/** Stable public SDK error with parseable code and message fields. */
|
|
261
624
|
export declare class SdkError extends Error {
|
|
262
625
|
code: string;
|
|
263
|
-
|
|
626
|
+
retryAfterMs?: number;
|
|
627
|
+
retryable?: boolean;
|
|
628
|
+
constructor(code: string, message: string, details?: { retryAfterMs?: number; retryable?: boolean });
|
|
264
629
|
}
|
|
265
630
|
|
|
266
631
|
/** Transport error that can optionally be marked retryable by the caller. */
|
|
@@ -274,7 +639,7 @@ export declare class TransportError extends Error {
|
|
|
274
639
|
|
|
275
640
|
/** Scripted transport for previewing, accepting, or failing queued event flushes. */
|
|
276
641
|
export declare class RecordingTransport {
|
|
277
|
-
constructor(scriptedResponses?: Array<{ statusCode: number } | Error>);
|
|
642
|
+
constructor(scriptedResponses?: Array<{ statusCode: number; retryAfterMs?: number } | Error>);
|
|
278
643
|
/** Every request body sent through this transport instance. */
|
|
279
644
|
sentBodies: string[];
|
|
280
645
|
/** Create a transport that accepts queued flushes with a 202 response. */
|
|
@@ -291,13 +656,40 @@ export declare class LogBrewClient {
|
|
|
291
656
|
apiKey: string;
|
|
292
657
|
sdkName: string;
|
|
293
658
|
sdkVersion: string;
|
|
659
|
+
/** Retry attempts after the first send. Must be a non-negative integer; defaults to 2. */
|
|
294
660
|
maxRetries?: number;
|
|
295
661
|
eventFilter?: EventFilter;
|
|
662
|
+
/** Maximum queued compact event bytes. Defaults to 4 MiB. */
|
|
663
|
+
maxQueueBytes?: number;
|
|
664
|
+
maxQueueSize?: number;
|
|
665
|
+
/** Maximum events per request body. Defaults to 100. */
|
|
666
|
+
maxBatchEvents?: number;
|
|
667
|
+
/** Maximum UTF-8 request body bytes. Defaults to 256 KiB. */
|
|
668
|
+
maxBatchBytes?: number;
|
|
669
|
+
onEventDropped?: (drop: DroppedEvent) => void;
|
|
670
|
+
/** Optional app-scoped persistence adapter. Methods must complete synchronously. */
|
|
671
|
+
eventStore?: EventStore;
|
|
672
|
+
/** Client-owned transport used by automatic delivery and by flush/shutdown when no argument is supplied. */
|
|
673
|
+
transport?: Transport;
|
|
674
|
+
/** Enable interval and queue-threshold delivery. Defaults to true when transport is supplied. */
|
|
675
|
+
automaticDelivery?: boolean;
|
|
676
|
+
/** One-shot delivery interval in milliseconds. Defaults to 5000 and must not exceed 60000. */
|
|
677
|
+
deliveryIntervalMs?: number;
|
|
678
|
+
/** Queue count that triggers delivery without waiting for the interval. Defaults to min(50, maxQueueSize). */
|
|
679
|
+
deliveryQueueThreshold?: number;
|
|
296
680
|
}): LogBrewClient;
|
|
297
681
|
/** Return the queued event count currently buffered in memory. */
|
|
298
682
|
pendingEvents(): number;
|
|
683
|
+
/** Return compact serialized event bytes currently buffered in memory. */
|
|
684
|
+
pendingBytes(): number;
|
|
685
|
+
/** Return the number of events dropped because the bounded in-memory queue was full. */
|
|
686
|
+
droppedEvents(): number;
|
|
687
|
+
/** Return a frozen, content-free snapshot of queue and delivery lifecycle health. */
|
|
688
|
+
deliveryHealth(): DeliveryHealthSnapshot;
|
|
299
689
|
/** Return the queued event batch as stable, pretty-printed JSON. */
|
|
300
690
|
previewJson(): string;
|
|
691
|
+
/** Purge queued events from memory and persistence while no delivery operation is active. */
|
|
692
|
+
purgePendingEvents(): number;
|
|
301
693
|
release(id: string, timestamp: string, attributes: ReleaseAttributes): void;
|
|
302
694
|
environment(id: string, timestamp: string, attributes: EnvironmentAttributes): void;
|
|
303
695
|
issue(id: string, timestamp: string, attributes: IssueAttributes): void;
|
|
@@ -305,10 +697,10 @@ export declare class LogBrewClient {
|
|
|
305
697
|
span(id: string, timestamp: string, attributes: SpanAttributes): void;
|
|
306
698
|
action(id: string, timestamp: string, attributes: ActionAttributes): void;
|
|
307
699
|
metric(id: string, timestamp: string, attributes: MetricAttributes): void;
|
|
308
|
-
/** Flush
|
|
309
|
-
flush(transport
|
|
310
|
-
/**
|
|
311
|
-
shutdown(transport
|
|
700
|
+
/** Flush one queue snapshot in bounded batches while preserving concurrent captures and retry bodies. */
|
|
701
|
+
flush(transport?: Transport): Promise<TransportResponse>;
|
|
702
|
+
/** Reject new capture, flush queued events, then close; a failed flush reopens the intact remainder. */
|
|
703
|
+
shutdown(transport?: Transport): Promise<TransportResponse>;
|
|
312
704
|
}
|
|
313
705
|
|
|
314
706
|
/** Install explicit console capture while preserving the target console's normal output behavior. */
|
|
@@ -326,6 +718,15 @@ export declare function createNetworkMilestoneAttributes(
|
|
|
326
718
|
options?: TimelineAttributesOptions
|
|
327
719
|
): ActionAttributes;
|
|
328
720
|
|
|
721
|
+
/** Build a local-only, token-free support-ticket create payload draft without calling backend routes. */
|
|
722
|
+
export declare function createSupportTicketDraft(input: SupportTicketDraftInput): SupportTicketDraft;
|
|
723
|
+
|
|
724
|
+
/** Convert a JavaScript Error-like value into safe issue attributes with optional source-map Debug ID metadata. */
|
|
725
|
+
export declare function createIssueAttributesFromError(
|
|
726
|
+
error: unknown,
|
|
727
|
+
options?: JavaScriptErrorIssueOptions
|
|
728
|
+
): IssueAttributes;
|
|
729
|
+
|
|
329
730
|
/** Convert console arguments into safe LogBrew log attributes without installing capture. */
|
|
330
731
|
export declare function logAttributesFromConsoleArgs(
|
|
331
732
|
method: ConsoleMethodName,
|
|
@@ -349,6 +750,58 @@ export declare function createTraceparent(input: TraceparentInput): string;
|
|
|
349
750
|
/** Create an explicit outbound header carrier containing only traceparent. */
|
|
350
751
|
export declare function createTraceparentHeaders(input: TraceparentInput): { traceparent: string };
|
|
351
752
|
|
|
753
|
+
/** Parse a W3C tracestate header into normalized entries. */
|
|
754
|
+
export declare function parseTracestate(tracestate: string): TracestateEntry[];
|
|
755
|
+
|
|
756
|
+
/** Create a normalized W3C tracestate header from explicit entries. */
|
|
757
|
+
export declare function createTracestate(entries: TracestateEntry[]): string;
|
|
758
|
+
|
|
759
|
+
/** Parse a W3C baggage header into decoded entries. */
|
|
760
|
+
export declare function parseBaggage(baggage: string): BaggageEntry[];
|
|
761
|
+
|
|
762
|
+
/** Create a W3C baggage header from explicit entries. */
|
|
763
|
+
export declare function createBaggage(entries: BaggageEntry[]): string;
|
|
764
|
+
|
|
765
|
+
/** Create an explicit outbound carrier for traceparent plus optional tracestate and baggage. */
|
|
766
|
+
export declare function createTraceContextHeaders(input: TraceContextInput): {
|
|
767
|
+
traceparent: string;
|
|
768
|
+
tracestate?: string;
|
|
769
|
+
baggage?: string;
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
/** Create a LogBrew child trace from a live OpenTelemetry SpanContext-like object. */
|
|
773
|
+
export declare function logbrewTraceContextFromOpenTelemetrySpanContext(
|
|
774
|
+
spanContext: OpenTelemetrySpanContextLike | null | undefined,
|
|
775
|
+
options?: OpenTelemetryTraceContextOptions
|
|
776
|
+
): LogCorrelationTraceContext | null;
|
|
777
|
+
|
|
778
|
+
/** Create a LogBrew child trace from a live OpenTelemetry Span-like object. */
|
|
779
|
+
export declare function logbrewTraceContextFromOpenTelemetrySpan(
|
|
780
|
+
span: OpenTelemetrySpanLike | null | undefined,
|
|
781
|
+
options?: OpenTelemetryTraceContextOptions
|
|
782
|
+
): LogCorrelationTraceContext | null;
|
|
783
|
+
|
|
784
|
+
/** Create a LogBrew child trace from OpenTelemetry's current active span, when available. */
|
|
785
|
+
export declare function logbrewTraceContextFromCurrentOpenTelemetrySpan(
|
|
786
|
+
options?: CurrentOpenTelemetryTraceContextOptions
|
|
787
|
+
): LogCorrelationTraceContext | null;
|
|
788
|
+
|
|
789
|
+
/** Convert an ended OpenTelemetry ReadableSpan-like object into safe LogBrew span attributes. */
|
|
790
|
+
export declare function spanAttributesFromOpenTelemetryReadableSpan(
|
|
791
|
+
span: OpenTelemetryReadableSpanLike | null | undefined,
|
|
792
|
+
options?: OpenTelemetryReadableSpanOptions
|
|
793
|
+
): SpanAttributes | null;
|
|
794
|
+
|
|
795
|
+
/** Create an opt-in SpanProcessor-compatible bridge for app-owned OpenTelemetry providers. */
|
|
796
|
+
export declare function createLogBrewOpenTelemetrySpanProcessor(
|
|
797
|
+
config: OpenTelemetrySpanProcessorConfig
|
|
798
|
+
): OpenTelemetrySpanProcessorHandle;
|
|
799
|
+
|
|
800
|
+
/** Create an opt-in SpanExporter-compatible bridge for app-owned OpenTelemetry processors. */
|
|
801
|
+
export declare function createLogBrewOpenTelemetrySpanExporter(
|
|
802
|
+
config: OpenTelemetrySpanExporterConfig
|
|
803
|
+
): OpenTelemetrySpanExporterHandle;
|
|
804
|
+
|
|
352
805
|
/** Build LogBrew span attributes that continue an incoming W3C traceparent value. */
|
|
353
806
|
export declare function spanAttributesFromTraceparent(
|
|
354
807
|
traceparent: string,
|
|
@@ -364,6 +817,7 @@ export declare function logAttributesFromPinoRecord(
|
|
|
364
817
|
options?: {
|
|
365
818
|
logger?: string;
|
|
366
819
|
metadata?: Metadata;
|
|
820
|
+
trace?: LogCorrelationTraceContext | null;
|
|
367
821
|
includeErrorStack?: boolean;
|
|
368
822
|
}
|
|
369
823
|
): LogAttributes;
|
|
@@ -377,6 +831,7 @@ export declare function logAttributesFromWinstonInfo(
|
|
|
377
831
|
options?: {
|
|
378
832
|
logger?: string;
|
|
379
833
|
metadata?: Metadata;
|
|
834
|
+
trace?: LogCorrelationTraceContext | null;
|
|
380
835
|
includeErrorStack?: boolean;
|
|
381
836
|
}
|
|
382
837
|
): LogAttributes;
|