heartbeat

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Key

func Key(keyPrefix, instanceID string) string

Key returns the Redis key for a given instance ID.

func Run

func Run(ctx context.Context, cfg Config)

Run publishes a heartbeat to Redis every 10 seconds. It deletes the instance key on context cancellation (clean shutdown).

Types

type Config

type Config struct {
	InstanceID string
	Client     *redis.Client
	KeyPrefix  string
	Hostname   string
	Listeners  []config.ListenerConfig
	StatsFunc  func() Stats
	Logger     *slog.Logger
}

Config configures the heartbeat publisher.

type Stats

type Stats struct {
	ActiveConns  int64
	TotalConns   int64
	BytesRead    int64
	BytesWritten int64
}

Stats holds runtime statistics for an instance.

Jump to

Keyboard shortcuts

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