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#
pub type Recorder = Records.RecorderOwns the bounded storage for spans, logs and metrics.
Config#
pub type Config = Records.ConfigConfigures resource identity, sampling and recording capacity.
Memory#
pub type Memory = Records.MemoryKeeps exported spans, log records and metric points in process.
Console#
pub type Console = Sinks.ConsoleA sink that writes telemetry as JSON through the active writer.
Otlp#
pub type Otlp<'url> = Sinks.Otlp<'url>An OTLP/HTTP JSON collector destination.
SpanContext#
pub type SpanContext = Context.SpanContextIdentifiers and trace flags that can be propagated to another service.
Traceparent#
pub type Traceparent = Context.TraceparentAn owned W3C traceparent header value.
SpanKind#
pub enum SpanKindThe OpenTelemetry relationship between a span and the operation it represents.
Internal#
InternalServer#
ServerClient#
ClientProducer#
ProducerConsumer#
ConsumerPlace#
pub struct PlaceThe static source location and instrumentation scope of a traced declaration.
Field function#
pub function: string<'static>Field file#
pub file: string<'static>Field line#
pub line: u64Field packageName#
pub packageName: string<'static>Field packageVersion#
pub packageVersion: string<'static>Implementation Copy for Place#
impl Copy for PlaceTracer#
pub ambient service Tracer default OffReceives span observations in the dynamic scope of a provided recorder.
Meter#
pub ambient service Meter default OffReceives instrument measurements independently of span recording.
Off#
pub struct OffThe default provider discards observations.
Implementation Tracer for Off#
impl Tracer for OffOperation 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 failed#
effect fn failed(self: &Self, static error: string<'static>) -> ()Operation cancelled#
effect fn cancelled(self: &Self) -> ()Operation attribute#
effect fn attribute<V>(self: &Self, static key: string<'static>, value: &V) -> ()Operation event#
effect fn event<Args>(self: &Self, static name: string<'static>, args: &Args) -> ()Operation recordError#
effect fn recordError<V>(self: &Self, value: &V) -> ()Operation link#
effect fn link(self: &Self, context: &SpanContext) -> ()Implementation Meter for Off#
impl Meter for OffOperation 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) -> ()SpanGuard#
pub struct SpanGuardCloses 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#
impl SpanGuardImplementation Drop for SpanGuard#
impl Drop for SpanGuardOperation drop#
fn drop(self: &mut Self) -> ()Trace#
pub struct TraceOpens spans, annotates the current span and propagates trace context.
Implementation Trace#
impl TraceAssociated function span#
pub fn span(static name: string<'static>) -> SpanGuardOpens an internal span until the returned guard drops.
Associated function spanOf#
pub fn spanOf(static name: string<'static>, static kind: SpanKind) -> SpanGuardOpens a span of the selected OpenTelemetry kind.
Associated function spanFrom#
pub fn spanFrom(remote: &SpanContext, static name: string<'static>) -> SpanGuardOpens a server span with a remote parent.
Associated function current#
pub fn current() -> Option<SpanContext>Returns a copy of the active identifiers and flags, including for unsampled spans.
Associated function set#
pub fn set<V>(static key: string<'static>, value: &V) -> ()Records an attribute on the current sampled span.
Associated function event#
pub fn event(static name: string<'static>) -> ()Adds a timed event to the current span.
Associated function eventWith#
pub fn eventWith<Args>(static name: string<'static>, args: &Args) -> ()Adds a timed event with named fields to the current span.
Associated function setError#
pub fn setError<V>(value: &V) -> ()Sets the active span's status to error.
Associated function link#
pub fn link(context: &SpanContext) -> ()Links the active span to another span.
Associated function traceparent#
pub fn traceparent(context: &SpanContext) -> TraceparentEncodes a context for a W3C traceparent header.
Associated function parseTraceparent#
pub fn parseTraceparent(text: string) -> Option<SpanContext>Reads a remote context from a W3C traceparent header.
Metric#
pub struct MetricRecords cumulative instrument measurements through the active Meter.
Implementation Metric#
impl MetricAssociated function count#
pub fn count(static name: string<'static>, amount: u64) -> ()Adds a nonnegative count.
Associated function countWith#
pub fn countWith<Args>(static name: string<'static>, amount: u64, args: &Args) -> ()Adds a nonnegative count for the supplied attribute set.
Associated function adjust#
pub fn adjust(static name: string<'static>, amount: i64) -> ()Adjusts a signed counter.
Associated function adjustWith#
pub fn adjustWith<Args>(static name: string<'static>, amount: i64, args: &Args) -> ()Adjusts a signed counter for the supplied attribute set.
Associated function gauge#
pub fn gauge(static name: string<'static>, value: f64) -> ()Sets the latest gauge measurement.
Associated function gaugeWith#
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#
pub fn record(static name: string<'static>, value: f64) -> ()Adds a histogram observation.
Associated function recordWith#
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.