Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultSockPath ¶
func DefaultSockPath() string
DefaultSockPath returns the preferred socket path under a 0700 runtime directory.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client connects to the xtop daemon Unix socket API.
func TryConnect ¶
func TryConnect() *Client
TryConnect attempts to connect to the daemon socket. Returns the client if successful, nil otherwise.
func (*Client) Incidents ¶
func (c *Client) Incidents(limit int) ([]store.IncidentRecord, error)
Incidents returns stored incidents.
func (*Client) Status ¶
func (c *Client) Status() (*StatusResponse, error)
Status returns the current health status.
type DaemonSnapshotProvider ¶
type DaemonSnapshotProvider struct {
// contains filtered or unexported fields
}
DaemonSnapshotProvider wraps engine state for the API.
func NewDaemonSnapshotProvider ¶
func NewDaemonSnapshotProvider() *DaemonSnapshotProvider
func (*DaemonSnapshotProvider) ImpactScores ¶
func (p *DaemonSnapshotProvider) ImpactScores() []model.ImpactScore
func (*DaemonSnapshotProvider) Latest ¶
func (p *DaemonSnapshotProvider) Latest() (*model.Snapshot, *model.RateSnapshot, *model.AnalysisResult)
func (*DaemonSnapshotProvider) Update ¶
func (p *DaemonSnapshotProvider) Update(snap *model.Snapshot, rates *model.RateSnapshot, result *model.AnalysisResult, scores []model.ImpactScore)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a Unix socket HTTP API server for xtop.
func NewServer ¶
NewServer creates a new API server. sockPath: path to Unix socket (/run/xtop.sock or ~/.xtop/xtop.sock).
type SnapshotProvider ¶
type SnapshotProvider interface {
Latest() (*model.Snapshot, *model.RateSnapshot, *model.AnalysisResult)
ImpactScores() []model.ImpactScore
}
SnapshotProvider gives access to the latest snapshot data.
type StatusResponse ¶
type StatusResponse struct {
Timestamp interface{} `json:"timestamp"`
Health string `json:"health"`
Confidence int `json:"confidence"`
Bottleneck string `json:"bottleneck,omitempty"`
Score int `json:"score"`
RootCause string `json:"root_cause,omitempty"`
Pattern string `json:"pattern,omitempty"`
CausalChain string `json:"causal_chain,omitempty"`
TopOffender string `json:"top_offender,omitempty"`
TopOffenderPID int `json:"top_offender_pid,omitempty"`
CPUBusy float64 `json:"cpu_busy"`
MemPct float64 `json:"mem_pct"`
}
StatusResponse is the /v1/status endpoint response.
Click to show internal directories.
Click to hide internal directories.