advisor

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package advisor detects well-known ISUCON-critical settings that are NOT configured (prepared-statement round trips, nginx gzip/keepalive, kernel limits, GOMAXPROCS vs CPU quota, MySQL sizing) and reports them so the dashboard always shows what standard lever has not been pulled yet. Every check is fail-open: inspection problems degrade to StatusSkip.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	ID             string `json:"id"`
	Title          string `json:"title"`
	Status         Status `json:"status"`
	Detail         string `json:"detail,omitempty"`
	Recommendation string `json:"recommendation,omitempty"`
}

Check is one advisor finding.

func Collect

func Collect(ctx context.Context, opts Options) []Check

Collect runs every check and returns findings sorted most-severe first.

type Options

type Options struct {
	DriverName string
	DSN        string
	// DB is an open raw (unproxied) connection for MySQL variable checks.
	// The caller owns closing it.
	DB *sql.DB
	// NginxConf is the concatenated nginx configuration content.
	NginxConf []byte
	// FS is the root filesystem ("/" in production, a fixture in tests).
	FS fs.FS
	// GOMAXPROCS is runtime.GOMAXPROCS(0); 0 skips the check.
	GOMAXPROCS int
}

Options supplies the inspectable inputs. Zero values skip the related checks.

type Status

type Status string

Status classifies one check result.

const (
	// StatusOK means the recommended setting is in place.
	StatusOK Status = "ok"
	// StatusMissing means a standard, high-impact setting is absent.
	StatusMissing Status = "missing"
	// StatusWarn means the current value is likely to hurt under load.
	StatusWarn Status = "warn"
	// StatusInfo is advisory context, not a defect.
	StatusInfo Status = "info"
	// StatusSkip means the check could not run (input unavailable).
	StatusSkip Status = "skip"
)

Jump to

Keyboard shortcuts

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