telemetry

package
v0.6.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 NewStats

func NewStats() *Stats

NewStats returns a Stats using the real clock.

func NewStatsWithClock

func NewStatsWithClock(now func() time.Time) *Stats

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

func (s *Stats) RecordRequest(completionTokens int, payoutMicro int64)

RecordRequest registers a completed request and its simulated payout.

func (*Stats) RecordTokens

func (s *Stats) RecordTokens(n int)

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.

func (*Stats) Snapshot

func (s *Stats) Snapshot() Snapshot

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL