Documentation
¶
Overview ¶
Copyright (c) F5, Inc.
This source code is licensed under the Apache License, Version 2.0 license found in the LICENSE file in the root directory of this source tree.
Package nginxprocess contains utilities for working with OS-level NGINX processes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNotNginxErr ¶
IsNotNginxErr returns true if this error is due to the process not being an NGINX process.
func IsNotRunningErr ¶
IsNotRunningErr returns true if this error is due to the OS process no longer running.
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option customizes how processes are gathered from the OS.
func WithStatus ¶
WithStatus runs an additional lookup to load the process status.
type Process ¶
type Process struct {
// Created is when this process was created, precision varies by platform and is at best to the millisecond. On
// linux there can be significant skew compared to [time.Now], ± 1s.
Created time.Time
Name string
Cmd string
Exe string // path to the executable
Status string // process status, only present if this process was created using [WithStatus]
PID int32
PPID int32 // parent PID
}
Process contains a snapshot of read-only data about an OS-level NGINX process. Create using List or Find.
func Find ¶
Find returns a single NGINX process by PID. Returns an error if the PID is no longer running or if it is not an NGINX process. Use with [IsProcessNotRunningErr] and IsNotNginxErr.
func List ¶
List returns a slice of all NGINX processes. Returns a zero-length slice if no NGINX processes are found.
func ListWithProcesses ¶
func ListWithProcesses( ctx context.Context, processes []*process.Process, opts ...Option, ) (ret []*Process, err error)
ListWithProcesses returns a slice of all NGINX processes. Returns a zero-length slice if no NGINX processes are found.
func (*Process) IsHealthy ¶
IsHealthy uses Status flags to judge process health. Only works on processes created using WithStatus.
func (*Process) IsShuttingDown ¶
IsShuttingDown returns true if the process is shutting down. This can identify workers that are in the process of a graceful shutdown. See changing NGINX configuration for more details.