@osfactory/otel-hook 0.8.0 → 0.9.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.
@@ -57,6 +57,28 @@ declare const exporterPolicySchema: z.ZodObject<{
57
57
  includeContent: z.ZodBoolean;
58
58
  maxBatchSize: z.ZodNumber;
59
59
  }, z.core.$strict>;
60
+ destinations: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
61
+ name: z.ZodString;
62
+ enabled: z.ZodOptional<z.ZodBoolean>;
63
+ endpoint: z.ZodOptional<z.ZodString>;
64
+ tracesEndpoint: z.ZodOptional<z.ZodString>;
65
+ logsEndpoint: z.ZodOptional<z.ZodString>;
66
+ protocol: z.ZodOptional<z.ZodEnum<{
67
+ none: "none";
68
+ "http/protobuf": "http/protobuf";
69
+ "http/json": "http/json";
70
+ }>>;
71
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
72
+ signals: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
73
+ traces: "traces";
74
+ logs: "logs";
75
+ }>>>>;
76
+ }, z.core.$strict>>>>;
77
+ spool: z.ZodOptional<z.ZodObject<{
78
+ maxBytes: z.ZodOptional<z.ZodNumber>;
79
+ maxAgeMillis: z.ZodOptional<z.ZodNumber>;
80
+ maxBatches: z.ZodOptional<z.ZodNumber>;
81
+ }, z.core.$strict>>;
60
82
  }, z.core.$strict>;
61
83
  type ExporterPolicy = z.infer<typeof exporterPolicySchema>;
62
84
  declare const detectionPolicySchema: z.ZodObject<{
@@ -104,6 +126,28 @@ declare const otelHookConfigSchema: z.ZodObject<{
104
126
  includeContent: z.ZodBoolean;
105
127
  maxBatchSize: z.ZodNumber;
106
128
  }, z.core.$strict>;
129
+ destinations: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
130
+ name: z.ZodString;
131
+ enabled: z.ZodOptional<z.ZodBoolean>;
132
+ endpoint: z.ZodOptional<z.ZodString>;
133
+ tracesEndpoint: z.ZodOptional<z.ZodString>;
134
+ logsEndpoint: z.ZodOptional<z.ZodString>;
135
+ protocol: z.ZodOptional<z.ZodEnum<{
136
+ none: "none";
137
+ "http/protobuf": "http/protobuf";
138
+ "http/json": "http/json";
139
+ }>>;
140
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
141
+ signals: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
142
+ traces: "traces";
143
+ logs: "logs";
144
+ }>>>>;
145
+ }, z.core.$strict>>>>;
146
+ spool: z.ZodOptional<z.ZodObject<{
147
+ maxBytes: z.ZodOptional<z.ZodNumber>;
148
+ maxAgeMillis: z.ZodOptional<z.ZodNumber>;
149
+ maxBatches: z.ZodOptional<z.ZodNumber>;
150
+ }, z.core.$strict>>;
107
151
  }, z.core.$strict>;
