@glasstrace/sdk 1.7.0 → 1.8.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.
@@ -190,7 +190,40 @@ declare class GlasstraceExporter implements SpanExporter {
190
190
  private pendingBatches;
191
191
  private pendingSpanCount;
192
192
  private overflowLogged;
193
+ /**
194
+ * Lazily-bound reference to the export-path circuit breaker
195
+ * (DISC-1568 / Wave 15C). Resolved on first export so this
196
+ * constructor stays side-effect-free. The breaker is a module-
197
+ * singleton — every `GlasstraceExporter` instance shares the same
198
+ * one so a rotation event observed in `init-client.ts` reaches
199
+ * every active exporter.
200
+ */
201
+ private circuitBreaker;
193
202
  constructor(options: GlasstraceExporterOptions);
203
+ /**
204
+ * Returns the export-path circuit breaker, lazily wiring it on
205
+ * first call. The breaker is a module-singleton so all exporter
206
+ * instances share state — a credential rotation observed once
207
+ * resets the breaker for every active exporter, and a single
208
+ * outage at the OTLP endpoint trips a single breaker rather than
209
+ * one per exporter copy.
210
+ *
211
+ * The wiring binds:
212
+ * - the lifecycle event sink to the SDK's lifecycle bus
213
+ * (`emitLifecycleEvent`) so the `otel:circuit_*` events surface
214
+ * to runtime-state, the CLI bridge, and any user-installed
215
+ * subscribers.
216
+ * - the dropped-span counter to {@link recordSpansDropped} so OPEN-
217
+ * state drops show up in the existing health surface.
218
+ * - the FSM hooks to {@link pushDegradationSource} /
219
+ * {@link clearDegradationSource} keyed on `"export-circuit"`,
220
+ * which routes the OPEN/CLOSED transitions through the
221
+ * centralised `recomputeCoreFromDegradationSources()` helper.
222
+ * That helper guards `ACTIVE ↔ ACTIVE_DEGRADED` so a circuit
223
+ * recovery never clobbers an unrelated `OtelState.COEXISTENCE_FAILED`
224
+ * degradation source.
225
+ */
226
+ private getCircuitBreaker;
194
227
  export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void;
195
228
  /**
196
229
  * Called when the API key transitions from "pending" to a resolved value.
@@ -234,6 +267,11 @@ declare class GlasstraceExporter implements SpanExporter {
234
267
  * Flushes all buffered spans through the delegate exporter.
235
268
  * Enriches spans at flush time (not buffer time) so that session IDs
236
269
  * are computed with the resolved API key instead of the "pending" sentinel.
270
+ *
271
+ * Honors the circuit breaker symmetrically with {@link export}: if the
272
+ * breaker is OPEN at flush time, every buffered batch is dropped via
273
+ * `recordSpansDropped` and its callback completed with `{ code: 0 }`,
274
+ * preserving the bounded-memory contract during outages.
237
275
  */
238
276
  private flushPending;
239
277
  }
@@ -190,7 +190,40 @@ declare class GlasstraceExporter implements SpanExporter {
190
190
  private pendingBatches;
191
191
  private pendingSpanCount;
192
192
  private overflowLogged;
193
+ /**
194
+ * Lazily-bound reference to the export-path circuit breaker
195
+ * (DISC-1568 / Wave 15C). Resolved on first export so this
196
+ * constructor stays side-effect-free. The breaker is a module-
197
+ * singleton — every `GlasstraceExporter` instance shares the same
198
+ * one so a rotation event observed in `init-client.ts` reaches
199
+ * every active exporter.
200
+ */
201
+ private circuitBreaker;
193
202
  constructor(options: GlasstraceExporterOptions);
203
+ /**
204
+ * Returns the export-path circuit breaker, lazily wiring it on
205
+ * first call. The breaker is a module-singleton so all exporter
206
+ * instances share state — a credential rotation observed once
207
+ * resets the breaker for every active exporter, and a single
208
+ * outage at the OTLP endpoint trips a single breaker rather than
209
+ * one per exporter copy.
210
+ *
211
+ * The wiring binds:
212
+ * - the lifecycle event sink to the SDK's lifecycle bus
213
+ * (`emitLifecycleEvent`) so the `otel:circuit_*` events surface
214
+ * to runtime-state, the CLI bridge, and any user-installed
215
+ * subscribers.
216
+ * - the dropped-span counter to {@link recordSpansDropped} so OPEN-
217
+ * state drops show up in the existing health surface.
218
+ * - the FSM hooks to {@link pushDegradationSource} /
219
+ * {@link clearDegradationSource} keyed on `"export-circuit"`,
220
+ * which routes the OPEN/CLOSED transitions through the
221
+ * centralised `recomputeCoreFromDegradationSources()` helper.
222
+ * That helper guards `ACTIVE ↔ ACTIVE_DEGRADED` so a circuit
223
+ * recovery never clobbers an unrelated `OtelState.COEXISTENCE_FAILED`
224
+ * degradation source.
225
+ */
226
+ private getCircuitBreaker;
194
227
  export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void;
195
228
  /**
196
229
  * Called when the API key transitions from "pending" to a resolved value.
@@ -234,6 +267,11 @@ declare class GlasstraceExporter implements SpanExporter {
234
267
  * Flushes all buffered spans through the delegate exporter.
235
268
  * Enriches spans at flush time (not buffer time) so that session IDs
236
269
  * are computed with the resolved API key instead of the "pending" sentinel.
270
+ *
271
+ * Honors the circuit breaker symmetrically with {@link export}: if the
272
+ * breaker is OPEN at flush time, every buffered batch is dropped via
273
+ * `recordSpansDropped` and its callback completed with `{ code: 0 }`,
274
+ * preserving the bounded-memory contract during outages.
237
275
  */
238
276
  private flushPending;
239
277
  }