silk.trace.signals.

Bounded recorder storage for structured logs and cumulative metric series.

Import as SignalState with import silk.trace.signals { SignalState }.

Public declarations: 5.

LogRecord#

silk
pub struct LogRecord

A log record carries its event timestamp, severity, message template and rendered fields.

Field time#

silk
pub time: u64

Event timestamp in Unix nanoseconds.

Field severity#

silk
pub severity: u64

OpenTelemetry severity number.

Field template#

silk
pub template: string<'static>

The static format template before argument substitution.

Field body#

silk
pub body: Text

The rendered message, retained in bounded UTF-8 storage.

Field attributes#

silk
pub attributes: Attributes

Typed fields supplied with the event.

Field context#

silk
pub context: Option<SpanContext>

Trace identifiers when a span was active at the log call.

Implementation Copy for LogRecord#

silk
impl Copy for LogRecord

InstrumentKind#

silk
pub enum InstrumentKind

An OpenTelemetry instrument's aggregation and monotonicity.

Counter#

silk
Counter

UpDownCounter#

silk
UpDownCounter

Gauge#

silk
Gauge

Histogram#

silk
Histogram

MetricPoint#

silk
pub struct MetricPoint

One cumulative series as observed by an exporter.

Field name#

silk
pub name: string<'static>

Static instrument name.

Field kind#

silk
pub kind: InstrumentKind

Instrument kind selecting the active numeric fields.

Field attributes#

silk
pub attributes: Attributes

The attributes identifying this time series.

Field overflow#

silk
pub overflow: bool

Whether this point combines observations beyond the series limit.

Field start#

silk
pub start: u64

Unix timestamp in nanoseconds of the first observation in the series.

Field time#

silk
pub time: u64

Unix timestamp in nanoseconds supplied for this snapshot.

Field count#

silk
pub count: u64

Monotonic counter sum or number of histogram observations.

Field adjustment#

silk
pub adjustment: i64

Signed sum for an up-down counter.

Field value#

silk
pub value: f64

Latest gauge sample or sum of histogram observations.

Field buckets#

silk
pub buckets: [u64; 16]

Histogram bucket counts in increasing boundary order, including the last unbounded bucket.

Implementation Copy for MetricPoint#

silk
impl Copy for MetricPoint

histogramBounds#

silk
pub fn histogramBounds() -> [f64; 15]

The inclusive upper boundaries of histogram buckets. The last bucket has no upper bound.

SignalState#

silk
pub struct SignalState

Owns the fixed-capacity log queue, instrument directory and cumulative aggregations.

Implementation SignalState#

silk
impl SignalState

Associated function make#

silk
pub effect fn make(pages: usize, width: usize, static metrics: bool) -> Self ! OutOfMemoryError ? &mut Allocator

Preallocates log pages. When metrics are enabled, reserves eight series and one overflow series for each of 16 instruments.

Method appendLog#

silk
pub fn appendLog(self: &Self, record: LogRecord) -> ()

Appends to a per-thread page or counts a drop when no page is available.

Method logCapacity#

silk
pub fn logCapacity(self: &Self) -> usize

Returns the maximum number of pending log records the recorder can hold.

Method takeLog#

silk
pub fn takeLog(self: &Self) -> Option<LogRecord>

Takes one pending log from a full or partially filled thread page.

Method countDroppedLogs#

silk
pub fn countDroppedLogs(self: &Self, count: u64) -> ()

Counts records permanently lost during export or enqueue.

Method droppedLogs#

silk
pub fn droppedLogs(self: &Self) -> u64

Returns the cumulative count of dropped log records.

Method countDroppedMetrics#

silk
pub fn countDroppedMetrics(self: &Self, count: u64) -> ()

Adds the number of metric points permanently rejected by an exporter.

Method droppedMetrics#

silk
pub fn droppedMetrics(self: &Self) -> u64

Returns the cumulative count of updates over the instrument limit and permanently rejected points.

Method metricCapacity#

silk
pub fn metricCapacity(self: &Self) -> usize

Returns the number of possible metric slots, including overflow slots.

Method observe#

silk
pub fn observe(self: &Self, hash: u64, name: string<'static>, kind: InstrumentKind, attrs: &Attributes, time: u64, count: u64, value: f64) -> ()

Adds an observation to a series. The count argument holds the signed delta's bits for up-down counters.

Method metricAt#

silk
pub fn metricAt(self: &Self, index: usize, time: u64) -> Option<MetricPoint>

Copies a cumulative data point at the supplied export timestamp.

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