108
152
  privacy: z.ZodObject<{
109
153
  contentMode: z.ZodEnum<{
@@ -153,25 +197,47 @@ declare const otelHookConfigPatchSchema: z.ZodObject<{
153
197
  exporter: z.ZodOptional<z.ZodObject<{
154
198
  serviceName: z.ZodOptional<z.ZodString>;
155
199
  serviceNamespace: z.ZodOptional<z.ZodOptional<z.ZodString>>;
156
- enabled: z.ZodOptional<z.ZodBoolean>;
157
200
  protocol: z.ZodOptional<z.ZodEnum<{
158
201
  none: "none";
159
202
  "http/protobuf": "http/protobuf";
160
203
  "http/json": "http/json";
161
204
  }>>;
205
+ enabled: z.ZodOptional<z.ZodBoolean>;
162
206
  endpoint: z.ZodOptional<z.ZodOptional<z.ZodString>>;
163
- maxBatchSize: z.ZodOptional<z.ZodNumber>;
164
207
  headerNames: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
165
208
  timeoutMillis: z.ZodOptional<z.ZodNumber>;
209
+ maxBatchSize: z.ZodOptional<z.ZodNumber>;
166
210
  maxQueueSize: z.ZodOptional<z.ZodNumber>;
167
211
  maxRetryAttempts: z.ZodOptional<z.ZodNumber>;
168
212
  resourceAttributes: z.ZodOptional<z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>>;
213
+ destinations: z.ZodOptional<z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
214
+ name: z.ZodString;
215
+ enabled: z.ZodOptional<z.ZodBoolean>;
216
+ endpoint: z.ZodOptional<z.ZodString>;
217
+ tracesEndpoint: z.ZodOptional<z.ZodString>;
218
+ logsEndpoint: z.ZodOptional<z.ZodString>;
219
+ protocol: z.ZodOptional<z.ZodEnum<{
220
+ none: "none";
221
+ "http/protobuf": "http/protobuf";
222
+ "http/json": "http/json";
223
+ }>>;
224
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
225
+ signals: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
226
+ traces: "traces";
227
+ logs: "logs";
228
+ }>>>>;
229
+ }, z.core.$strict>>>>>;
169
230
  logs: z.ZodOptional<z.ZodObject<{
170
231
  enabled: z.ZodOptional<z.ZodBoolean>;
171
232
  endpoint: z.ZodOptional<z.ZodOptional<z.ZodString>>;
172
233
  includeContent: z.ZodOptional<z.ZodBoolean>;
173
234
  maxBatchSize: z.ZodOptional<z.ZodNumber>;
174
235
  }, z.core.$strict>>;
236
+ spool: z.ZodOptional<z.ZodObject<{
237
+ maxBytes: z.ZodOptional<z.ZodNumber>;
238
+ maxAgeMillis: z.ZodOptional<z.ZodNumber>;
239
+ maxBatches: z.ZodOptional<z.ZodNumber>;
240
+ }, z.core.$strict>>;
175
241
  }, z.core.$strict>>;
176
242
  privacy: z.ZodOptional<z.ZodObject<{
177
243
  contentMode: z.ZodOptional<z.ZodEnum<{
@@ -1,77 +1,34 @@
1
- import { b as SpanCorrelationResolver } from './semconv-fPRb-dpU.js';
2
- export { D as DEFAULT_INSTRUMENTATION_SCOPE, E as EventTraceIdentity, M as MAX_RECOVERED_START_ATTRIBUTES, S as SemanticMappingOptions, a as SpanCorrelation, c as SpanDisposition, d as SpanFamily, e as SpanOrphanClassification, f as SpanPairing, g as SpanScopeRef, h as canonicalEventTraceIdentities, i as canonicalEventsToReadableSpans, p as parentScopeRefOf, s as spanScopeRefOf, j as startOnlySpanAttributes } from './semconv-fPRb-dpU.js';
3
- import { o as OtlpTelemetrySink, n as OtlpLogTelemetrySink } from './otlp-log-sink-zuHojHSP.js';
4
- export { C as ContentWithholdingReason, D as DurableLogSpool, a as DurableLogSpoolOptions, b as DurableSpool, c as DurableSpoolOptions, L as LOG_MAPPING_VERSION, d as LOG_SIGNALS, e as LogContentPolicy, f as LogMappingOptions, g as LogMappingResult, h as LogSignal, i as LogSpoolBatch, j as LogsDeliverability, M as MAX_LOG_BODY_CHARACTERS, k as MAX_LOG_RECORDS_PER_BATCH, l as MAX_LOG_RECORDS_PER_EVENT, m as MCP_TOOL_NAME_PATTERN, N as NO_LOG_CONTENT, O as OtlpLogSinkOptions, p as OtlpTraceSinkOptions, S as SerializedLogRecord, q as SerializedSpan, r as SpoolBatch, s as SpoolDrainResult, t as SpoolEnqueueResult, u as canonicalEventsToLogRecords, v as createFileDurableLogSpool, w as createFileDurableSpool, x as createOtlpLogSink, y as createOtlpTraceSink, z as describeLogsDeliverability, A as logSignalOf, B as logSignalsForLifecycleEvents, E as resolveLogsEndpoint } from './otlp-log-sink-zuHojHSP.js';
5
- import { DeliveryHealthSnapshot } from './diagnostics.js';
6
- import { g as TelemetrySink } from './ports-n7KFOpKo.js';
1
+ export { D as DEFAULT_INSTRUMENTATION_SCOPE, E as EventTraceIdentity, M as MAX_RECOVERED_START_ATTRIBUTES, S as SemanticMappingOptions, a as SpanCorrelation, b as SpanCorrelationResolver, c as SpanDisposition, d as SpanFamily, e as SpanOrphanClassification, f as SpanPairing, g as SpanScopeRef, h as canonicalEventTraceIdentities, i as canonicalEventsToReadableSpans, p as parentScopeRefOf, s as spanScopeRefOf, j as startOnlySpanAttributes } from './semconv-fPRb-dpU.js';
2
+ export { C as ContentWithholdingReason, D as DurableLogSpool, a as DurableLogSpoolOptions, b as DurableSpool, c as DurableSpoolOptions, E as ExportDestinationSinks, d as ExportDestinationsOptions, L as LOG_MAPPING_VERSION, e as LOG_SIGNALS, f as LogContentPolicy, g as LogMappingOptions, h as LogMappingResult, i as LogSignal, j as LogSpoolBatch, k as LogsDeliverability, M as MAX_LOG_BODY_CHARACTERS, l as MAX_LOG_RECORDS_PER_BATCH, m as MAX_LOG_RECORDS_PER_EVENT, n as MCP_TOOL_NAME_PATTERN, N as NO_LOG_CONTENT, O as OtlpLogSinkOptions, o as OtlpLogTelemetrySink, p as OtlpTelemetrySink, q as OtlpTraceSinkOptions, S as SerializedLogRecord, r as SerializedSpan, s as SignalFanoutOptions, t as SignalFanoutSink, u as SkippedExportDestination, v as SpoolBatch, w as SpoolDrainResult, x as SpoolDropCounts, y as SpoolDropReason, z as SpoolEnqueueResult, A as SpoolOverflowPolicy, B as SpoolSendOutcome, F as SpoolStats, G as canonicalEventsToLogRecords, H as createDestinationFanout, I as createExportDestinationSinks, J as createFileDurableLogSpool, K as createFileDurableSpool, P as createOtlpLogSink, Q as createOtlpTraceSink, R as createSignalFanout, T as describeLogsDeliverability, U as exporterPolicyForDestination, V as logSignalOf, W as logSignalsForLifecycleEvents, X as resolveLogsEndpoint, Y as shareCorrelationPerBatch, Z as spoolQueueNamesFor } from './export-destinations-d8tZV0G4.js';
3
+ import { ExportResult } from '@opentelemetry/core';
7
4
  import '@opentelemetry/api';
8
- import '@opentelemetry/core';
9
5
  import '@opentelemetry/resources';
10
6
  import '@opentelemetry/sdk-trace';
11
7
  import './events-B3MHoJTD.js';
12
8
  import 'zod';
13
- import './schema-Cn0-xz8L.js';
9
+ import './destinations-C6Bm89W6.js';
10
+ import './schema-BxiVsU-d.js';
11
+ import './ports-n7KFOpKo.js';
12
+ import './errors.js';
13
+ import './primitives-CJ8-rn-f.js';
14
+ import './taxonomy-DwhTtuWd.js';
14
15
  import './keys-Dej5bN3L.js';
15
16
  import '@opentelemetry/sdk-logs';
16
17
  import './content-M9xIKG7h.js';
17
- import './primitives-CJ8-rn-f.js';
18
- import './taxonomy-DwhTtuWd.js';
19
- import './errors.js';
18
+ import './diagnostics.js';
20
19
 
21
20
  /**
22
- * One canonical batch, two OTLP signals.
23
- *
24
- * A hook has a single {@link TelemetrySink} seam, and both signals map the *same*
25
- * canonical events — so this fans one batch out rather than making the orchestrator
26
- * aware that there is more than one destination.
27
- *
28
- * ## Durability adds up across signals
29
- *
30
- * The counts are summed rather than taken from the primary signal, because the
31
- * caller's question is "may I commit this callback?" and the answer turns on whether
32
- * *anything* reached a collector or a spool. Summing gives `classifyDurability`
33
- * exactly the right inputs:
34
- *
35
- * - both signals delivered → `delivered`
36
- * - neither delivered → `lost`, and the callback is safe to retry precisely because
37
- * there is nothing to duplicate
38
- * - one delivered and one did not → `partial`, which is terminal: retrying would
39
- * re-export what the healthy signal already delivered, and a duplicate silently
40
- * corrupts a total whereas a reported loss is a number somebody can act on
41
- *
42
- * A disabled sink accepts everything, so an installation with logs off behaves
43
- * exactly as it did before logs existed.
44
- *
45
- * ## Correlation must be resolved once per batch
46
- *
47
- * Both sinks want the same pairing facts, and `SpanCorrelator.correlateBatch` is not
48
- * a read — it records a start edge, marks a scope published, and takes the session
49
- * lock to do it. Wrap the correlator in {@link shareCorrelationPerBatch} and give
50
- * *the same wrapped function* to both sinks; `emit` here is sequential so the first
51
- * sink resolves it and the second is served the memoized answer.
52
- */
53
- type SignalFanoutOptions = {
54
- readonly traces: OtlpTelemetrySink;
55
- readonly logs: OtlpLogTelemetrySink;
56
- };
57
- interface SignalFanoutSink extends TelemetrySink {
58
- /** One snapshot per wired signal, in a stable order: traces, then logs. */
59
- health(): readonly DeliveryHealthSnapshot[];
60
- }
61
- declare const createSignalFanout: (options: SignalFanoutOptions) => SignalFanoutSink;
62
- /**
63
- * Wrap a correlation resolver so one batch resolves at most once.
64
- *
65
- * Memoized on the identity of the `events` array, which is what makes it correct
66
- * without a reset: every batch is a distinct array, so a new batch cannot be served
67
- * a previous one's answer, and a retry of the *same* array deliberately is. The
68
- * promise is cached rather than its value, so two callers arriving before the first
69
- * resolution completes still share it.
70
- *
71
- * Exported because the one-call-per-batch property is a requirement of the
72
- * correlator, not a convenience of the fanout: a host wiring its own pair of sinks
73
- * needs to be able to express it too.
21
+ * Whether a failed export was a permanent refusal.
22
+ *
23
+ * With `@opentelemetry/otlp-exporter-base` (OpenTelemetry JS 3.x), the HTTP
24
+ * transport reports a status outside its own retryable set (429, 502, 503, 504)
25
+ * as an `OTLPExporterError` whose numeric `code` is the HTTP status — so 400,
26
+ * 401, 408, 413, and 500 all arrive with a `code`, and 408 and 500 are then held
27
+ * retryable here. Its retryable statuses are retried inside the exporter and,
28
+ * once retries or the timeout run out, arrive without a `code`, as do a refused
29
+ * connection, a timeout, and an oversized response. Those are exactly the "never
30
+ * reached it, or asked us to come back" failures a spool is for.
74
31
  */
75
- declare const shareCorrelationPerBatch: (correlate: SpanCorrelationResolver) => SpanCorrelationResolver;
32
+ declare const isPermanentExportFailure: (result: ExportResult) => boolean;
76
33
 
77
- export { OtlpLogTelemetrySink, OtlpTelemetrySink, type SignalFanoutOptions, type SignalFanoutSink, SpanCorrelationResolver, createSignalFanout, shareCorrelationPerBatch };
34
+ export { isPermanentExportFailure };