All Torvyn metrics are pre-allocated at flow creation time. Counters are AtomicU64 with Relaxed ordering on the hot path. Histograms use fixed-bucket boundaries with logarithmic distribution from 100 ns to 10 s.
Metric Name Type Unit Labels Description
flow.elements.totalCounter count flow_idTotal stream elements processed.
flow.elements.errorsCounter count flow_idTotal elements that produced errors.
flow.latencyHistogram ns flow_idEnd-to-end latency per element (source entry to sink exit).
flow.throughputDerived elements/s flow_idComputed from element count and wall time during export.
flow.copies.totalCounter count flow_idTotal buffer copy operations.
flow.copies.bytesCounter bytes flow_idTotal bytes copied across all copy operations.
flow.active_durationGauge ns flow_idWall time since flow started.
flow.stateGauge (enum) — flow_idCurrent flow lifecycle state.
Metric Name Type Unit Labels Description
component.invocationsCounter count flow_id, component_idTotal invocations of this component.
component.errorsCounter count flow_id, component_idTotal error returns.
component.processing_timeHistogram ns flow_id, component_idWall time per invocation (excludes queue wait).
component.fuel_consumedCounter units flow_id, component_idWasm fuel consumed (if fuel metering enabled).
component.memory_currentGauge bytes flow_id, component_idCurrent Wasm linear memory size.
Metric Name Type Unit Labels Description
stream.elements.transferredCounter count flow_id, stream_idTotal elements transferred through this stream.
stream.backpressure.eventsCounter count flow_id, stream_idTotal backpressure activation events.
stream.backpressure.duration_nsCounter ns flow_id, stream_idTotal time spent in backpressure.
stream.queue.current_depthGauge count flow_id, stream_idCurrent queue depth.
stream.queue.peak_depthGauge count flow_id, stream_idMaximum queue depth observed.
stream.queue.wait_timeHistogram ns flow_id, stream_idTime each element spent waiting in the queue.
Metric Name Type Unit Labels Description
pool.capacityGauge count tierTotal slots in this pool tier.
pool.availableGauge count tierFree buffers currently available.
pool.allocatedCounter count tierTotal buffers allocated since startup.
pool.returnedCounter count tierTotal buffers returned since startup.
pool.fallback_countCounter count tierAllocations that fell back to system allocator.
pool.exhaustion_eventsCounter count tierTimes the free list was empty when allocation was requested.
pool.reuse_rateDerived ratio tierreturned / allocated (computed during export).
Metric Name Type Unit Labels Description
capability.exercisesCounter count component_id, capabilityTimes a capability was exercised.
capability.denialsCounter count component_id, capabilityTimes a capability was denied.
Metric Name Type Unit Description
system.flows.activeGauge count Currently active flows.
system.components.activeGauge count Currently instantiated components.
system.memory.totalGauge bytes Total memory (host + all linear memories).
system.memory.hostGauge bytes Host-side memory (tables, queues, metrics).
system.scheduler.wakeupsCounter count Total scheduler wakeup events.
system.scheduler.idle_nsCounter ns Time spent idle (no work available).
system.spans_droppedCounter count Trace spans dropped due to export backpressure.
Prometheus: Scrape http://localhost:<port>/metrics (or the Unix domain socket at $TORVYN_STATE_DIR/torvyn.sock). All metrics are exported in Prometheus text exposition format.
OTLP: Configure [observability] otlp_metrics_enabled = true and otlp_export_interval_s to push metrics to an OpenTelemetry Collector, Grafana Cloud, or any OTLP-compatible backend.
torvyn bench: Benchmark reports include all metrics as computed deltas over the benchmark window.
Condition Metric Threshold Meaning
Error rate spike flow.elements.errors rate> 1% of total Components are failing. Investigate error logs.
Sustained backpressure stream.backpressure.duration_ns rate> 50% of wall time Consumer cannot keep up. Scale or optimize downstream.
Pool exhaustion pool.exhaustion_events rate> 0 sustained Buffer pool is undersized. Increase pool configuration.
High copy amplification flow.copies.bytes / flow.throughput * avg_element_size> 3.0 per stage More copies than expected. Investigate component data access patterns.
Memory growth component.memory_currentSustained increase Possible memory leak in component. Investigate component logic.
Tail latency flow.latency p99> 10× p50 Occasional slow processing. Check for backpressure, GC, or I/O pauses.