SpanOptionsRepresents options that can be used to control the behavior of spans created for layers.
When to use
Use to configure tracing metadata, stack trace capture, and onEnd
finalization for spans created by Layer.span and Layer.withSpan during
layer construction.
Details
Extends Tracer.SpanOptions with onEnd, which runs when the layer span
ends as the layer scope closes.
Source effect/Layer.ts:24479 lines
export interface SpanOptions extends import TracerTracer.SpanOptions {
/**
* Runs when the span associated with the layer ends, which happens when the
* layer scope is closed.
*/
readonly SpanOptions.onEnd?: ((span: Tracer.Span, exit: Exit.Exit<unknown, unknown>) => Effect<void>) | undefinedRuns when the span associated with the layer ends, which happens when the
layer scope is closed.
onEnd?:
| ((span: Tracer.Span(parameter) span: {
_tag: "Span";
name: string;
spanId: string;
traceId: string;
parent: Option.Option<AnySpan>;
annotations: Context.Context<never>;
status: SpanStatus;
attributes: ReadonlyMap<string, unknown>;
links: ReadonlyArray<SpanLink>;
sampled: boolean;
kind: SpanKind;
end: (endTime: bigint, exit: Exit.Exit<unknown, unknown>) => void;
attribute: (key: string, value: unknown) => void;
event: (name: string, startTime: bigint, attributes?: Record<string, unknown>) => void;
addLinks: (links: ReadonlyArray<SpanLink>) => void;
}
span: import TracerTracer.Span, exit: Exit.Exit<unknown, unknown>exit: import ExitExit.type Exit.Exit = /*unresolved*/ anyExit<unknown, unknown>) => import EffectEffect<void>)
| undefined
}Referenced by 2 symbols