silk.trace.record.
Bounded recording of OpenTelemetry spans and their parent contexts.
Import as Recorder with import silk.trace.record { Recorder }.
Public declarations: 5.
Config#
pub struct ConfigThe OTel resource, root sampling probability and fixed storage budget.
Field serviceName#
pub serviceName: string<'static>Value of the OpenTelemetry service.name resource attribute.
Field serviceVersion#
pub serviceVersion: string<'static>Value of service.version. An empty value omits this attribute.
Field sampleRatio#
pub sampleRatio: f64Fraction of new roots to record. Child spans inherit the parent’s sampled bit.
Field openCapacity#
pub openCapacity: usizeMaximum number of sampled spans simultaneously open in the recorder.
Field threadCapacity#
pub threadCapacity: usizeNumber of preallocated producer pages in each signal buffer pool.
Field bufferCapacity#
pub bufferCapacity: usizeMaximum records per page. A full pool counts additional observations as drops.
Implementation Copy for Config#
impl Copy for ConfigImplementation Config#
impl ConfigAssociated function make#
pub fn make(name: string<'static>) -> SelfRecords all roots with 64 open spans and eight buffers of eight finished spans each.
SpanEvent#
pub struct SpanEventA timed event and its captured fields.
Field name#
pub name: string<'static>The event name supplied by the instrumented code.
Field time#
pub time: u64The event time in Unix nanoseconds.
Field attributes#
pub attributes: AttributesThe captured event fields.
Implementation Copy for SpanEvent#
impl Copy for SpanEventImplementation SpanEvent#
impl SpanEventAssociated function empty#
pub fn empty() -> SelfAn empty event.
Span#
pub struct SpanA complete span with owned attributes, events and links. Times are Unix nanoseconds.
Field context#
pub context: SpanContextIdentifiers and flags of this span.
Field parent#
pub parent: SpanContextParent identifiers and flags. A zero parent span ID denotes a root.
Field name#
pub name: string<'static>Name supplied at the span site.
Field kind#
pub kind: SpanKindThe OpenTelemetry kind of this span.
Field place#
pub place: PlaceSource and instrumentation scope for a decorated declaration.
Field start#
pub start: u64Span start time, in Unix nanoseconds.
Field end#
pub end: u64Span completion time, in Unix nanoseconds.
Field error#
pub error: boolWhether this span ended with an error status.
Field cancelled#
pub cancelled: boolWhether cancellation closed this span.
Field errorType#
pub errorType: string<'static>Static identity of the failure type on an effect failure exit.
Field attributes#
pub attributes: AttributesCaptured span attributes.
Field events#
pub events: [SpanEvent; 4]Event storage. The first eventCount elements are initialized events.
Field eventCount#
pub eventCount: usizeNumber of captured events.
Field droppedEvents#
pub droppedEvents: u64Number of events omitted at the per-span limit.
Field links#
pub links: [SpanContext; 4]Links to other spans. Only the first linkCount entries are live.
Field linkCount#
pub linkCount: usizeNumber of captured links.
Field droppedLinks#
pub droppedLinks: u64Number of links omitted at the per-span limit.
Implementation Copy for Span#
impl Copy for SpanImplementation Span#
impl SpanAssociated function empty#
pub fn empty() -> SelfReturns an empty record with no parent, events or links.
Recorder#
pub struct RecorderOwns all recording storage. Its ambient operations reserve disjoint slots without parking.
Field signals#
pub signals: SignalStateLog buffers and metric instruments shared by this recorder’s providers.
Implementation Concurrent for Recorder#
impl Concurrent for RecorderImplementation Transferable for Recorder#
impl Transferable for RecorderImplementation Recorder#
impl RecorderAssociated function make#
pub effect fn make(config: Config) -> Self ! OutOfMemoryError ? &mut AllocatorAllocates every recording cell and reads the clock bases and an OS random seed.
Method serviceName#
pub fn serviceName(self: &Self) -> string<'static>Returns the OTel service name of this resource.
Method serviceVersion#
pub fn serviceVersion(self: &Self) -> string<'static>Returns the OTel service version of this resource.
Method now#
pub fn now(self: &Self) -> u64Returns the current Unix nanoseconds on the recorder's monotonic time base.
Method droppedSpans#
pub fn droppedSpans(self: &Self) -> u64Returns the total number of spans lost to pool or buffer exhaustion or export failure.
Method countDroppedSpans#
pub fn countDroppedSpans(self: &Self, count: u64) -> ()Adds terminal export or recording losses to the resource's drop count.
Method takeSpan#
pub fn takeSpan(self: &Self) -> Option<Span>Takes one finished span. When a producer is writing a slot, draining skips that slot.
Implementation Meter for Recorder#
impl Meter for RecorderOperation add#
effect fn add<Args>(self: &Self, static name: string<'static>, amount: u64, args: &Args) -> ()Operation adjust#
effect fn adjust<Args>(self: &Self, static name: string<'static>, amount: i64, args: &Args) -> ()Operation gauge#
effect fn gauge<Args>(self: &Self, static name: string<'static>, value: f64, args: &Args) -> ()Operation record#
effect fn record<Args>(self: &Self, static name: string<'static>, value: f64, args: &Args) -> ()Implementation Tracer for Recorder#
impl Tracer for RecorderOperation enter#
effect fn enter<Args>(self: &Self, static name: string<'static>, static kind: SpanKind, static place: Place,
args: &Args, remote: Option<SpanContext>) -> ()Operation exit#
effect fn exit(self: &Self) -> ()Operation cancelled#
effect fn cancelled(self: &Self) -> ()Operation failed#
effect fn failed(self: &Self, static error: string<'static>) -> ()Operation attribute#
effect fn attribute<V>(self: &Self, static key: string<'static>, value: &V) -> ()Operation recordError#
effect fn recordError<V>(self: &Self, value: &V) -> ()Operation event#
effect fn event<Args>(self: &Self, static name: string<'static>, args: &Args) -> ()Operation link#
effect fn link(self: &Self, context: &SpanContext) -> ()Implementation Recorder#
impl RecorderMethod finishedCapacity#
pub fn finishedCapacity(self: &Self) -> usizeThe maximum number of completed spans the recorder can retain.
Memory#
pub struct MemoryAn owned collection of exported telemetry records.
Implementation Memory#
impl MemoryAssociated function make#
pub fn make() -> SelfCreates an empty collector.
Method spans#
pub fn spans(self: &Self) -> &[Span]Borrows the spans in their drain order.
Method logs#
pub fn logs(self: &Self) -> &[LogRecord]Borrows the delivered log records.
Method metrics#
pub fn metrics(self: &Self) -> &[MetricPoint]Borrows the delivered metric snapshots.
Method appendSpans#
pub effect fn appendSpans(self: &mut Self, values: &[Span]) -> () ! OutOfMemoryError ? &mut AllocatorAppends one span batch.
Method appendLogs#
pub effect fn appendLogs(self: &mut Self, values: &[LogRecord]) -> () ! OutOfMemoryError ? &mut AllocatorAppends one log batch.
Method appendMetrics#
pub effect fn appendMetrics(self: &mut Self, values: &[MetricPoint]) -> () ! OutOfMemoryError ? &mut AllocatorAppends one cumulative metric batch.
Method drain#
pub effect fn drain(self: &mut Self, recorder: &Recorder) -> () ! OutOfMemoryError ? &mut AllocatorCollects at most one recorder capacity of completed spans, reserving space before removal.
Implementation Recorder#
impl RecorderMethod flush#
pub effect fn flush<E, ?R, S: Sink<E ? R>>(self: &Self, sink: &mut S) -> ()
! E | OutOfMemoryError ? R | &mut AllocatorDrains the current buffers to a sink, including logs and cumulative metric snapshots.
Method exportBatches#
pub effect fn exportBatches<E, ?R, S: Sink<E ? R>>(self: &Self, sink: &mut S) -> ()
! E | OutOfMemoryError ? R | &mut Allocator | &mut MonotonicClockPeriodically flushes the recorder until cancellation or a sink failure.
Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, aarch64-unknown-linux-gnu-no-libc, x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu-no-libc, wasm32-unknown-unknown, wasm32-wasip1, wasm32-wasip2, x86_64-pc-windows-msvc, wasm64-unknown-unknown.