Skip to main content

Function: addSpanAttributes()

addSpanAttributes(attributes): void

Defined in: src/observability/tracer.ts:115

Adds attributes to the currently active span.

Parameters

attributes

Attributes

Key-value pairs to add

Returns

void

Remarks

Safely adds attributes to the active span. Does nothing if no span is active.

Example

// Add single attribute
addSpanAttributes({ 'preprint.uri': preprintUri });

// Add multiple attributes
addSpanAttributes({
'http.method': 'GET',
'http.route': '/api/preprints/:id',
'http.status_code': 200,
});

Since

0.1.0