Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/sentry/index.mjs>Span

The Official Sentry Deno SDK
Latest
interface Span
import { type Span } from "https://deno.land/x/sentry@8.39.0-beta.0/index.mjs";

A generic Span which holds trace data.

Methods

spanContext(): SpanContextData

Get context data for this span. This includes the spanId & the traceId.

end(endTimestamp?: SpanTimeInput): void

End the current span.

setAttribute(key: string, value: SpanAttributeValue | undefined): this

Set a single attribute on the span. Set it to undefined to remove the attribute.

setAttributes(attributes: SpanAttributes): this

Set multiple attributes on the span. Any attribute set to undefined will be removed.

setStatus(status: SpanStatus): this

Sets the status attribute on the current span.

updateName(name: string): this

Update the name of the span.

isRecording(): boolean

If this is span is actually recording data. This will return false if tracing is disabled, this span was not sampled or if the span is already finished.

addEvent(
name: string,
attributesOrStartTime?: SpanAttributes | SpanTimeInput,
startTime?: SpanTimeInput,
): this

Adds an event to the Span.

recordException(exception: unknown, time?: number): void

NOT USED IN SENTRY, only added for compliance with OTEL Span interface