phpfpm

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogLevelAlert   = "ALERT"
	LogLevelError   = "ERROR"
	LogLevelWarning = "WARNING"
	LogLevelNotice  = "NOTICE"
	LogLevelDebug   = "DEBUG"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.2.0

type Config struct {
	Include  string
	ErrorLog string
	Pools    []Pool
}

func ParseConfig added in v0.2.0

func ParseConfig(fpmConfigPath string) (Config, error)

type ErrLogEntry added in v1.0.0

type ErrLogEntry struct {
	CreatedAt time.Time
	Level     LogLevel
	Message   string
}

type ErrLogParser added in v1.0.0

type ErrLogParser struct {
}

func NewErrLogParser added in v1.0.0

func NewErrLogParser() *ErrLogParser

func (*ErrLogParser) Parse added in v1.0.0

func (p *ErrLogParser) Parse(ctx context.Context, r io.Reader, out chan ErrLogEntry) error

func (*ErrLogParser) ParseOne added in v1.0.0

func (p *ErrLogParser) ParseOne(r *bufio.Reader) (ErrLogEntry, error)

type LogLevel added in v1.0.0

type LogLevel string

type Pool added in v0.2.0

type Pool struct {
	Name                     string
	Listen                   string
	StatusPath               string
	StatusListen             string
	SlowlogPath              string
	RequestSlowlogTimeout    int
	RequestSlowlogTraceDepth int
}

type Process added in v0.2.0

type Process struct {
	// contains filtered or unexported fields
}

func NewProcess added in v0.2.0

func NewProcess(
	fpmPath string, fpmConfigPath string,
	stdout io.Writer, stderr io.Writer,
	shutdownDelay time.Duration,
	env []string, extraArgs ...string,
) *Process

func (*Process) HandleSignal added in v0.2.0

func (p *Process) HandleSignal(signalCh chan os.Signal)

func (*Process) Start added in v0.2.0

func (p *Process) Start() error

func (*Process) Wait added in v0.2.0

func (p *Process) Wait(errCh chan<- error) int

type PromCollector added in v1.0.0

type PromCollector struct {
	// contains filtered or unexported fields
}

func NewPromCollector added in v1.0.0

func NewPromCollector(log *zap.Logger, metrics *PromMetrics, pools []Pool) *PromCollector

func (*PromCollector) Collect added in v1.0.0

func (c *PromCollector) Collect(metrics chan<- prometheus.Metric)

func (*PromCollector) Describe added in v1.0.0

func (c *PromCollector) Describe(descs chan<- *prometheus.Desc)

type PromMetrics added in v1.0.0

type PromMetrics struct {
	ListenQueue     *prometheus.GaugeVec
	ListenQueueLen  *prometheus.GaugeVec
	IdleProcesses   *prometheus.GaugeVec
	ActiveProcesses *prometheus.GaugeVec
	TotalProcesses  *prometheus.GaugeVec
	AcceptedConn    *prometheus.GaugeVec

	StartSince         *prometheus.GaugeVec
	MaxListenQueue     *prometheus.GaugeVec
	MaxActiveProcesses *prometheus.GaugeVec
	MaxChildrenReached *prometheus.GaugeVec
	SlowRequests       *prometheus.GaugeVec
}

func NewPromMetrics added in v1.0.0

func NewPromMetrics() *PromMetrics

type SlowlogEntry added in v1.0.0

type SlowlogEntry struct {
	CreatedAt      time.Time
	PoolName       string
	Pid            int
	ScriptFilename string
	Stacktrace     []SlowlogTraceEntry
}

func (*SlowlogEntry) Reset added in v1.0.0

func (se *SlowlogEntry) Reset()

func (*SlowlogEntry) String added in v1.0.0

func (se *SlowlogEntry) String() string

type SlowlogParser added in v1.0.0

type SlowlogParser struct {
	// contains filtered or unexported fields
}

func NewSlowlogParser added in v1.0.0

func NewSlowlogParser(maxTraceLen int) *SlowlogParser

func (*SlowlogParser) Parse added in v1.0.0

func (slp *SlowlogParser) Parse(ctx context.Context, r io.Reader, out chan SlowlogEntry) error

type SlowlogTraceEntry added in v1.0.0

type SlowlogTraceEntry struct {
	PtrHex  string
	FunName string
	Path    string
	Line    int
}

type Status

type Status struct {
	Name               string `json:"pool"`
	ProcessManager     string `json:"process manager"`
	StartTime          int    `json:"start time"`
	StartSince         int    `json:"start since"`
	AcceptedConn       int    `json:"accepted conn"`
	ListenQueue        int    `json:"listen queue"`
	MaxListenQueue     int    `json:"max listen queue"`
	ListenQueueLen     int    `json:"listen queue len"`
	IdleProcesses      int    `json:"idle processes"`
	ActiveProcesses    int    `json:"active processes"`
	TotalProcesses     int    `json:"total processes"`
	MaxActiveProcesses int    `json:"max active processes"`
	MaxChildrenReached int    `json:"max children reached"`
	SlowRequests       int    `json:"slow requests"`
}

func GetStats

func GetStats(net, addr, statusPath string) (*Status, error)

Jump to

Keyboard shortcuts

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