# withSpan

Traces the whole subscription and each success or failure delivery.

## Signatures

```ts
export declare const withSpan: {
    (name: string, options?: SpanOptionsNoTrace): <A, E, R>(fx: Fx<A, E, R>) => Fx<A, E, R>;
    <A, E, R>(fx: Fx<A, E, R>, name: string, options?: SpanOptionsNoTrace): Fx<A, E, R>;
};
```

## Why

A single Effect span around subscription setup cannot show time spent in
downstream sink callbacks. Nested delivery spans make the push boundary
visible while keeping the source's values and types unchanged.

## Ownership and lifetime

Every run creates an `Fx(name)` span covering the source subscription. Each
`onSuccess` and `onFailure` callback executes in its own child span. Span
lifetime follows the Effects exactly; interruption closes active spans.
Options are forwarded to all three span kinds, and no service requirement or
failure is added beyond the configured Effect tracer.

## Examples

```ts
import { withSpan } from "@typed/fx/Fx"
import { succeed } from "@typed/fx/Fx"

const traced = withSpan(succeed("ready"), "load-settings", {
  attributes: { component: "settings" }
})
```
