activity

package
v0.1.1-beta.2 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BucketDuration is the size of each sparkline bucket
	BucketDuration = 15 * time.Second
	// BucketCount is how many buckets to keep (20 buckets × 15s = 5 minutes of history)
	BucketCount = 20
)

Variables

This section is empty.

Functions

This section is empty.

Types

type SessionActivity

type SessionActivity struct {
	// contains filtered or unexported fields
}

SessionActivity tracks output activity for a single session

type Snapshot

type Snapshot struct {
	Host        string  `json:"host,omitempty"` // peer fingerprint (empty = local)
	SessionName string  `json:"session"`
	IdleSeconds float64 `json:"idle_seconds"`
	Sparkline   []int64 `json:"sparkline"` // most recent BucketCount buckets, oldest first
	TotalBytes  int64   `json:"total_bytes"`
}

Snapshot is a point-in-time view of a session's activity

type Tracker

type Tracker struct {
	// contains filtered or unexported fields
}

Tracker tracks output activity across all sessions

func NewTracker

func NewTracker() *Tracker

NewTracker creates a new activity tracker

func (*Tracker) Get

func (t *Tracker) Get(session string) *Snapshot

Get returns a snapshot of a session's activity

func (*Tracker) GetAll

func (t *Tracker) GetAll() []*Snapshot

GetAll returns snapshots for all tracked sessions

func (*Tracker) Record

func (t *Tracker) Record(session string, n int)

Record records output bytes for a session

func (*Tracker) Remove

func (t *Tracker) Remove(session string)

Remove removes tracking for a session

Jump to

Keyboard shortcuts

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