brass-runtime 1.15.0 → 1.16.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.
Files changed (93) hide show
  1. package/README.md +409 -137
  2. package/dist/agent/cli/main.cjs +40 -35
  3. package/dist/agent/cli/main.js +9 -4
  4. package/dist/agent/cli/main.mjs +9 -4
  5. package/dist/agent/index.cjs +8 -4
  6. package/dist/agent/index.d.ts +1 -1
  7. package/dist/agent/index.js +7 -3
  8. package/dist/agent/index.mjs +7 -3
  9. package/dist/{chunk-PPUXIH5R.js → chunk-2WC63LJK.mjs} +11 -7
  10. package/dist/chunk-3RG5ZIWI.js +10 -0
  11. package/dist/chunk-45F7OKGT.cjs +104 -0
  12. package/dist/chunk-5YOQOXEQ.cjs +2491 -0
  13. package/dist/{chunk-STVLQ3XD.cjs → chunk-7HUOJA4W.cjs} +78 -74
  14. package/dist/{chunk-BMH5AV44.js → chunk-7LVI2GIN.js} +251 -370
  15. package/dist/chunk-7TL2LHQJ.js +2491 -0
  16. package/dist/chunk-7V4KY4RL.mjs +104 -0
  17. package/dist/chunk-7XOPAB5Q.js +2143 -0
  18. package/dist/chunk-CCKHV5BT.mjs +193 -0
  19. package/dist/{chunk-AR22SXML.js → chunk-CY33PGEX.mjs} +488 -421
  20. package/dist/chunk-DJQ7OMMB.cjs +144 -0
  21. package/dist/chunk-F5EUMJL7.mjs +2143 -0
  22. package/dist/chunk-FM4W4QPL.js +193 -0
  23. package/dist/{chunk-TO7IKXYT.js → chunk-G3XGCZDQ.js} +1 -1
  24. package/dist/{chunk-BDF4AMWX.mjs → chunk-G6IQOE4P.mjs} +251 -370
  25. package/dist/chunk-GOV47PPB.mjs +552 -0
  26. package/dist/chunk-H55LI6WY.js +93 -0
  27. package/dist/chunk-IJT6RRQ5.cjs +93 -0
  28. package/dist/{chunk-ELOOF35R.mjs → chunk-J3H54ZRV.mjs} +1 -1
  29. package/dist/chunk-JF4XXPZ5.cjs +552 -0
  30. package/dist/chunk-JNFRRJYH.cjs +2143 -0
  31. package/dist/chunk-JX3LZQJH.cjs +354 -0
  32. package/dist/chunk-K2T3DV26.mjs +93 -0
  33. package/dist/chunk-KCPT2D6G.js +552 -0
  34. package/dist/chunk-MWXMNYJS.cjs +1110 -0
  35. package/dist/{chunk-VEZNF5GZ.cjs → chunk-N6VHMOWB.cjs} +130 -126
  36. package/dist/{chunk-3QMOKAS5.js → chunk-NC5SDRYE.js} +9 -5
  37. package/dist/chunk-NOYZIMUJ.mjs +144 -0
  38. package/dist/{chunk-R3R2FVLG.cjs → chunk-NYL4D7SK.cjs} +5 -5
  39. package/dist/chunk-OBGZSXTJ.cjs +10 -0
  40. package/dist/{chunk-4NHES7VK.mjs → chunk-OOGJ73B6.js} +11 -7
  41. package/dist/chunk-PNVFW245.js +144 -0
  42. package/dist/chunk-PRWCB3QL.mjs +2491 -0
  43. package/dist/{chunk-JFPU5GQI.mjs → chunk-QY5FKYEQ.js} +488 -421
  44. package/dist/chunk-ROJC3NBJ.js +104 -0
  45. package/dist/chunk-SPUEME2B.cjs +343 -0
  46. package/dist/chunk-TDVMADDN.js +343 -0
  47. package/dist/chunk-TVN5I4U6.cjs +193 -0
  48. package/dist/chunk-U5KWK3PX.mjs +343 -0
  49. package/dist/chunk-VFIUZG7J.mjs +354 -0
  50. package/dist/{chunk-TGIFUAK4.cjs → chunk-WQ5QNU5R.cjs} +459 -578
  51. package/dist/chunk-XDZOO4L5.js +354 -0
  52. package/dist/chunk-Y6FXYEAI.mjs +10 -0
  53. package/dist/{chunk-K6M7MDZ4.mjs → chunk-ZGLD4TVZ.mjs} +9 -5
  54. package/dist/client-CtFmoDvM.d.ts +645 -0
  55. package/dist/core/index.cjs +72 -4
  56. package/dist/core/index.d.ts +92 -198
  57. package/dist/core/index.js +106 -38
  58. package/dist/core/index.mjs +106 -38
  59. package/dist/{effect-CMOQKX8y.d.ts → effect-CGNl5Rqp.d.ts} +107 -1
  60. package/dist/effectRunner-3ZHAD3LE.cjs +8 -0
  61. package/dist/effectRunner-A4CHJXJI.js +8 -0
  62. package/dist/effectRunner-OPUF6QRN.mjs +8 -0
  63. package/dist/http/index.cjs +2189 -1271
  64. package/dist/http/index.d.ts +830 -270
  65. package/dist/http/index.js +2008 -1090
  66. package/dist/http/index.mjs +2008 -1090
  67. package/dist/http/testing.cjs +159 -0
  68. package/dist/http/testing.d.ts +42 -0
  69. package/dist/http/testing.js +159 -0
  70. package/dist/http/testing.mjs +159 -0
  71. package/dist/index.cjs +246 -178
  72. package/dist/index.d.ts +9 -35
  73. package/dist/index.js +120 -52
  74. package/dist/index.mjs +120 -52
  75. package/dist/observability/index.cjs +677 -0
  76. package/dist/observability/index.d.ts +79 -0
  77. package/dist/observability/index.js +677 -0
  78. package/dist/observability/index.mjs +677 -0
  79. package/dist/schedule-Fque9Abz.d.ts +70 -0
  80. package/dist/schema/index.cjs +25 -0
  81. package/dist/schema/index.d.ts +177 -0
  82. package/dist/schema/index.js +25 -0
  83. package/dist/schema/index.mjs +25 -0
  84. package/dist/server-C8hDXA74.d.ts +674 -0
  85. package/dist/{stream-FQm9h4Mg.d.ts → stream-dvSs0QS5.d.ts} +1 -1
  86. package/dist/tracer-B5tRH9H7.d.ts +230 -0
  87. package/dist/tracing-Dt9S_6V8.d.ts +148 -0
  88. package/package.json +27 -1
  89. package/dist/chunk-BDYEENHT.js +0 -224
  90. package/dist/chunk-MS34J5LY.cjs +0 -224
  91. package/dist/chunk-UMAZLXAB.mjs +0 -224
  92. package/dist/chunk-XPZNXSVN.cjs +0 -1043
  93. package/dist/tracing-DNT9jEbr.d.ts +0 -106
