Skip to main content

Function: setSpanAttributes()

@arolariu/website


@arolariu/website / instrumentation.server / setSpanAttributes

Function: setSpanAttributes()

setSpanAttributes(attributes): void

Defined in: instrumentation.server.ts:1060

Set attributes on the currently active span.

Attributes provide contextual information about the operation represented by the span. They should be low-cardinality values suitable for grouping and filtering.

Parameters

attributes

TelemetryAttributes

Key-value pairs to attach to the span

Returns

void

Remarks

  • Use semantic conventions where possible
  • Avoid high-cardinality values (user IDs, timestamps, request IDs)
  • Attributes can be used for filtering and grouping in observability tools
  • If no span is active, this is a no-op (safe to call)

Example

setSpanAttributes({
'http.method': 'POST',
'http.status_code': 201,
'user.authenticated': true,
});

See

// was this page useful?