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#
pub struct LogRecordA log record carries its event timestamp, severity, message template and rendered fields.
Field time#
pub time: u64Event timestamp in Unix nanoseconds.
Field severity#
pub severity: u64OpenTelemetry severity number.
Field template#
pub template: string<'static>The static format template before argument substitution.
Field body#
pub body: TextThe rendered message, retained in bounded UTF-8 storage.
Field attributes#
pub attributes: AttributesTyped fields supplied with the event.
Field context#
pub context: Option<SpanContext>Trace identifiers when a span was active at the log call.
Implementation Copy for LogRecord#
impl Copy for LogRecordInstrumentKind#
pub enum InstrumentKindAn OpenTelemetry instrument's aggregation and monotonicity.
Counter#
CounterUpDownCounter#
UpDownCounterGauge#
GaugeHistogram#
HistogramMetricPoint#
pub struct MetricPointOne cumulative series as observed by an exporter.
Field name#
pub name: string<'static>Static instrument name.
Field kind#
pub kind: InstrumentKindInstrument kind selecting the active numeric fields.
Field attributes#
pub attributes: AttributesThe attributes identifying this time series.
Field overflow#
pub overflow: boolWhether this point combines observations beyond the series limit.
Field start#
pub start: u64Unix timestamp in nanoseconds of the first observation in the series.
Field time#
pub time: u64Unix timestamp in nanoseconds supplied for this snapshot.
Field count#
pub count: u64Monotonic counter sum or number of histogram observations.
Field adjustment#
pub adjustment: i64Signed sum for an up-down counter.
Field value#
pub value: f64Latest gauge sample or sum of histogram observations.
Field buckets#
pub buckets: [u64; 16]Histogram bucket counts in increasing boundary order, including the last unbounded bucket.
Implementation Copy for MetricPoint#
impl Copy for MetricPointhistogramBounds#
pub fn histogramBounds() -> [f64; 15]The inclusive upper boundaries of histogram buckets. The last bucket has no upper bound.
SignalState#
pub struct SignalStateOwns the fixed-capacity log queue, instrument directory and cumulative aggregations.
Implementation SignalState#
impl SignalStateAssociated function make#
pub effect fn make(pages: usize, width: usize, static metrics: bool) -> Self ! OutOfMemoryError ? &mut AllocatorPreallocates log pages. When metrics are enabled, reserves eight series and one overflow series for each of 16 instruments.
Method appendLog#
pub fn appendLog(self: &Self, record: LogRecord) -> ()Appends to a per-thread page or counts a drop when no page is available.
Method logCapacity#
pub fn logCapacity(self: &Self) -> usizeReturns the maximum number of pending log records the recorder can hold.
Method takeLog#
pub fn takeLog(self: &Self) -> Option<LogRecord>Takes one pending log from a full or partially filled thread page.
Method countDroppedLogs#
pub fn countDroppedLogs(self: &Self, count: u64) -> ()Counts records permanently lost during export or enqueue.
Method droppedLogs#
pub fn droppedLogs(self: &Self) -> u64Returns the cumulative count of dropped log records.
Method countDroppedMetrics#
pub fn countDroppedMetrics(self: &Self, count: u64) -> ()Adds the number of metric points permanently rejected by an exporter.
Method droppedMetrics#
pub fn droppedMetrics(self: &Self) -> u64Returns the cumulative count of updates over the instrument limit and permanently rejected points.
Method metricCapacity#
pub fn metricCapacity(self: &Self) -> usizeReturns the number of possible metric slots, including overflow slots.
Method observe#
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#
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.