Documentation
¶
Index ¶
- Constants
- func ReadStartTimeTicks(pid int) (uint64, error)
- func RedactArgs(args []string) []string
- func RemoveRecordByPID(pid int) error
- func RemoveRecordByPath(path string) error
- func ResolveDir() (string, error)
- func ResolvePathForPID(pid int) (string, error)
- func ResolvePathFromEnv(pid int) string
- func ResolvePathFromTemplate(template string, pid int) string
- func ResolvePathTemplate() (string, error)
- func Terminate(pid int, timeout time.Duration) error
- func WaitForStartTimeTicks(pid int, timeout time.Duration) uint64
- func WriteRecord(path string, record Record) error
- type Record
- type RuntimeState
- type Status
- type StoredRecord
Constants ¶
const ( // ProcessRecordPathEnv stores the detached process record path template. // The `%PID%` token, if present, is replaced by the running process PID. ProcessRecordPathEnv = "KONGCTL_PROCESS_RECORD_FILE" )
Variables ¶
This section is empty.
Functions ¶
func ReadStartTimeTicks ¶
ReadStartTimeTicks reads the process start time ticks from /proc/<pid>/stat.
func RedactArgs ¶
RedactArgs returns a copy of args with sensitive flag values redacted.
func RemoveRecordByPID ¶
RemoveRecordByPID removes the process record for pid.
func RemoveRecordByPath ¶
RemoveRecordByPath removes a process record file.
func ResolveDir ¶
ResolveDir returns the detached process registry directory.
func ResolvePathForPID ¶
ResolvePathForPID returns a concrete record path for a PID.
func ResolvePathFromEnv ¶
ResolvePathFromEnv resolves the detached process record path from the environment for the provided PID.
func ResolvePathFromTemplate ¶
ResolvePathFromTemplate expands a PID token inside a record path template.
func ResolvePathTemplate ¶
ResolvePathTemplate returns the default per-process record path template.
func WaitForStartTimeTicks ¶
WaitForStartTimeTicks waits for /proc stat start time to become available.
func WriteRecord ¶
WriteRecord persists a process record atomically at path.
Types ¶
type Record ¶
type Record struct {
PID int `json:"pid" yaml:"pid"`
Kind string `json:"kind" yaml:"kind"`
Profile string `json:"profile,omitempty" yaml:"profile,omitempty"`
CreatedAt time.Time `json:"created_at" yaml:"created_at"`
LogFile string `json:"log_file,omitempty" yaml:"log_file,omitempty"`
Args []string `json:"args,omitempty" yaml:"args,omitempty"`
StartTimeTicks uint64 `json:"start_time_ticks,omitempty" yaml:"start_time_ticks,omitempty"`
}
Record describes a detached kongctl process.
type RuntimeState ¶
type RuntimeState struct {
Status Status `json:"status" yaml:"status"`
Running bool `json:"running" yaml:"running"`
ObservedStartTimeTicks uint64 `json:"observed_start_time_ticks,omitempty" yaml:"observed_start_time_ticks,omitempty"`
CheckError string `json:"check_error,omitempty" yaml:"check_error,omitempty"`
}
RuntimeState captures live process status for a stored record.
func Inspect ¶
func Inspect(record Record) RuntimeState
Inspect evaluates whether a recorded process is still running.
type StoredRecord ¶
StoredRecord includes the record and backing file path.
func ListRecords ¶
func ListRecords() ([]StoredRecord, error)
ListRecords returns all stored detached process records.