(options: {
readonly spanId: string
readonly traceId: string
readonly sampled?: boolean | undefined
readonly annotations?: Context.Context<never> | undefined
}): ExternalSpanCreates an ExternalSpan from trace and span identifiers, defaulting
sampled to true and annotations to an empty context when they are not
provided.
Example (Creating an external span)
import { Effect, Tracer } from "effect"
// Create an external span from another tracing system
const span = Tracer.externalSpan({
spanId: "span-abc-123",
traceId: "trace-xyz-789",
sampled: true
})
// Use the external span as a parent
const program = Effect.succeed("Hello").pipe(
Effect.withSpan("child-operation", { parent: span })
)constructors
Source effect/Tracer.ts:44714 lines
export const const externalSpan: (options: {
readonly spanId: string
readonly traceId: string
readonly sampled?: boolean | undefined
readonly annotations?:
| Context.Context<never>
| undefined
}) => ExternalSpan
Creates an ExternalSpan from trace and span identifiers, defaulting
sampled to true and annotations to an empty context when they are not
provided.
Example (Creating an external span)
import { Effect, Tracer } from "effect"
// Create an external span from another tracing system
const span = Tracer.externalSpan({
spanId: "span-abc-123",
traceId: "trace-xyz-789",
sampled: true
})
// Use the external span as a parent
const program = Effect.succeed("Hello").pipe(
Effect.withSpan("child-operation", { parent: span })
)
externalSpan = (
options: {
readonly spanId: string
readonly traceId: string
readonly sampled?: boolean | undefined
readonly annotations?:
| Context.Context<never>
| undefined
}
options: {
readonly spanId: stringspanId: string
readonly traceId: stringtraceId: string
readonly sampled?: boolean | undefinedsampled?: boolean | undefined
readonly annotations?: Context.Context<never> | undefinedannotations?: import ContextContext.type Context.Context = /*unresolved*/ anyContext<never> | undefined
}
): ExternalSpan => ({
ExternalSpan._tag: "ExternalSpan"_tag: "ExternalSpan",
ExternalSpan.spanId: stringspanId: options: {
readonly spanId: string
readonly traceId: string
readonly sampled?: boolean | undefined
readonly annotations?:
| Context.Context<never>
| undefined
}
options.spanId: stringspanId,
ExternalSpan.traceId: stringtraceId: options: {
readonly spanId: string
readonly traceId: string
readonly sampled?: boolean | undefined
readonly annotations?:
| Context.Context<never>
| undefined
}
options.traceId: stringtraceId,
ExternalSpan.sampled: booleansampled: options: {
readonly spanId: string
readonly traceId: string
readonly sampled?: boolean | undefined
readonly annotations?:
| Context.Context<never>
| undefined
}
options.sampled?: boolean | undefinedsampled ?? true,
ExternalSpan.annotations: Context.Context<never>(property) ExternalSpan.annotations: {
mapUnsafe: ReadonlyMap<string, any>;
mutable: boolean;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
annotations: options: {
readonly spanId: string
readonly traceId: string
readonly sampled?: boolean | undefined
readonly annotations?:
| Context.Context<never>
| undefined
}
options.annotations?: Context.Context<never> | undefinedannotations ?? import ContextContext.empty()
})Referenced by 2 symbols