Documentation
¶
Index ¶
- type BandwidthStat
- type InstanceInfo
- type Store
- func (s *Store) DiscoverInstances(ctx context.Context) ([]InstanceInfo, error)
- func (s *Store) GetUserStats(ctx context.Context, user string) (*UserStats, error)
- func (s *Store) ListUsers(ctx context.Context) ([]UserStats, error)
- func (s *Store) ResetAll(ctx context.Context, user string) error
- func (s *Store) ResetBandwidth(ctx context.Context, user string, periodSecs int64) error
- func (s *Store) ResetBytes(ctx context.Context, user string) error
- func (s *Store) ResetConns(ctx context.Context, user string) error
- type UserStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BandwidthStat ¶
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 ¶
GetUserStats returns stats for a single user.
func (*Store) ListUsers ¶
ListUsers discovers all users that have keys in Redis and returns their stats.
func (*Store) ResetBandwidth ¶
ResetBandwidth resets bandwidth for a specific period.
func (*Store) ResetBytes ¶
ResetBytes resets the total byte count for a user.