Skip to main content
Module

x/sentry/index.mjs>Span

The Official Sentry Deno SDK
Go to Latest
interface Span
implements SpanContext
import { type Span } from "https://deno.land/x/sentry@7.92.0/index.mjs";

Span holding trace_id, span_id

Properties

name: string

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

spanId: string
traceId: string
startTimestamp: number
tags: { [key: string]: Primitive; }
data: { [key: string]: any; }
attributes: SpanAttributes
optional
transaction: Transaction

The transaction containing this span

instrumenter: Instrumenter

The instrumenter that created this span.

Methods

finish(endTimestamp?: number): void

Sets the finish timestamp on the current span.

end(endTimestamp?: number): void

End the current span.

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.

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

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.

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.

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.

toJSON(): { data?: { [key: string]: any; }; description?: string; op?: string; parent_span_id?: string; span_id: string; start_timestamp: number; status?: string; tags?: { [key: string]: Primitive; }; timestamp?: number; trace_id: string; origin?: SpanOrigin; }

Convert the object to JSON