tracing

cart · /core·function

Built-in middleware that wraps each mutation in an OTel-shaped span. Span name is cart.mutation.<kind>; attributes include the mutation kind and (when present) idempotency key. The resolved cart id is added after the inner call resolves; exceptions are recorded and rethrown.

Signature

@nordcom/commerce-cart
function tracing(opts: { tracer: ITracer }): CartMiddleware;

Parameters

NameTypeDescription
opts{ tracer: ITracer }

Returns

A that pipes mutations through a span.

Example

const kernel = createCart({
  adapter,
  middleware: [tracing({ tracer: openTelemetryTracer })],
});

RunCartAdapterContractOpts runCartAdapterContract CartCapabilityUnsupportedError CartError CartNotFoundError CartProviderError CartUserError CartAdapter

On this page