# @zerolith/otel

Import from `@zerolith/otel`. Generated from the source; every signature below is what the published types declare.

## Functions

### navigationObserver

```ts
function navigationObserver(tracer?: Tracer): (event: NavigationEvent) => void
```

The `observe` function for `createRouter`: a span named `navigate`
opens when a navigation starts and ends when it commits, fails, or is
canceled by a newer navigation, with `zerolith.route`, `url.path`,
`url.query` when the URL has a query, and `zerolith.navigation.mode` as
attributes, the loader's error recorded on failure, and
`zerolith.navigation.canceled` set on a canceled one, whose status stays
unset. The values of the query keys the URL conventions redact, such as
`sig`, are recorded as `REDACTED`.

Source: `packages/otel/src/index.ts:41`

### tracedHydrate

```ts
function tracedHydrate(view: unknown, container: MountTarget, tracer?: Tracer): HydrateResult
```

`hydrate` inside a span named `hydrate`, with the number of mismatches as `zerolith.hydration.mismatches`.

Source: `packages/otel/src/index.ts:82`

### traceparent

```ts
function traceparent(active?: Context): string | undefined
```

The W3C `traceparent` header for a context, or undefined when no span is active in it.

Source: `packages/otel/src/index.ts:107`

### tracedTransport

```ts
function tracedTransport(transport: Transport | undefined, tracer?: Tracer): Transport
```

Wraps a transport, or `fetch` when none is given, so every request runs
in a client span named by its method, as `GET`, with
`http.request.method`, `url.full`, and `http.response.status_code`,
carries a `traceparent` header from that span, and records a failed
request as an error. The span is not named by the request's path, which
would give every note its own span name; the HTTP conventions name a
client span by its method when no route template is known. `url.full`
records the values of the query keys the conventions redact, such as
`sig`, as `REDACTED`.

Source: `packages/otel/src/index.ts:128`

