Documentation
¶
Overview ¶
Package telemetry assembles heartbeats and keeps rolling performance stats (tok/s, request counters) shared by the tunnel, local API and TUI.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HeartbeatInput ¶
type HeartbeatInput struct {
State typesv1.NodeState
QueueDepth int
GPUTempC float64
OnBattery bool
VRAMUsedMB uint64
RAMUsedMB uint64
Models []*typesv1.ModelState
}
HeartbeatInput carries the non-stats fields the builder needs.
type Snapshot ¶
type Snapshot struct {
TokensPerSec1m float64 `json:"tokens_per_sec_1m"`
RequestsPerMin float64 `json:"requests_per_min"`
TotalRequests int64 `json:"total_requests"`
TotalTokens int64 `json:"total_tokens"`
Inflight int `json:"inflight"`
EarnedMicrocred int64 `json:"earned_microcredits"`
}
Snapshot is a point-in-time view for the local API / heartbeat.
type Stats ¶
type Stats struct {
// contains filtered or unexported fields
}
Stats aggregates node-local counters. Safe for concurrent use.
func NewStatsWithClock ¶
NewStatsWithClock injects a clock (tests).
func (*Stats) BuildHeartbeat ¶
func (s *Stats) BuildHeartbeat(in HeartbeatInput) *tunnelv1.Heartbeat
BuildHeartbeat assembles the tunnel heartbeat message (SPEC §4.1 telemetry: capacity, queue depth, temps, tok/s rolling stats).
func (*Stats) RecordRequest ¶
RecordRequest registers a completed request and its simulated payout.
func (*Stats) RecordTokens ¶
RecordTokens registers n generated tokens at the current time.
func (*Stats) RequestFinished ¶
func (s *Stats) RequestFinished()
func (*Stats) RequestStarted ¶
func (s *Stats) RequestStarted()
RequestStarted / RequestFinished track in-flight depth.