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

x/sentry/index.d.ts>Span

The Official Sentry Deno SDK
Latest
interface Span
implements Omit<SpanContext, "op" | "status" | "origin">
import { type Span } from "https://deno.land/x/sentry@7.120.0/index.d.ts";

Span holding trace_id, span_id

Properties

deprecated
name: string

Human-readable identifier for the span. Identical to span.description.

optional
deprecated
op: string | undefined

Operation of the Span.

deprecated
spanId: string

The ID of the span.

optional
deprecated
parentSpanId: string | undefined

Parent Span ID

deprecated
traceId: string

The ID of the trace.

optional
deprecated
sampled: boolean | undefined

Was this span chosen to be sent as part of the sample?

deprecated
startTimestamp: number

Timestamp in seconds (epoch time) indicating when the span started.

optional
deprecated
endTimestamp: number | undefined

Timestamp in seconds (epoch time) indicating when the span ended.

deprecated
tags: { [key: string]: Primitive; }

Tags for the span.

deprecated
data: { [key: string]: any; }

Data for the span.

deprecated
attributes: SpanAttributes

Attributes for the span.

optional
deprecated
transaction: Transaction

The transaction containing this span

deprecated
instrumenter: Instrumenter

The instrumenter that created this span.

optional
deprecated
status: string | undefined

Completion status of the Span.

See: {@sentry/tracing SpanStatus} for possible values

optional
deprecated
origin: SpanOrigin | undefined

The origin of the span, giving context about what created the span.

Methods

spanContext(): SpanContextData

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

deprecated
finish(endTimestamp?: number): void

Sets the finish timestamp on the current span.

end(endTimestamp?: SpanTimeInput): void

End the current span.

deprecated
setTag(key: string, value: Primitive): this

Sets the tag attribute on the current span.

Can also be used to unset a tag, by passing undefined.

deprecated
setData(key: string, value: any): this

Sets the data attribute on the current span

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

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

setAttributes(attributes: SpanAttributes): void

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

setStatus(status: string): this

Sets the status attribute on the current span See: {@sentry/tracing SpanStatus} for possible values

deprecated
setHttpStatus(httpStatus: number): this

Sets the status attribute on the current span based on the http code

deprecated
setName(name: string): void

Set the name of the span.

updateName(name: string): this

Update the name of the span.

deprecated
startChild(spanContext?: Pick<SpanContext, Exclude<keyof SpanContext, "sampled" | "traceId" | "parentSpanId">>): Span

Creates a new Span while setting the current Span.id as parentSpanId. Also the sampled decision will be inherited.

deprecated
isSuccess(): boolean

Determines whether span was successful (HTTP200)

deprecated
toTraceparent(): string

Return a traceparent compatible header string.

deprecated
toContext(): SpanContext

Returns the current span properties as a SpanContext.

deprecated
updateWithContext(spanContext: SpanContext): this

Updates the current span with a new SpanContext.

deprecated
getTraceContext(): TraceContext

Convert the object to JSON for w. spans array info only.

deprecated
toJSON(): SpanJSON

Convert the object to JSON.

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.