@stainlessdev/xray-emitter 0.2.0 → 0.3.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/README.md +1 -2
- package/dist/{chunk-2HW4AEKB.cjs → chunk-55YD27PV.cjs} +28 -28
- package/dist/chunk-55YD27PV.cjs.map +1 -0
- package/dist/{chunk-YVMMCTXW.js → chunk-7KT6EPVZ.js} +1 -1
- package/dist/{chunk-YVMMCTXW.js.map → chunk-7KT6EPVZ.js.map} +1 -1
- package/dist/{chunk-GNSXLLEC.cjs → chunk-CPHFCOA5.cjs} +9 -9
- package/dist/{chunk-GNSXLLEC.cjs.map → chunk-CPHFCOA5.cjs.map} +1 -1
- package/dist/{chunk-JKW6E4L3.cjs → chunk-DNBARLGB.cjs} +1 -1
- package/dist/{chunk-JKW6E4L3.cjs.map → chunk-DNBARLGB.cjs.map} +1 -1
- package/dist/{chunk-ZP5OEA4I.js → chunk-DV3MVQBB.js} +4 -4
- package/dist/chunk-DV3MVQBB.js.map +1 -0
- package/dist/{chunk-WTHVUHGI.js → chunk-FGXXKIF7.js} +4 -4
- package/dist/chunk-FGXXKIF7.js.map +1 -0
- package/dist/{chunk-TSCMZ5TV.js → chunk-GYXI3DWB.js} +35 -3
- package/dist/chunk-GYXI3DWB.js.map +1 -0
- package/dist/{chunk-6UH43LVD.js → chunk-NTIUR3OC.js} +2 -2
- package/dist/{chunk-DBI3HXNR.cjs → chunk-SUVCVINA.cjs} +47 -47
- package/dist/chunk-SUVCVINA.cjs.map +1 -0
- package/dist/{chunk-XO6YWDFL.cjs → chunk-UJWD5CFA.cjs} +53 -21
- package/dist/chunk-UJWD5CFA.cjs.map +1 -0
- package/dist/effect.cjs +19 -19
- package/dist/effect.cjs.map +1 -1
- package/dist/effect.d.cts +30 -3
- package/dist/effect.d.ts +30 -3
- package/dist/effect.js +4 -4
- package/dist/effect.js.map +1 -1
- package/dist/emitter-Bi_m_w5h.d.cts +10 -0
- package/dist/emitter-Dy7bRGTq.d.ts +10 -0
- package/dist/express.cjs +7 -7
- package/dist/express.cjs.map +1 -1
- package/dist/express.d.cts +9 -2
- package/dist/express.d.ts +9 -2
- package/dist/express.js +4 -4
- package/dist/express.js.map +1 -1
- package/dist/fastify.cjs +10 -10
- package/dist/fastify.cjs.map +1 -1
- package/dist/fastify.d.cts +9 -2
- package/dist/fastify.d.ts +9 -2
- package/dist/fastify.js +4 -4
- package/dist/fastify.js.map +1 -1
- package/dist/fetch.cjs +5 -5
- package/dist/fetch.d.cts +39 -2
- package/dist/fetch.d.ts +39 -2
- package/dist/fetch.js +4 -4
- package/dist/hono.cjs +9 -9
- package/dist/hono.cjs.map +1 -1
- package/dist/hono.d.cts +15 -3
- package/dist/hono.d.ts +15 -3
- package/dist/hono.js +4 -4
- package/dist/hono.js.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +2 -2
- package/dist/internal.cjs +3 -3
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +2 -2
- package/dist/next.cjs +7 -7
- package/dist/next.cjs.map +1 -1
- package/dist/next.d.cts +9 -3
- package/dist/next.d.ts +9 -3
- package/dist/next.js +4 -4
- package/dist/next.js.map +1 -1
- package/dist/node.cjs +5 -5
- package/dist/node.d.cts +42 -1
- package/dist/node.d.ts +42 -1
- package/dist/node.js +4 -4
- package/dist/remix.cjs +7 -7
- package/dist/remix.cjs.map +1 -1
- package/dist/remix.d.cts +10 -3
- package/dist/remix.d.ts +10 -3
- package/dist/remix.js +4 -4
- package/dist/remix.js.map +1 -1
- package/dist/types-BrKvhHbn.d.cts +446 -0
- package/dist/types-BrKvhHbn.d.ts +446 -0
- package/package.json +1 -1
- package/dist/chunk-2HW4AEKB.cjs.map +0 -1
- package/dist/chunk-DBI3HXNR.cjs.map +0 -1
- package/dist/chunk-TSCMZ5TV.js.map +0 -1
- package/dist/chunk-WTHVUHGI.js.map +0 -1
- package/dist/chunk-XO6YWDFL.cjs.map +0 -1
- package/dist/chunk-ZP5OEA4I.js.map +0 -1
- package/dist/emitter-BqfrGIod.d.cts +0 -5
- package/dist/emitter-CScYhwGA.d.ts +0 -5
- package/dist/types-Z1nirh-F.d.cts +0 -149
- package/dist/types-Z1nirh-F.d.ts +0 -149
- /package/dist/{chunk-6UH43LVD.js.map → chunk-NTIUR3OC.js.map} +0 -0
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
import * as _opentelemetry_sdk_trace_base from '@opentelemetry/sdk-trace-base';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Exporter settings used by the OTLP trace exporter.
|
|
5
|
+
*/
|
|
6
|
+
interface ExporterConfig {
|
|
7
|
+
/**
|
|
8
|
+
* OTLP trace endpoint URL. `/v1/traces` is appended if missing.
|
|
9
|
+
*/
|
|
10
|
+
endpointUrl: string;
|
|
11
|
+
/**
|
|
12
|
+
* Additional OTLP exporter headers (for example `Authorization`).
|
|
13
|
+
*/
|
|
14
|
+
headers?: Record<string, string>;
|
|
15
|
+
/**
|
|
16
|
+
* Export timeout in milliseconds.
|
|
17
|
+
*/
|
|
18
|
+
timeoutMs: number;
|
|
19
|
+
/**
|
|
20
|
+
* Span processor mode.
|
|
21
|
+
*
|
|
22
|
+
* Use `batch` (default) for lower overhead in long-lived services.
|
|
23
|
+
* Use `simple` to export each span immediately (useful for tests and
|
|
24
|
+
* short-lived runtimes).
|
|
25
|
+
*/
|
|
26
|
+
spanProcessor: 'simple' | 'batch';
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Request/response capture settings.
|
|
30
|
+
*/
|
|
31
|
+
interface CaptureConfig {
|
|
32
|
+
/**
|
|
33
|
+
* Include sanitized request headers in logs/spans.
|
|
34
|
+
*/
|
|
35
|
+
requestHeaders: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Include sanitized response headers in logs/spans.
|
|
38
|
+
*/
|
|
39
|
+
responseHeaders: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Request body capture mode.
|
|
42
|
+
*
|
|
43
|
+
* `none` disables capture, `text` records UTF-8 text, and `base64` preserves
|
|
44
|
+
* binary payloads safely.
|
|
45
|
+
*/
|
|
46
|
+
requestBody: 'none' | 'text' | 'base64';
|
|
47
|
+
/**
|
|
48
|
+
* Response body capture mode.
|
|
49
|
+
*
|
|
50
|
+
* `none` disables capture, `text` records UTF-8 text, and `base64` preserves
|
|
51
|
+
* binary payloads safely.
|
|
52
|
+
*/
|
|
53
|
+
responseBody: 'none' | 'text' | 'base64';
|
|
54
|
+
/**
|
|
55
|
+
* Maximum captured bytes per request/response body before truncation.
|
|
56
|
+
*/
|
|
57
|
+
maxBodyBytes: number;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Redaction settings for logs and captured payloads.
|
|
61
|
+
*/
|
|
62
|
+
interface RedactionConfig {
|
|
63
|
+
/**
|
|
64
|
+
* Header names to redact (case-insensitive).
|
|
65
|
+
*/
|
|
66
|
+
headers: string[];
|
|
67
|
+
/**
|
|
68
|
+
* Query parameter names to redact (case-insensitive).
|
|
69
|
+
*/
|
|
70
|
+
queryParams: string[];
|
|
71
|
+
/**
|
|
72
|
+
* JSON paths to redact in captured JSON bodies.
|
|
73
|
+
*/
|
|
74
|
+
bodyJsonPaths: string[];
|
|
75
|
+
/**
|
|
76
|
+
* Replacement value used for redacted data.
|
|
77
|
+
*/
|
|
78
|
+
replacement: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Request ID extraction and propagation settings.
|
|
82
|
+
*/
|
|
83
|
+
interface RequestIdConfig {
|
|
84
|
+
/**
|
|
85
|
+
* Response header name to read request IDs from. This is normalized to
|
|
86
|
+
* lowercase during configuration.
|
|
87
|
+
*/
|
|
88
|
+
header: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Route normalization settings.
|
|
92
|
+
*/
|
|
93
|
+
interface RouteConfig {
|
|
94
|
+
/**
|
|
95
|
+
* When true, normalize route patterns before emitting logs.
|
|
96
|
+
*/
|
|
97
|
+
normalize: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Optional custom normalizer. Defaults to X-ray's built-in normalizer.
|
|
100
|
+
*/
|
|
101
|
+
normalizer?: (path: string) => string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Core emitter configuration.
|
|
105
|
+
*/
|
|
106
|
+
interface XrayConfig {
|
|
107
|
+
/**
|
|
108
|
+
* Logical service name for all emitted request logs.
|
|
109
|
+
*/
|
|
110
|
+
serviceName: string;
|
|
111
|
+
/**
|
|
112
|
+
* Optional deployment environment label.
|
|
113
|
+
*/
|
|
114
|
+
environment?: string;
|
|
115
|
+
/**
|
|
116
|
+
* Optional service version label.
|
|
117
|
+
*/
|
|
118
|
+
version?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Logger for internal X-ray diagnostics.
|
|
121
|
+
*/
|
|
122
|
+
logger?: Logger;
|
|
123
|
+
/**
|
|
124
|
+
* Minimum log level for internal diagnostics.
|
|
125
|
+
*/
|
|
126
|
+
logLevel?: LogLevel;
|
|
127
|
+
/**
|
|
128
|
+
* OTLP endpoint URL. Falls back to `STAINLESS_XRAY_ENDPOINT_URL`.
|
|
129
|
+
*/
|
|
130
|
+
endpointUrl?: string;
|
|
131
|
+
/**
|
|
132
|
+
* Exporter overrides.
|
|
133
|
+
*/
|
|
134
|
+
exporter?: Partial<ExporterConfig>;
|
|
135
|
+
/**
|
|
136
|
+
* Capture overrides.
|
|
137
|
+
*/
|
|
138
|
+
capture?: Partial<CaptureConfig>;
|
|
139
|
+
/**
|
|
140
|
+
* Redaction overrides.
|
|
141
|
+
*/
|
|
142
|
+
redaction?: Partial<RedactionConfig>;
|
|
143
|
+
/**
|
|
144
|
+
* Request ID resolution settings. The header is read from response headers at
|
|
145
|
+
* the end of the request.
|
|
146
|
+
*/
|
|
147
|
+
requestId?: Partial<RequestIdConfig>;
|
|
148
|
+
/**
|
|
149
|
+
* Route normalization overrides.
|
|
150
|
+
*/
|
|
151
|
+
route?: Partial<RouteConfig>;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Runtime config accepted by framework/node/fetch entrypoints.
|
|
155
|
+
*/
|
|
156
|
+
type XrayRuntimeConfig = Omit<XrayConfig, 'exporter'> & {
|
|
157
|
+
exporter?: Partial<ExporterConfig> & {
|
|
158
|
+
/**
|
|
159
|
+
* Custom exporter instance. When provided, endpoint/header options are ignored.
|
|
160
|
+
*/
|
|
161
|
+
instance?: _opentelemetry_sdk_trace_base.SpanExporter;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Fully-resolved configuration returned by `normalizeConfig`.
|
|
166
|
+
*/
|
|
167
|
+
interface ResolvedXrayConfig {
|
|
168
|
+
serviceName: string;
|
|
169
|
+
environment?: string;
|
|
170
|
+
version?: string;
|
|
171
|
+
logger: Logger;
|
|
172
|
+
logLevel: LogLevel;
|
|
173
|
+
exporter: ExporterConfig;
|
|
174
|
+
capture: CaptureConfig;
|
|
175
|
+
redaction: RedactionConfig;
|
|
176
|
+
requestId: RequestIdConfig;
|
|
177
|
+
route: RouteConfig;
|
|
178
|
+
}
|
|
179
|
+
declare class XrayConfigError extends Error {
|
|
180
|
+
code: 'INVALID_CONFIG' | 'INVALID_REDACTION';
|
|
181
|
+
constructor(code: XrayConfigError['code'], message: string);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Normalize and validate user configuration.
|
|
185
|
+
*
|
|
186
|
+
* Applies defaults, validates required fields, and resolves environment
|
|
187
|
+
* fallbacks such as `STAINLESS_XRAY_ENDPOINT_URL`.
|
|
188
|
+
*/
|
|
189
|
+
declare function normalizeConfig(config: XrayConfig): ResolvedXrayConfig;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Attribute value types accepted by OpenTelemetry span attributes.
|
|
193
|
+
*/
|
|
194
|
+
type AttributeValue = string | number | boolean | string[] | number[] | boolean[];
|
|
195
|
+
/**
|
|
196
|
+
* Logging levels used by the internal X-ray logger.
|
|
197
|
+
*/
|
|
198
|
+
type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
199
|
+
/**
|
|
200
|
+
* Logger contract used by X-ray for internal diagnostics.
|
|
201
|
+
*/
|
|
202
|
+
interface Logger {
|
|
203
|
+
debug(msg: string, fields?: Record<string, unknown>): void;
|
|
204
|
+
info(msg: string, fields?: Record<string, unknown>): void;
|
|
205
|
+
warn(msg: string, fields?: Record<string, unknown>): void;
|
|
206
|
+
error(msg: string, fields?: Record<string, unknown>): void;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Captured request/response body payload details.
|
|
210
|
+
*/
|
|
211
|
+
interface CapturedBody {
|
|
212
|
+
/**
|
|
213
|
+
* Total body size before truncation.
|
|
214
|
+
*/
|
|
215
|
+
bytes: number;
|
|
216
|
+
/**
|
|
217
|
+
* Encoding used for `value`.
|
|
218
|
+
*/
|
|
219
|
+
encoding: 'utf8' | 'base64';
|
|
220
|
+
/**
|
|
221
|
+
* True when `value` was truncated due to `capture.maxBodyBytes`.
|
|
222
|
+
*/
|
|
223
|
+
truncated: boolean;
|
|
224
|
+
/**
|
|
225
|
+
* Captured body payload. Omitted when there is no body.
|
|
226
|
+
*/
|
|
227
|
+
value?: string;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Final emitted request log record.
|
|
231
|
+
*/
|
|
232
|
+
interface RequestLog {
|
|
233
|
+
/**
|
|
234
|
+
* Request identifier for this request.
|
|
235
|
+
*
|
|
236
|
+
* Written to span attributes and, where supported by the runtime/framework
|
|
237
|
+
* adapter, propagated to response headers.
|
|
238
|
+
*/
|
|
239
|
+
requestId: string;
|
|
240
|
+
/**
|
|
241
|
+
* OpenTelemetry trace ID for this request span.
|
|
242
|
+
*/
|
|
243
|
+
traceId?: string;
|
|
244
|
+
/**
|
|
245
|
+
* OpenTelemetry span ID for this request span.
|
|
246
|
+
*/
|
|
247
|
+
spanId?: string;
|
|
248
|
+
/**
|
|
249
|
+
* Service name from configuration.
|
|
250
|
+
*/
|
|
251
|
+
serviceName: string;
|
|
252
|
+
/**
|
|
253
|
+
* HTTP method recorded at request start (for example `GET` or `POST`).
|
|
254
|
+
*/
|
|
255
|
+
method: string;
|
|
256
|
+
/**
|
|
257
|
+
* Full URL after redaction.
|
|
258
|
+
*/
|
|
259
|
+
url: string;
|
|
260
|
+
/**
|
|
261
|
+
* Normalized route pattern when available (for example `/users/{id}`).
|
|
262
|
+
*/
|
|
263
|
+
route?: string;
|
|
264
|
+
/**
|
|
265
|
+
* Final HTTP response status code, when known.
|
|
266
|
+
*/
|
|
267
|
+
statusCode?: number;
|
|
268
|
+
/**
|
|
269
|
+
* Request duration in milliseconds.
|
|
270
|
+
*/
|
|
271
|
+
durationMs: number;
|
|
272
|
+
/**
|
|
273
|
+
* Sanitized and optionally redacted request headers.
|
|
274
|
+
*/
|
|
275
|
+
requestHeaders?: Record<string, string | string[]>;
|
|
276
|
+
/**
|
|
277
|
+
* Sanitized and optionally redacted response headers.
|
|
278
|
+
*/
|
|
279
|
+
responseHeaders?: Record<string, string | string[]>;
|
|
280
|
+
/**
|
|
281
|
+
* Captured request body when enabled by capture settings.
|
|
282
|
+
*/
|
|
283
|
+
requestBody?: CapturedBody;
|
|
284
|
+
/**
|
|
285
|
+
* Captured response body when enabled by capture settings.
|
|
286
|
+
*/
|
|
287
|
+
responseBody?: CapturedBody;
|
|
288
|
+
/**
|
|
289
|
+
* Tenant identifier recorded via `setActor`.
|
|
290
|
+
*/
|
|
291
|
+
tenantId?: string;
|
|
292
|
+
/**
|
|
293
|
+
* User identifier recorded via `setActor` or legacy `setUserId`.
|
|
294
|
+
*/
|
|
295
|
+
userId?: string;
|
|
296
|
+
/**
|
|
297
|
+
* Session identifier recorded via `setSessionId`.
|
|
298
|
+
*/
|
|
299
|
+
sessionId?: string;
|
|
300
|
+
/**
|
|
301
|
+
* Captured error details when the request fails.
|
|
302
|
+
*/
|
|
303
|
+
error?: {
|
|
304
|
+
message: string;
|
|
305
|
+
type?: string;
|
|
306
|
+
stack?: string;
|
|
307
|
+
};
|
|
308
|
+
/**
|
|
309
|
+
* Custom attributes added via `setAttribute`.
|
|
310
|
+
*/
|
|
311
|
+
attributes?: Record<string, AttributeValue>;
|
|
312
|
+
/**
|
|
313
|
+
* ISO timestamp for when request processing completed.
|
|
314
|
+
*/
|
|
315
|
+
timestamp: string;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Per-request context bound to framework request objects.
|
|
319
|
+
*/
|
|
320
|
+
interface XrayContext {
|
|
321
|
+
/**
|
|
322
|
+
* Final request ID. May be empty until request completion.
|
|
323
|
+
*/
|
|
324
|
+
requestId: string;
|
|
325
|
+
/**
|
|
326
|
+
* OpenTelemetry trace ID, when tracing is active.
|
|
327
|
+
*/
|
|
328
|
+
traceId?: string;
|
|
329
|
+
/**
|
|
330
|
+
* OpenTelemetry span ID, when tracing is active.
|
|
331
|
+
*/
|
|
332
|
+
spanId?: string;
|
|
333
|
+
/**
|
|
334
|
+
* Set actor identity for the request.
|
|
335
|
+
*
|
|
336
|
+
* `tenantId` is always recorded.
|
|
337
|
+
* `userId` is recorded only when non-empty.
|
|
338
|
+
*/
|
|
339
|
+
setActor(tenantId: string, userId: string): void;
|
|
340
|
+
/**
|
|
341
|
+
* @deprecated Use `setActor(tenantId, userId)` to record tenant and user IDs together.
|
|
342
|
+
*/
|
|
343
|
+
setUserId(id: string): void;
|
|
344
|
+
/**
|
|
345
|
+
* Set a session identifier on the request log.
|
|
346
|
+
*/
|
|
347
|
+
setSessionId(id: string): void;
|
|
348
|
+
/**
|
|
349
|
+
* Add or overwrite a custom attribute on the request span/log.
|
|
350
|
+
*/
|
|
351
|
+
setAttribute(key: string, value: AttributeValue): void;
|
|
352
|
+
/**
|
|
353
|
+
* Add a span event for the current request.
|
|
354
|
+
*/
|
|
355
|
+
addEvent(name: string, attributes?: Record<string, AttributeValue>): void;
|
|
356
|
+
/**
|
|
357
|
+
* Mark the request as failed with error details.
|
|
358
|
+
*/
|
|
359
|
+
setError(err: unknown): void;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Runtime-agnostic request input passed into `startRequest`.
|
|
363
|
+
*/
|
|
364
|
+
interface NormalizedRequest {
|
|
365
|
+
/**
|
|
366
|
+
* HTTP method used for span naming and emitted log metadata.
|
|
367
|
+
*/
|
|
368
|
+
method: string;
|
|
369
|
+
/**
|
|
370
|
+
* Full request URL before redaction.
|
|
371
|
+
*/
|
|
372
|
+
url: string;
|
|
373
|
+
/**
|
|
374
|
+
* Route pattern (if known at request start).
|
|
375
|
+
*/
|
|
376
|
+
route?: string;
|
|
377
|
+
/**
|
|
378
|
+
* Request headers as normalized string/string[] values.
|
|
379
|
+
*/
|
|
380
|
+
headers: Record<string, string | string[]>;
|
|
381
|
+
/**
|
|
382
|
+
* Optional pre-captured body.
|
|
383
|
+
*/
|
|
384
|
+
body?: CapturedBody;
|
|
385
|
+
/**
|
|
386
|
+
* Optional explicit request ID. If omitted, X-ray reads from response headers
|
|
387
|
+
* when the span is closed (and generates a UUIDv7 if none is present).
|
|
388
|
+
*/
|
|
389
|
+
requestId?: string;
|
|
390
|
+
/**
|
|
391
|
+
* Client remote address, used for client address attributes.
|
|
392
|
+
*/
|
|
393
|
+
remoteAddress?: string;
|
|
394
|
+
/**
|
|
395
|
+
* Request start timestamp (milliseconds since epoch).
|
|
396
|
+
*/
|
|
397
|
+
startTimeMs: number;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Runtime-agnostic response input passed into `endRequest`.
|
|
401
|
+
*/
|
|
402
|
+
interface NormalizedResponse {
|
|
403
|
+
/**
|
|
404
|
+
* HTTP response status code, if a response was produced.
|
|
405
|
+
*/
|
|
406
|
+
statusCode?: number;
|
|
407
|
+
/**
|
|
408
|
+
* Response headers available at request completion.
|
|
409
|
+
*/
|
|
410
|
+
headers?: Record<string, string | string[]>;
|
|
411
|
+
/**
|
|
412
|
+
* Optional captured response body.
|
|
413
|
+
*/
|
|
414
|
+
body?: CapturedBody;
|
|
415
|
+
/**
|
|
416
|
+
* Response completion timestamp (milliseconds since epoch).
|
|
417
|
+
*/
|
|
418
|
+
endTimeMs: number;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Runtime-agnostic emitter API used by adapters/framework wrappers.
|
|
422
|
+
*/
|
|
423
|
+
interface XrayEmitter {
|
|
424
|
+
/**
|
|
425
|
+
* Fully-resolved runtime configuration.
|
|
426
|
+
*/
|
|
427
|
+
config: ResolvedXrayConfig;
|
|
428
|
+
/**
|
|
429
|
+
* Start request tracking and return a mutable per-request context.
|
|
430
|
+
*/
|
|
431
|
+
startRequest(req: NormalizedRequest): XrayContext;
|
|
432
|
+
/**
|
|
433
|
+
* Finish request tracking and return the emitted request log payload.
|
|
434
|
+
*/
|
|
435
|
+
endRequest(ctx: XrayContext, res: NormalizedResponse, err?: unknown): RequestLog;
|
|
436
|
+
/**
|
|
437
|
+
* Flush pending spans to the configured exporter.
|
|
438
|
+
*/
|
|
439
|
+
flush(): Promise<void>;
|
|
440
|
+
/**
|
|
441
|
+
* Shutdown the emitter and release exporter resources.
|
|
442
|
+
*/
|
|
443
|
+
shutdown(): Promise<void>;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export { type AttributeValue as A, type CapturedBody as C, type ExporterConfig as E, type LogLevel as L, type NormalizedRequest as N, type RequestLog as R, type XrayConfig as X, type XrayEmitter as a, type Logger as b, type NormalizedResponse as c, type XrayContext as d, type CaptureConfig as e, type RedactionConfig as f, type RequestIdConfig as g, type ResolvedXrayConfig as h, type RouteConfig as i, type XrayRuntimeConfig as j, XrayConfigError as k, normalizeConfig as n };
|