silk.trace.

Distributed tracing and metrics for code with or without an effect requirement.

Import as Trace with import silk.trace { Trace }.

Public declarations: 15.

Recorder#

silk
pub type Recorder = Records.Recorder

Owns the bounded storage for spans, logs and metrics.

Config#

silk
pub type Config = Records.Config

Configures resource identity, sampling and recording capacity.

Memory#

silk
pub type Memory = Records.Memory

Keeps exported spans, log records and metric points in process.

Console#

silk
pub type Console = Sinks.Console

A sink that writes telemetry as JSON through the active writer.

Otlp#

silk
pub type Otlp<'url> = Sinks.Otlp<'url>

An OTLP/HTTP JSON collector destination.

SpanContext#

silk
pub type SpanContext = Context.SpanContext

Identifiers and trace flags that can be propagated to another service.

Traceparent#

silk
pub type Traceparent = Context.Traceparent

An owned W3C traceparent header value.

SpanKind#

silk
pub enum SpanKind

The OpenTelemetry relationship between a span and the operation it represents.

Internal#

silk
Internal

Server#

silk
Server

Client#

silk
Client

Producer#

silk
Producer

Consumer#

silk
Consumer

Place#

silk
pub struct Place

The static source location and instrumentation scope of a traced declaration.

Field function#

silk
pub function: string<'static>

Field file#

silk
pub file: string<'static>

Field line#

silk
pub line: u64

Field packageName#

silk
pub packageName: string<'static>

Field packageVersion#

silk
pub packageVersion: string<'static>

Implementation Copy for Place#

silk
impl Copy for Place

Tracer#

silk
pub ambient service Tracer default Off

Receives span observations in the dynamic scope of a provided recorder.

Meter#

silk
pub ambient service Meter default Off

Receives instrument measurements independently of span recording.

Off#

silk
pub struct Off

The default provider discards observations.

Implementation Tracer for Off#

silk
impl Tracer for Off

Operation enter#

silk
effect fn enter<Args>(self: &Self, static name: string<'static>, static kind: SpanKind, static place: Place, args: &Args, remote: Option<SpanContext>) -> ()

Operation exit#

silk
effect fn exit(self: &Self) -> ()

Operation failed#

silk
effect fn failed(self: &Self, static error: string<'static>) -> ()

Operation cancelled#

silk
effect fn cancelled(self: &Self) -> ()

Operation attribute#

silk
effect fn attribute<V>(self: &Self, static key: string<'static>, value: &V) -> ()

Operation event#

silk
effect fn event<Args>(self: &Self, static name: string<'static>, args: &Args) -> ()

Operation recordError#

silk
effect fn recordError<V>(self: &Self, value: &V) -> ()
silk
effect fn link(self: &Self, context: &SpanContext) -> ()

Implementation Meter for Off#

silk
impl Meter for Off

Operation add#

silk
effect fn add<Args>(self: &Self, static name: string<'static>, amount: u64, args: &Args) -> ()

Operation adjust#

silk
effect fn adjust<Args>(self: &Self, static name: string<'static>, amount: i64, args: &Args) -> ()

Operation gauge#

silk
effect fn gauge<Args>(self: &Self, static name: string<'static>, value: f64, args: &Args) -> ()

Operation record#

silk
effect fn record<Args>(self: &Self, static name: string<'static>, value: f64, args: &Args) -> ()

SpanGuard#

silk
pub struct SpanGuard

Closes a manual span when dropped in its opening ambient scope. Nested guards must drop in reverse order. A mismatched drop traps before modifying the recorder.

Implementation SpanGuard#

silk
impl SpanGuard

Implementation Drop for SpanGuard#

silk
impl Drop for SpanGuard

Operation drop#

silk
fn drop(self: &mut Self) -> ()

Trace#

silk
pub struct Trace

Opens spans, annotates the current span and propagates trace context.

Implementation Trace#

silk
impl Trace

Associated function span#

silk
pub fn span(static name: string<'static>) -> SpanGuard

Opens an internal span until the returned guard drops.

Associated function spanOf#

silk
pub fn spanOf(static name: string<'static>, static kind: SpanKind) -> SpanGuard

Opens a span of the selected OpenTelemetry kind.

Associated function spanFrom#

silk
pub fn spanFrom(remote: &SpanContext, static name: string<'static>) -> SpanGuard

Opens a server span with a remote parent.

Associated function current#

silk
pub fn current() -> Option<SpanContext>

Returns a copy of the active identifiers and flags, including for unsampled spans.

Associated function set#

silk
pub fn set<V>(static key: string<'static>, value: &V) -> ()

Records an attribute on the current sampled span.

Associated function event#

silk
pub fn event(static name: string<'static>) -> ()

Adds a timed event to the current span.

Associated function eventWith#

silk
pub fn eventWith<Args>(static name: string<'static>, args: &Args) -> ()

Adds a timed event with named fields to the current span.

Associated function setError#

silk
pub fn setError<V>(value: &V) -> ()

Sets the active span's status to error.

silk
pub fn link(context: &SpanContext) -> ()

Links the active span to another span.

Associated function traceparent#

silk
pub fn traceparent(context: &SpanContext) -> Traceparent

Encodes a context for a W3C traceparent header.

Associated function parseTraceparent#

silk
pub fn parseTraceparent(text: string) -> Option<SpanContext>

Reads a remote context from a W3C traceparent header.

Metric#

silk
pub struct Metric

Records cumulative instrument measurements through the active Meter.

Implementation Metric#

silk
impl Metric

Associated function count#

silk
pub fn count(static name: string<'static>, amount: u64) -> ()

Adds a nonnegative count.

Associated function countWith#

silk
pub fn countWith<Args>(static name: string<'static>, amount: u64, args: &Args) -> ()

Adds a nonnegative count for the supplied attribute set.

Associated function adjust#

silk
pub fn adjust(static name: string<'static>, amount: i64) -> ()

Adjusts a signed counter.

Associated function adjustWith#

silk
pub fn adjustWith<Args>(static name: string<'static>, amount: i64, args: &Args) -> ()

Adjusts a signed counter for the supplied attribute set.

Associated function gauge#

silk
pub fn gauge(static name: string<'static>, value: f64) -> ()

Sets the latest gauge measurement.

Associated function gaugeWith#

silk
pub fn gaugeWith<Args>(static name: string<'static>, value: f64, args: &Args) -> ()

Sets the latest gauge measurement for the supplied attribute set.

Associated function record#

silk
pub fn record(static name: string<'static>, value: f64) -> ()

Adds a histogram observation.

Associated function recordWith#

silk
pub fn recordWith<Args>(static name: string<'static>, value: f64, args: &Args) -> ()

Adds a histogram observation for the supplied attribute set.

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.

View the source of this page