monitor

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BandwidthStat

type BandwidthStat struct {
	Period    time.Duration
	PeriodStr string
	Bytes     int64
}

BandwidthStat represents bandwidth usage for a single period.

type InstanceInfo

type InstanceInfo struct {
	ID           string
	Hostname     string
	StartedAt    time.Time
	HeartbeatAt  time.Time
	Listeners    string // JSON string
	ActiveConns  int64
	TotalConns   int64
	BytesRead    int64
	BytesWritten int64
}

InstanceInfo represents a running Waypoint instance discovered from Redis.

func (InstanceInfo) HealthStatus

func (i InstanceInfo) HealthStatus() string

HealthStatus returns the health indicator based on heartbeat age.

func (InstanceInfo) Uptime

func (i InstanceInfo) Uptime() time.Duration

Uptime returns the duration since the instance started.

type Store

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

Store provides access to Redis for the monitor.

func NewStore

func NewStore(client redis.UniversalClient, keyPrefix string) *Store

NewStore creates a new monitor store.

func (*Store) DiscoverInstances

func (s *Store) DiscoverInstances(ctx context.Context) ([]InstanceInfo, error)

DiscoverInstances scans for all instance heartbeat keys and returns their info.

func (*Store) GetUserStats

func (s *Store) GetUserStats(ctx context.Context, user string) (*UserStats, error)

GetUserStats returns stats for a single user.

func (*Store) ListUsers

func (s *Store) ListUsers(ctx context.Context) ([]UserStats, error)

ListUsers discovers all users that have keys in Redis and returns their stats.

func (*Store) ResetAll

func (s *Store) ResetAll(ctx context.Context, user string) error

ResetAll resets all limits for a user.

func (*Store) ResetBandwidth

func (s *Store) ResetBandwidth(ctx context.Context, user string, periodSecs int64) error

ResetBandwidth resets bandwidth for a specific period.

func (*Store) ResetBytes

func (s *Store) ResetBytes(ctx context.Context, user string) error

ResetBytes resets the total byte count for a user.

func (*Store) ResetConns

func (s *Store) ResetConns(ctx context.Context, user string) error

ResetConns resets the connection count for a user.

type UserStats

type UserStats struct {
	LoginName   string
	ActiveConns int64
	TotalBytes  int64
	Bandwidth   []BandwidthStat
}

UserStats holds per-user limit statistics from Redis.

Jump to

Keyboard shortcuts

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