@@ -0,0 +1,674 @@
1
+ import { a as MetricExemplar, b as MetricSnapshot, M as MetricsRegistry, T as TraceSampler, c as TraceSamplingInput, C as CircuitBreakerStats, E as EventBus, B as BrassEnv, I as InMemoryTracer, d as Tracer, R as RuntimeSpan, e as InMemoryTracerOptions } from './tracer-B5tRH9H7.js';
2
+ import { T as TraceContext, R as RuntimeHooks, A as Async, J as JSONValue, B as Baggage, f as Runtime, g as RuntimeRegistry, h as RuntimeOptions } from './effect-CGNl5Rqp.js';
3
+ import { A as AdaptiveLimiterStats } from './client-CtFmoDvM.js';
4
+
5
+ declare const PROMETHEUS_CONTENT_TYPE = "text/plain; version=0.0.4; charset=utf-8";
6
+ declare const OTLP_JSON_CONTENT_TYPE = "application/json";
7
+ type PrometheusMetricsOptions = {
8
+ readonly prefix?: string;
9
+ readonly includeTimestamp?: boolean;
10
+ readonly includeExemplars?: boolean;
11
+ readonly help?: Record<string, string>;
12
+ readonly now?: () => number;
13
+ };
14
+ type PrometheusMetricsExporter = {
15
+ readonly contentType: string;
16
+ readonly export: () => string;
17
+ };
18
+ type OtlpAttributeValue = string | number | boolean;
19
+ type OtlpExportOptions = {
20
+ readonly resource?: Record<string, OtlpAttributeValue>;
21
+ readonly scopeName?: string;
22
+ readonly scopeVersion?: string;
23
+ readonly now?: () => number;
24
+ };
25
+ type OtlpHttpResponse = {
26
+ readonly ok?: boolean;
27
+ readonly status?: number;
28
+ readonly statusText?: string;
29
+ readonly text?: () => Promise<string>;
30
+ };
31
+ type OtlpFetch = (url: string, init: {
32
+ readonly method: "POST";
33
+ readonly headers: Record<string, string>;
34
+ readonly body: string;
35
+ }) => Promise<OtlpHttpResponse>;
36
+ type OtlpHttpExporterOptions = OtlpExportOptions & {
37
+ readonly url: string;
38
+ readonly headers?: Record<string, string>;
39
+ readonly fetch?: OtlpFetch;
40
+ };
41
+ type OtlpHttpExportResult = {
42
+ readonly status?: number;
43
+ readonly body: string;
44
+ };
45
+ type RuntimeMetricsSinkOptions = {
46
+ readonly durationBuckets?: readonly number[];
47
+ readonly clock?: () => number;
48
+ readonly includeEventTotals?: boolean;
49
+ readonly includeSpanNameLabel?: boolean;
50
+ };
51
+ declare function makePrometheusMetricsExporter(registry: MetricsRegistry, options?: PrometheusMetricsOptions): PrometheusMetricsExporter;
52
+ declare function formatPrometheusMetrics(snapshot: MetricSnapshot, options?: PrometheusMetricsOptions): string;
53
+ declare function metricsSnapshotToOtlp(snapshot: MetricSnapshot, options?: OtlpExportOptions): {
54
+ resourceMetrics: {
55
+ resource: {
56
+ attributes: {
57
+ key: string;
58
+ value: {
59
+ boolValue: boolean;
60
+ doubleValue?: undefined;
61
+ stringValue?: undefined;
62
+ } | {
63
+ doubleValue: number;
64
+ boolValue?: undefined;
65
+ stringValue?: undefined;
66
+ } | {
67
+ stringValue: string;
68
+ boolValue?: undefined;
69
+ doubleValue?: undefined;
70
+ };
71
+ }[];
72
+ };
73
+ scopeMetrics: {
74
+ scope: Record<string, unknown>;
75
+ metrics: Record<string, unknown>[];
76
+ }[];
77
+ }[];
78
+ };
79
+ declare function makeOtlpHttpMetricsExporter(registry: MetricsRegistry, options: OtlpHttpExporterOptions): {
80
+ export: () => Promise<OtlpHttpExportResult>;
81
+ };
82
+ declare function makeRuntimeMetricsSink(metrics: MetricsRegistry, options?: RuntimeMetricsSinkOptions): RuntimeHooks;
83
+ declare function exemplarFromTraceContext(trace: Pick<Partial<TraceContext>, "traceId" | "spanId"> | undefined, value: number, timestamp?: number, labels?: Record<string, string>): MetricExemplar | undefined;
84
+ declare function toOtlpAttributes(labels: Record<string, OtlpAttributeValue>): {
85
+ key: string;
86
+ value: {
87
+ boolValue: boolean;
88
+ doubleValue?: undefined;
89
+ stringValue?: undefined;
90
+ } | {
91
+ doubleValue: number;
92
+ boolValue?: undefined;
93
+ stringValue?: undefined;
94
+ } | {
95
+ stringValue: string;
96
+ boolValue?: undefined;
97
+ doubleValue?: undefined;
98
+ };
99
+ }[];
100
+ declare function otlpAnyValue(value: OtlpAttributeValue): {
101
+ boolValue: boolean;
102
+ doubleValue?: undefined;
103
+ stringValue?: undefined;
104
+ } | {
105
+ doubleValue: number;
106
+ boolValue?: undefined;
107
+ stringValue?: undefined;
108
+ } | {
109
+ stringValue: string;
110
+ boolValue?: undefined;
111
+ doubleValue?: undefined;
112
+ };
113
+ declare function postOtlpJson(options: OtlpHttpExporterOptions, body: string): Promise<OtlpHttpResponse>;
114
+ declare function unixNanoFromMs(ms: number): string;
115
+
116
+ type RedactionOptions = {
117
+ readonly keys?: readonly (string | RegExp)[];
118
+ readonly headers?: readonly (string | RegExp)[];
119
+ readonly replacement?: string;
120
+ readonly redactUrlQuery?: boolean;
121
+ readonly maxDepth?: number;
122
+ readonly maxStringLength?: number;
123
+ };
124
+ type ObservabilityRedactor = {
125
+ readonly value: (value: unknown) => unknown;
126
+ readonly fields: (fields: Record<string, unknown>) => Record<string, unknown>;
127
+ readonly attributes: (fields: Record<string, unknown>) => Record<string, unknown>;
128
+ readonly headers: (headers: Record<string, string>) => Record<string, string>;
129
+ readonly url: (url: string) => string;
130
+ };
131
+ type RedactionConfig = false | RedactionOptions | ObservabilityRedactor;
132
+ declare function makeObservabilityRedactor(config: RedactionConfig | undefined): ObservabilityRedactor;
133
+
134
+ type LogLevel = "debug" | "info" | "warn" | "error";
135
+ type StructuredLogRecord = {
136
+ readonly ts: string;
137
+ readonly wallTs: number;
138
+ readonly level: LogLevel;
139
+ readonly message: string;
140
+ readonly fields: Record<string, unknown>;
141
+ readonly fiberId?: number;
142
+ readonly scopeId?: number;
143
+ readonly traceId?: string;
144
+ readonly spanId?: string;
145
+ readonly parentSpanId?: string;
146
+ readonly traceState?: string;
147
+ };
148
+ type StructuredLogSinkOptions = {
149
+ readonly minLevel?: LogLevel;
150
+ readonly clock?: () => number;
151
+ readonly write?: (record: StructuredLogRecord) => void;
152
+ readonly redact?: RedactionConfig;
153
+ };
154
+ type StructuredLogSource = {
155
+ readonly exportRecords: () => readonly StructuredLogRecord[];
156
+ } | (() => readonly StructuredLogRecord[]);
157
+ declare function makeStructuredLogSink(options?: StructuredLogSinkOptions): RuntimeHooks;
158
+ declare function formatStructuredLog(record: StructuredLogRecord): string;
159
+ declare function structuredLogsToOtlp(records: readonly StructuredLogRecord[], options?: OtlpExportOptions): {
160
+ resourceLogs: {
161
+ resource: {
162
+ attributes: {
163
+ key: string;
164
+ value: {
165
+ boolValue: boolean;
166
+ doubleValue?: undefined;
167
+ stringValue?: undefined;
168
+ } | {
169
+ doubleValue: number;
170
+ boolValue?: undefined;
171
+ stringValue?: undefined;
172
+ } | {
173
+ stringValue: string;
174
+ boolValue?: undefined;
175
+ doubleValue?: undefined;
176
+ };
177
+ }[];
178
+ };
179
+ scopeLogs: {
180
+ scope: Record<string, unknown>;
181
+ logRecords: {
182
+ attributes: {
183
+ key: string;
184
+ value: {
185
+ boolValue: boolean;
186
+ doubleValue?: undefined;
187
+ stringValue?: undefined;
188
+ } | {
189
+ doubleValue: number;
190
+ boolValue?: undefined;
191
+ stringValue?: undefined;
192
+ } | {
193
+ stringValue: string;
194
+ boolValue?: undefined;
195
+ doubleValue?: undefined;
196
+ };
197
+ }[];
198
+ spanId?: string | undefined;
199
+ traceId?: string | undefined;
200
+ timeUnixNano: string;
201
+ severityText: string;
202
+ severityNumber: number;
203
+ body: {
204
+ stringValue: string;
205
+ };
206
+ }[];
207
+ }[];
208
+ }[];
209
+ };
210
+ declare function makeOtlpHttpLogExporter(source: StructuredLogSource, options: OtlpHttpExporterOptions): {
211
+ export: () => Promise<{
212
+ status: number | undefined;
213
+ body: string;
214
+ logCount: number;
215
+ }>;
216
+ };
217
+ declare function logEffect(level: LogLevel, message: string, fields?: Record<string, unknown>): Async<unknown, never, void>;
218
+ declare function withLogContext<R, E, A>(patch: Record<string, JSONValue>, effect: Async<R, E, A>): Async<R, E, A>;
219
+ declare function defaultStructuredLogWriter(record: StructuredLogRecord): void;
220
+
221
+ type TraceContextHeaderValue = string | readonly string[] | undefined;
222
+ type TraceContextCarrier = Record<string, TraceContextHeaderValue> | Iterable<readonly [string, string]> | {
223
+ get(name: string): string | null | undefined;
224
+ };
225
+ type InjectTraceContextOptions = {
226
+ readonly overwrite?: boolean;
227
+ };
228
+ declare function parseTraceparent(value: string | null | undefined): TraceContext | undefined;
229
+ declare function formatTraceparent(trace: TraceContext): string;
230
+ declare function extractTraceContext(headers: TraceContextCarrier | undefined): TraceContext | undefined;
231
+ declare function injectTraceContext(headers: Record<string, string> | undefined, trace: TraceContext, options?: InjectTraceContextOptions): Record<string, string>;
232
+ declare function parseBaggage(value: string | null | undefined): Baggage | undefined;
233
+ declare function formatBaggage(baggage: Baggage | undefined): string;
234
+ declare function extractBaggage(headers: TraceContextCarrier | undefined): Baggage | undefined;
235
+ declare function injectBaggage(headers: Record<string, string> | undefined, baggage: Baggage | undefined, options?: InjectTraceContextOptions): Record<string, string>;
236
+ declare function normalizeTraceId(id: string): string;
237
+ declare function normalizeSpanId(id: string): string;
238
+
239
+ type ExportSignal = "metrics" | "traces" | "logs";
240
+ type ExportRetryOptions = {
241
+ readonly attempts?: number;
242
+ readonly initialDelayMs?: number;
243
+ readonly maxDelayMs?: number;
244
+ readonly jitterRatio?: number;
245
+ readonly sleep?: (ms: number) => Promise<void>;
246
+ };
247
+ type ExportPipelineTuning = {
248
+ readonly maxQueueSize?: number;
249
+ readonly batchSize?: number;
250
+ readonly timeoutMs?: number;
251
+ readonly retry?: ExportRetryOptions;
252
+ readonly dropPolicy?: "drop-oldest" | "drop-newest";
253
+ readonly shutdownTimeoutMs?: number;
254
+ };
255
+ type ExportBatchResult = {
256
+ readonly status?: number;
257
+ readonly body?: string;
258
+ };
259
+ type ExportPipelineOptions<T> = ExportPipelineTuning & {
260
+ readonly signal: ExportSignal;
261
+ readonly metrics?: MetricsRegistry;
262
+ readonly clock?: () => number;
263
+ readonly exportBatch: (items: readonly T[]) => Promise<ExportBatchResult>;
264
+ readonly onDrop?: (items: readonly T[]) => void;
265
+ };
266
+ type ExportPipelineFlushOptions = {
267
+ readonly deadlineMs?: number;
268
+ };
269
+ type ExportPipelineFlushResult = {
270
+ readonly exported: number;
271
+ readonly dropped: number;
272
+ readonly failed: number;
273
+ readonly batchCount: number;
274
+ readonly attempts: number;
275
+ readonly queueSize: number;
276
+ readonly status?: number;
277
+ readonly body?: string;
278
+ readonly errors: readonly unknown[];
279
+ };
280
+ type ExportPipelineStats = {
281
+ readonly queueSize: number;
282
+ readonly dropped: number;
283
+ };
284
+ type ExportPipeline<T> = {
285
+ readonly enqueue: (items: readonly T[]) => number;
286
+ readonly flush: (options?: ExportPipelineFlushOptions) => Promise<ExportPipelineFlushResult>;
287
+ readonly shutdown: (timeoutMs?: number) => Promise<ExportPipelineFlushResult>;
288
+ readonly stats: () => ExportPipelineStats;
289
+ };
290
+ declare function makeExportPipeline<T>(options: ExportPipelineOptions<T>): ExportPipeline<T>;
291
+ declare function exportWithRetry<T>(operation: () => Promise<T>, options: {
292
+ readonly signal: ExportSignal;
293
+ readonly metrics?: MetricsRegistry;
294
+ readonly retry?: ExportRetryOptions;
295
+ }): Promise<{
296
+ value: T;
297
+ attempts: number;
298
+ }>;
299
+ declare function withTimeout<T>(operation: () => Promise<T>, timeoutMs: number): Promise<T>;
300
+
301
+ type CardinalityLimiterOptions = {
302
+ readonly maxValuesPerLabel?: number;
303
+ readonly overflowValue?: string;
304
+ };
305
+ type CardinalityConfig = false | CardinalityLimiterOptions;
306
+ declare function makeCardinalityLimitedMetrics(registry: MetricsRegistry, options?: CardinalityLimiterOptions): MetricsRegistry;
307
+ declare function normalizeHttpRoute(path: string | undefined): string | undefined;
308
+ declare function sanitizeHttpTarget(url: string | undefined): string | undefined;
309
+
310
+ type TraceSamplingRule = {
311
+ readonly name?: string | RegExp;
312
+ readonly route?: string | RegExp;
313
+ readonly ratio?: number;
314
+ readonly sampled?: boolean;
315
+ };
316
+ type TraceSamplingOptions = {
317
+ readonly ratio?: number;
318
+ readonly rules?: readonly TraceSamplingRule[];
319
+ readonly sampler?: TraceSampler;
320
+ readonly respectRemoteSampled?: boolean;
321
+ readonly forceSampleOnError?: boolean;
322
+ };
323
+ type ResolvedTraceSampling = {
324
+ readonly sampler: TraceSampler;
325
+ readonly respectRemoteSampled: boolean;
326
+ readonly forceSampleOnError: boolean;
327
+ };
328
+ type TraceSamplingConfig = false | number | TraceSampler | TraceSamplingOptions;
329
+ declare const alwaysOnSampler: TraceSampler;
330
+ declare const alwaysOffSampler: TraceSampler;
331
+ declare function ratioSampler(ratio: number): TraceSampler;
332
+ declare function makeTraceSampler(options?: TraceSamplingOptions): TraceSampler;
333
+ declare function resolveTraceSampling(config: TraceSamplingConfig | undefined): ResolvedTraceSampling;
334
+ declare function shouldSampleWith(sampler: TraceSampler | undefined, input: TraceSamplingInput): boolean;
335
+
336
+ type HealthStatus = "ok" | "degraded" | "down";
337
+ type HealthCheckResult = {
338
+ readonly status: HealthStatus;
339
+ readonly message?: string;
340
+ readonly details?: Record<string, unknown>;
341
+ };
342
+ type HealthCheck = () => HealthCheckResult;
343
+ type RuntimeHealthOptions = {
344
+ readonly runtime?: Runtime<any>;
345
+ readonly registry?: RuntimeRegistry;
346
+ readonly metrics?: MetricsRegistry;
347
+ readonly circuitBreakers?: Record<string, {
348
+ stats: () => CircuitBreakerStats;
349
+ }>;
350
+ readonly adaptiveLimiters?: Record<string, {
351
+ stats: () => AdaptiveLimiterStats;
352
+ }>;
353
+ readonly checks?: Record<string, HealthCheck>;
354
+ readonly clock?: () => number;
355
+ readonly readiness?: {
356
+ readonly failOnDegraded?: boolean;
357
+ };
358
+ };
359
+ type RuntimeHealthReport = {
360
+ readonly status: HealthStatus;
361
+ readonly ready: boolean;
362
+ readonly checkedAt: string;
363
+ readonly fibers?: {
364
+ readonly active: number;
365
+ readonly suspended: number;
366
+ readonly done: number;
367
+ };
368
+ readonly scopes?: {
369
+ readonly open: number;
370
+ readonly closed: number;
371
+ };
372
+ readonly runtime?: {
373
+ readonly engine?: string;
374
+ readonly fiberStats?: unknown;
375
+ readonly scheduler?: unknown;
376
+ };
377
+ readonly metrics?: {
378
+ readonly counters: number;
379
+ readonly gauges: number;
380
+ readonly histograms: number;
381
+ readonly activeFibers?: number;
382
+ readonly activeScopes?: number;
383
+ readonly activeSpans?: number;
384
+ };
385
+ readonly circuitBreakers: Record<string, CircuitBreakerStats & {
386
+ readonly status: HealthStatus;
387
+ }>;
388
+ readonly adaptiveLimiters: Record<string, AdaptiveLimiterStats & {
389
+ readonly status: HealthStatus;
390
+ }>;
391
+ readonly checks: Record<string, HealthCheckResult>;
392
+ };
393
+ type HealthHttpResponse = {
394
+ readonly status: number;
395
+ readonly headers: Record<string, string>;
396
+ readonly body: string;
397
+ };
398
+ declare function snapshotRuntimeHealth(options?: RuntimeHealthOptions): RuntimeHealthReport;
399
+ declare function makeRuntimeHealth(options?: RuntimeHealthOptions): Async<unknown, never, RuntimeHealthReport>;
400
+ declare const runtimeHealth: typeof makeRuntimeHealth;
401
+ declare function readiness(options?: RuntimeHealthOptions): Async<unknown, never, boolean>;
402
+ declare function healthToHttpResponse(report: RuntimeHealthReport): HealthHttpResponse;
403
+
404
+ type ObservabilityOtlpOptions = {
405
+ readonly metricsUrl?: string;
406
+ readonly tracesUrl?: string;
407
+ readonly logsUrl?: string;
408
+ readonly headers?: Record<string, string>;
409
+ readonly fetch?: OtlpFetch;
410
+ readonly timeoutMs?: number;
411
+ readonly retry?: ExportRetryOptions;
412
+ readonly pipeline?: ExportPipelineTuning;
413
+ };
414
+ type ObservabilityOptions = {
415
+ readonly serviceName?: string;
416
+ readonly serviceVersion?: string;
417
+ readonly resource?: Record<string, OtlpAttributeValue>;
418
+ readonly eventBus?: EventBus;
419
+ readonly metrics?: false | (RuntimeMetricsSinkOptions & {
420
+ readonly prometheus?: PrometheusMetricsOptions;
421
+ });
422
+ readonly logs?: false | StructuredLogSinkOptions;
423
+ readonly traces?: false | Omit<InMemoryTracerOptions, "sanitizeAttributes" | "sanitizeError">;
424
+ readonly sampling?: TraceSamplingConfig;
425
+ readonly redaction?: RedactionConfig;
426
+ readonly cardinality?: CardinalityConfig;
427
+ readonly otlp?: ObservabilityOtlpOptions;
428
+ readonly flushIntervalMs?: number;
429
+ readonly autoStart?: boolean;
430
+ readonly traceSeed?: TraceContext;
431
+ readonly childName?: (parentName?: string) => string | undefined;
432
+ readonly onFlushError?: (error: unknown, signal: "metrics" | "traces" | "logs") => void;
433
+ };
434
+ type ObservabilityRequestEnvInput = TraceContextCarrier | {
435
+ readonly headers?: TraceContextCarrier;
436
+ readonly trace?: TraceContext;
437
+ readonly traceparent?: string;
438
+ readonly tracestate?: string;
439
+ readonly baggage?: Baggage | string;
440
+ };
441
+ type ObservabilityFlushError = {
442
+ readonly signal: "metrics" | "traces" | "logs";
443
+ readonly error: unknown;
444
+ };
445
+ type ObservabilityTraceExportResult = OtlpHttpExportResult & {
446
+ readonly spanCount: number;
447
+ };
448
+ type ObservabilityLogExportResult = OtlpHttpExportResult & {
449
+ readonly logCount: number;
450
+ };
451
+ type ObservabilityFlushResult = {
452
+ readonly metrics?: OtlpHttpExportResult;
453
+ readonly traces?: ObservabilityTraceExportResult;
454
+ readonly logs?: ObservabilityLogExportResult;
455
+ readonly errors: readonly ObservabilityFlushError[];
456
+ };
457
+ type ObservabilityExporters = {
458
+ readonly prometheus: PrometheusMetricsExporter;
459
+ readonly otlpMetrics?: {
460
+ readonly export: () => Promise<OtlpHttpExportResult>;
461
+ };
462
+ readonly otlpTraces?: {
463
+ readonly export: () => Promise<ObservabilityTraceExportResult>;
464
+ readonly pipeline: ExportPipeline<RuntimeSpan>;
465
+ };
466
+ readonly otlpLogs?: {
467
+ readonly export: () => Promise<ObservabilityLogExportResult>;
468
+ readonly pipeline: ExportPipeline<StructuredLogRecord>;
469
+ };
470
+ };
471
+ type ObservabilityRuntimeEnv = BrassEnv;
472
+ type Observability = {
473
+ readonly hooks: EventBus;
474
+ readonly eventBus: EventBus;
475
+ readonly env: ObservabilityRuntimeEnv;
476
+ readonly envForRequest: (input?: ObservabilityRequestEnvInput) => ObservabilityRuntimeEnv;
477
+ readonly metrics: MetricsRegistry;
478
+ readonly tracer: InMemoryTracer;
479
+ readonly traceIdGenerator: Tracer;
480
+ readonly exporters: ObservabilityExporters;
481
+ readonly prometheus: PrometheusMetricsExporter;
482
+ readonly health: (options?: Omit<RuntimeHealthOptions, "metrics">) => RuntimeHealthReport;
483
+ readonly readiness: (options?: Omit<RuntimeHealthOptions, "metrics">) => boolean;
484
+ readonly flush: () => Promise<ObservabilityFlushResult>;
485
+ readonly start: () => void;
486
+ readonly stop: () => void;
487
+ readonly shutdown: () => Promise<ObservabilityFlushResult>;
488
+ };
489
+ declare function makeObservability(options?: ObservabilityOptions): Observability;
490
+ declare function resolveRequestTraceSeed(input?: ObservabilityRequestEnvInput): TraceContext | undefined;
491
+ declare function resolveRequestBaggage(input?: ObservabilityRequestEnvInput): Baggage | undefined;
492
+
493
+ type SpanAttributes = Record<string, string | number | boolean>;
494
+ type SpanLink = {
495
+ readonly traceId: string;
496
+ readonly spanId: string;
497
+ readonly traceState?: string;
498
+ readonly attributes?: SpanAttributes;
499
+ };
500
+ type SpanOptions = {
501
+ readonly attributes?: SpanAttributes;
502
+ readonly links?: readonly SpanLink[];
503
+ };
504
+ type SpanSource = {
505
+ readonly exportFinished: () => readonly RuntimeSpan[];
506
+ } | (() => readonly RuntimeSpan[]);
507
+ declare function withSpan<R, E, A>(name: string, effect: Async<R, E, A>, attributesOrOptions?: SpanAttributes | SpanOptions): Async<R, E, A>;
508
+ declare function spanLink(trace: TraceContext, attributes?: SpanAttributes): SpanLink;
509
+ declare function currentSpanLink(attributes?: SpanAttributes): SpanLink | undefined;
510
+ declare function withBaggage<R, E, A>(baggage: Baggage, effect: Async<R, E, A>): Async<R, E, A>;
511
+ declare function currentBaggage(): Baggage | undefined;
512
+ declare function spanEvent(name: string, attributes?: SpanAttributes): Async<unknown, never, void>;
513
+ declare function spansToOtlp(spans: readonly RuntimeSpan[], options?: OtlpExportOptions): {
514
+ resourceSpans: {
515
+ resource: {
516
+ attributes: {
517
+ key: string;
518
+ value: {
519
+ boolValue: boolean;
520
+ doubleValue?: undefined;
521
+ stringValue?: undefined;
522
+ } | {
523
+ doubleValue: number;
524
+ boolValue?: undefined;
525
+ stringValue?: undefined;
526
+ } | {
527
+ stringValue: string;
528
+ boolValue?: undefined;
529
+ doubleValue?: undefined;
530
+ };
531
+ }[];
532
+ };
533
+ scopeSpans: {
534
+ scope: Record<string, unknown>;
535
+ spans: {
536
+ name: string;
537
+ kind: number;
538
+ startTimeUnixNano: string;
539
+ endTimeUnixNano: string;
540
+ attributes: {
541
+ key: string;
542
+ value: {
543
+ boolValue: boolean;
544
+ doubleValue?: undefined;
545
+ stringValue?: undefined;
546
+ } | {
547
+ doubleValue: number;
548
+ boolValue?: undefined;
549
+ stringValue?: undefined;
550
+ } | {
551
+ stringValue: string;
552
+ boolValue?: undefined;
553
+ doubleValue?: undefined;
554
+ };
555
+ }[];
556
+ events: {
557
+ name: string;
558
+ timeUnixNano: string;
559
+ attributes: {
560
+ key: string;
561
+ value: {
562
+ boolValue: boolean;
563
+ doubleValue?: undefined;
564
+ stringValue?: undefined;
565
+ } | {
566
+ doubleValue: number;
567
+ boolValue?: undefined;
568
+ stringValue?: undefined;
569
+ } | {
570
+ stringValue: string;
571
+ boolValue?: undefined;
572
+ doubleValue?: undefined;
573
+ };
574
+ }[];
575
+ }[];
576
+ links: {
577
+ attributes: {
578
+ key: string;
579
+ value: {
580
+ boolValue: boolean;
581
+ doubleValue?: undefined;
582
+ stringValue?: undefined;
583
+ } | {
584
+ doubleValue: number;
585
+ boolValue?: undefined;
586
+ stringValue?: undefined;
587
+ } | {
588
+ stringValue: string;
589
+ boolValue?: undefined;
590
+ doubleValue?: undefined;
591
+ };
592
+ }[];
593
+ traceState?: string | undefined;
594
+ traceId: string;
595
+ spanId: string;
596
+ }[];
597
+ status: {
598
+ code: number;
599
+ message: any;
600
+ } | {
601
+ code: number;
602
+ message?: undefined;
603
+ };
604
+ traceState?: string | undefined;
605
+ parentSpanId?: string | undefined;
606
+ traceId: string;
607
+ spanId: string;
608
+ }[];
609
+ }[];
610
+ }[];
611
+ };
612
+ declare function makeOtlpHttpSpanExporter(source: SpanSource, options: OtlpHttpExporterOptions): {
613
+ export: () => Promise<{
614
+ status: number | undefined;
615
+ body: string;
616
+ }>;
617
+ };
618
+
619
+ type RequestObservabilityContextInput = {
620
+ readonly headers?: TraceContextCarrier;
621
+ readonly trace?: TraceContext;
622
+ readonly traceparent?: string;
623
+ readonly tracestate?: string;
624
+ readonly baggage?: Baggage | string;
625
+ readonly method?: string;
626
+ readonly target?: string;
627
+ readonly route?: string;
628
+ readonly spanName?: string;
629
+ readonly attributes?: SpanAttributes;
630
+ };
631
+ type RequestObservabilityRuntimeOptions<R extends object> = Omit<RuntimeOptions<R & ObservabilityRuntimeEnv>, "env" | "hooks">;
632
+ type RequestObservabilityContext = {
633
+ readonly env: ObservabilityRuntimeEnv;
634
+ readonly trace?: TraceContext;
635
+ readonly route?: string;
636
+ readonly attributes: SpanAttributes;
637
+ readonly makeRuntime: <R extends object = {}>(env?: R, options?: RequestObservabilityRuntimeOptions<R>) => Runtime<R & ObservabilityRuntimeEnv>;
638
+ readonly run: <R extends object = {}, E = never, A = never>(effect: Async<R & ObservabilityRuntimeEnv, E, A>, env?: R, options?: RequestObservabilityRuntimeOptions<R>) => Promise<A>;
639
+ readonly span: <R, E, A>(name: string, effect: Async<R, E, A>, attributes?: SpanAttributes) => Async<R, E, A>;
640
+ readonly withRequestSpan: <R, E, A>(effect: Async<R, E, A>, attributes?: SpanAttributes) => Async<R, E, A>;
641
+ readonly flush: () => Promise<ObservabilityFlushResult>;
642
+ readonly shutdown: () => Promise<ObservabilityFlushResult>;
643
+ };
644
+ declare function makeRequestObservabilityContext(observability: Observability, input?: RequestObservabilityContextInput): RequestObservabilityContext;
645
+
646
+ type HttpServerOutcome = "success" | "error" | "exception";
647
+ type HttpServerObservabilityLogOptions = {
648
+ readonly requestLevel?: LogLevel | false;
649
+ readonly responseLevel?: LogLevel | false;
650
+ readonly errorLevel?: LogLevel | false;
651
+ };
652
+ type HttpServerObservabilitySpanOptions = {
653
+ readonly name?: string | ((input: RequestObservabilityContextInput) => string);
654
+ readonly attributes?: SpanAttributes | ((input: RequestObservabilityContextInput) => SpanAttributes);
655
+ };
656
+ type HttpServerObservabilityOptions<A = unknown> = {
657
+ readonly metrics?: MetricsRegistry | false;
658
+ readonly logs?: false | HttpServerObservabilityLogOptions;
659
+ readonly spans?: false | HttpServerObservabilitySpanOptions;
660
+ readonly includeRouteLabel?: boolean;
661
+ readonly clock?: () => number;
662
+ readonly durationBuckets?: readonly number[];
663
+ readonly statusCode?: (value: A) => number | undefined;
664
+ };
665
+ type ObservedHttpServerResult<A> = {
666
+ readonly value: A;
667
+ readonly ctx: RequestObservabilityContext;
668
+ readonly statusCode: number;
669
+ readonly durationMs: number;
670
+ };
671
+ declare function runObservedHttpServerEffect<R extends object = {}, E = never, A = never>(observability: Observability, input: RequestObservabilityContextInput, effect: Async<R, E, A>, options?: HttpServerObservabilityOptions<A>, env?: R, runtimeOptions?: RequestObservabilityRuntimeOptions<R>): Promise<ObservedHttpServerResult<A>>;
672
+ declare function observeHttpServerRequest<A>(observability: Observability, input: RequestObservabilityContextInput, handler: (ctx: RequestObservabilityContext) => Promise<A>, options?: HttpServerObservabilityOptions<A>): Promise<ObservedHttpServerResult<A>>;
673
+
674
+ export { type RuntimeMetricsSinkOptions as $, type ObservabilityRuntimeEnv as A, type ObservabilityTraceExportResult as B, type CardinalityConfig as C, type ObservedHttpServerResult as D, type ExportBatchResult as E, type OtlpAttributeValue as F, type OtlpExportOptions as G, type HealthCheck as H, type InjectTraceContextOptions as I, type OtlpFetch as J, type OtlpHttpExportResult as K, type LogLevel as L, type OtlpHttpExporterOptions as M, type OtlpHttpResponse as N, type Observability as O, PROMETHEUS_CONTENT_TYPE as P, type PrometheusMetricsExporter as Q, type RequestObservabilityContextInput as R, type SpanAttributes as S, type TraceContextCarrier as T, type PrometheusMetricsOptions as U, type RedactionConfig as V, type RedactionOptions as W, type RequestObservabilityRuntimeOptions as X, type ResolvedTraceSampling as Y, type RuntimeHealthOptions as Z, type RuntimeHealthReport as _, type RequestObservabilityContext as a, toOtlpAttributes as a$, type SpanLink as a0, type SpanOptions as a1, type SpanSource as a2, type StructuredLogRecord as a3, type StructuredLogSinkOptions as a4, type StructuredLogSource as a5, type TraceContextHeaderValue as a6, type TraceSamplingConfig as a7, type TraceSamplingOptions as a8, type TraceSamplingRule as a9, makeRuntimeHealth as aA, makeRuntimeMetricsSink as aB, makeStructuredLogSink as aC, makeTraceSampler as aD, metricsSnapshotToOtlp as aE, normalizeHttpRoute as aF, normalizeSpanId as aG, normalizeTraceId as aH, observeHttpServerRequest as aI, otlpAnyValue as aJ, parseBaggage as aK, parseTraceparent as aL, postOtlpJson as aM, ratioSampler as aN, readiness as aO, resolveRequestBaggage as aP, resolveRequestTraceSeed as aQ, resolveTraceSampling as aR, runObservedHttpServerEffect as aS, runtimeHealth as aT, sanitizeHttpTarget as aU, shouldSampleWith as aV, snapshotRuntimeHealth as aW, spanEvent as aX, spanLink as aY, spansToOtlp as aZ, structuredLogsToOtlp as a_, alwaysOffSampler as aa, alwaysOnSampler as ab, currentBaggage as ac, currentSpanLink as ad, defaultStructuredLogWriter as ae, exemplarFromTraceContext as af, exportWithRetry as ag, extractBaggage as ah, extractTraceContext as ai, formatBaggage as aj, formatPrometheusMetrics as ak, formatStructuredLog as al, formatTraceparent as am, healthToHttpResponse as an, injectBaggage as ao, injectTraceContext as ap, logEffect as aq, makeCardinalityLimitedMetrics as ar, makeExportPipeline as as, makeObservability as at, makeObservabilityRedactor as au, makeOtlpHttpLogExporter as av, makeOtlpHttpMetricsExporter as aw, makeOtlpHttpSpanExporter as ax, makePrometheusMetricsExporter as ay, makeRequestObservabilityContext as az, type ObservabilityOptions as b, unixNanoFromMs as b0, withBaggage as b1, withLogContext as b2, withSpan as b3, withTimeout as b4, type CardinalityLimiterOptions as c, type ExportPipeline as d, type ExportPipelineFlushOptions as e, type ExportPipelineFlushResult as f, type ExportPipelineOptions as g, type ExportPipelineStats as h, type ExportPipelineTuning as i, type ExportRetryOptions as j, type ExportSignal as k, type HealthCheckResult as l, type HealthHttpResponse as m, type HealthStatus as n, type HttpServerObservabilityLogOptions as o, type HttpServerObservabilityOptions as p, type HttpServerObservabilitySpanOptions as q, type HttpServerOutcome as r, OTLP_JSON_CONTENT_TYPE as s, type ObservabilityExporters as t, type ObservabilityFlushError as u, type ObservabilityFlushResult as v, type ObservabilityLogExportResult as w, type ObservabilityOtlpOptions as x, type ObservabilityRedactor as y, type ObservabilityRequestEnvInput as z };
@@ -1,4 +1,4 @@
1
- import { Z as ZIO, O as Option, E as Exit, A as Async } from './effect-CMOQKX8y.js';
1
+ import { Z as ZIO, O as Option, E as Exit, A as Async } from './effect-CGNl5Rqp.js';
2
2
 
3
3
  type Empty<R, E, A> = {
4
4
  readonly _tag: "Empty";