Skip to content

Connectum API Reference / @connectum/testing / index / InMemorySpanCollector

Class: InMemorySpanCollector

Defined in: testing/src/otel-collectors.ts:147

In-memory span collector. Owns its own BasicTracerProvider so that different scenarios cannot cross-contaminate.

Callers wishing to register the provider globally (so that trace.getTracer(...) resolves here) should call registerGlobal — and pair it with InMemorySpanCollector.dispose when done.

Constructors

Constructor

new InMemorySpanCollector(): InMemorySpanCollector

Defined in: testing/src/otel-collectors.ts:151

Returns

InMemorySpanCollector

Properties

exporter

readonly exporter: InMemorySpanExporter

Defined in: testing/src/otel-collectors.ts:148


provider

readonly provider: BasicTracerProvider

Defined in: testing/src/otel-collectors.ts:149

Methods

dispose()

dispose(): Promise<void>

Defined in: testing/src/otel-collectors.ts:181

Returns

Promise<void>


flush()

flush(): NormalizedSpan[]

Defined in: testing/src/otel-collectors.ts:165

Returns normalized finished spans collected so far.

Spans are sorted by (name, kind, sorted-attributes) so that scenarios which emit multiple spans concurrently produce a deterministic order for the parity structural diff.

Returns

NormalizedSpan[]


reset()

reset(): void

Defined in: testing/src/otel-collectors.ts:177

Clear the internal buffer.

Returns

void