sources

package
v2.23.2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OSSNamespace       = "nginx"
	PlusNamespace      = "plus"
	SystemNamespace    = "system"
	ContainerNamespace = "container"

	OSSNginxType  = "oss"
	PlusNginxType = "plus"

	CpuGroup    = "cpu"
	MemoryGroup = "mem"
)
View Source
const (
	ContainerCpuMetricsWarning = "Unable to collect %s.%s metrics, %v"

	CpuCoresMetricName                = "cores"
	CpuPeriodMetricName               = "period"
	CpuQuotaMetricName                = "quota"
	CpuSharesMetricName               = "shares"
	CpuSetCoresMetricName             = "set.cores"
	CpuThrottlingTimeMetricName       = "throttling.time"
	CpuThrottlingThrottledMetricName  = "throttling.throttled"
	CpuThrottlingPeriodsMetricName    = "throttling.periods"
	CpuThrottlingPercentageMetricName = "throttling.percent"
)
View Source
const (
	ContainerMemoryMetricsWarning = "Unable to collect %s.%s metrics, %v"

	OutOfMemoryMetricName     = "oom"
	OutOfMemoryKillMetricName = "oom.kill"
)
View Source
const (
	HttpRequestBufferedMetricName      = "http.request.buffered"
	UpstreamResponseBufferedMetricName = "upstream.response.buffered"
	UpstreamRequestFailedMetricName    = "upstream.request.failed"
	UpstreamResponseFailedMetricName   = "upstream.response.failed"
)
View Source
const MOUNT_POINT = "mount_point"
View Source
const NETWORK_INTERFACE = "network_interface"

Variables

This section is empty.

Functions

func Delta

func Delta(current, previous map[string]map[string]float64) map[string]map[string]float64

func SendNginxDownStatus

func SendNginxDownStatus(ctx context.Context, dims []*proto.Dimension, m chan<- *proto.StatsEntity)

Types

type CPUTimes

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

func NewCPUTimesSource

func NewCPUTimesSource(namespace string, env core.Environment) *CPUTimes

func (*CPUTimes) Collect

func (c *CPUTimes) Collect(ctx context.Context, wg *sync.WaitGroup, m chan<- *proto.StatsEntity)

type ContainerCPU

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

func NewContainerCPUSource

func NewContainerCPUSource(namespace string, basePath string) *ContainerCPU

func (*ContainerCPU) Collect

func (c *ContainerCPU) Collect(ctx context.Context, wg *sync.WaitGroup, m chan<- *proto.StatsEntity)

type ContainerMemory

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

func NewContainerMemorySource

func NewContainerMemorySource(namespace string, basePath string) *ContainerMemory

func (*ContainerMemory) Collect

func (c *ContainerMemory) Collect(ctx context.Context, wg *sync.WaitGroup, m chan<- *proto.StatsEntity)

type Disk

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

func NewDiskSource

func NewDiskSource(namespace string) *Disk

func (*Disk) Collect

func (c *Disk) Collect(ctx context.Context, wg *sync.WaitGroup, m chan<- *proto.StatsEntity)

type DiskIO

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

func NewDiskIOSource

func NewDiskIOSource(namespace string, env core.Environment) *DiskIO

func (*DiskIO) Collect

func (dio *DiskIO) Collect(ctx context.Context, wg *sync.WaitGroup, m chan<- *proto.StatsEntity)

type Load

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

func NewLoadSource

func NewLoadSource(namespace string) *Load

func (*Load) Collect

func (c *Load) Collect(ctx context.Context, wg *sync.WaitGroup, m chan<- *proto.StatsEntity)

type NetIO

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

func NewNetIOSource

func NewNetIOSource(namespace string, env core.Environment) *NetIO

func (*NetIO) Collect

func (nio *NetIO) Collect(ctx context.Context, wg *sync.WaitGroup, m chan<- *proto.StatsEntity)

type NginxAccessLog

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

func NewNginxAccessLog

func NewNginxAccessLog(
	baseDimensions *metrics.CommonDim,
	namespace string,
	binary core.NginxBinary,
	nginxType string,
	collectionInterval time.Duration) *NginxAccessLog

func (*NginxAccessLog) Collect

func (c *NginxAccessLog) Collect(ctx context.Context, wg *sync.WaitGroup, m chan<- *proto.StatsEntity)

func (*NginxAccessLog) Stop

func (c *NginxAccessLog) Stop()

func (*NginxAccessLog) Update

func (c *NginxAccessLog) Update(dimensions *metrics.CommonDim, collectorConf *metrics.NginxCollectorConfig)

type NginxErrorLog

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

func NewNginxErrorLog

func NewNginxErrorLog(
	baseDimensions *metrics.CommonDim,
	namespace string,
	binary core.NginxBinary,
	nginxType string,
	collectionInterval time.Duration) *NginxErrorLog

func (*NginxErrorLog) Collect

func (c *NginxErrorLog) Collect(ctx context.Context, wg *sync.WaitGroup, m chan<- *proto.StatsEntity)

func (*NginxErrorLog) Stop

func (c *NginxErrorLog) Stop()

func (*NginxErrorLog) Update

func (c *NginxErrorLog) Update(dimensions *metrics.CommonDim, collectorConf *metrics.NginxCollectorConfig)

type NginxOSS

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

func NewNginxOSS

func NewNginxOSS(baseDimensions *metrics.CommonDim, namespace, stubStatus string) *NginxOSS

func (*NginxOSS) Collect

func (c *NginxOSS) Collect(ctx context.Context, wg *sync.WaitGroup, m chan<- *proto.StatsEntity)

func (*NginxOSS) Stop

func (c *NginxOSS) Stop()

func (*NginxOSS) Update

func (c *NginxOSS) Update(dimensions *metrics.CommonDim, collectorConf *metrics.NginxCollectorConfig)

type NginxPlus

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

NginxPlus generates metrics from NGINX Plus API

func NewNginxPlus

func NewNginxPlus(baseDimensions *metrics.CommonDim, nginxNamespace, plusNamespace, plusAPI string, clientVersion int) *NginxPlus

func (*NginxPlus) Collect

func (c *NginxPlus) Collect(ctx context.Context, wg *sync.WaitGroup, m chan<- *proto.StatsEntity)

func (*NginxPlus) Stop

func (c *NginxPlus) Stop()

func (*NginxPlus) Update

func (c *NginxPlus) Update(dimensions *metrics.CommonDim, collectorConf *metrics.NginxCollectorConfig)

type NginxProcess

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

func NewNginxProcess

func NewNginxProcess(baseDimensions *metrics.CommonDim,
	namespace string,
	binary core.NginxBinary) *NginxProcess

NewNginxProc collects metrics about nginx and nginx child processes

func (*NginxProcess) Collect

func (c *NginxProcess) Collect(ctx context.Context, wg *sync.WaitGroup, m chan<- *proto.StatsEntity)

func (*NginxProcess) Stop

func (c *NginxProcess) Stop()

func (*NginxProcess) Update

func (c *NginxProcess) Update(dimensions *metrics.CommonDim, collectorConf *metrics.NginxCollectorConfig)

type NginxStatic

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

func NewNginxStatic

func NewNginxStatic(baseDimensions *metrics.CommonDim, namespace string) *NginxStatic

This is to output a static "nginx.status = 0" metric if NGINX is not running or detected or NGINX Plus API or stub_status API is not setup properly.

func (*NginxStatic) Collect

func (c *NginxStatic) Collect(ctx context.Context, wg *sync.WaitGroup, m chan<- *proto.StatsEntity)

func (*NginxStatic) Stop

func (c *NginxStatic) Stop()

func (*NginxStatic) Update

func (c *NginxStatic) Update(dimensions *metrics.CommonDim, collectorConf *metrics.NginxCollectorConfig)

type NginxWorker

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

func NewNginxWorker

func NewNginxWorker(baseDimensions *metrics.CommonDim,
	namespace string,
	binary core.NginxBinary,
	collector NginxWorkerCollector) *NginxWorker

NewNginxWorker collects metrics about nginx child processes

func (*NginxWorker) Collect

func (c *NginxWorker) Collect(ctx context.Context, wg *sync.WaitGroup, m chan<- *proto.StatsEntity)

func (*NginxWorker) Stop

func (c *NginxWorker) Stop()

func (*NginxWorker) Update

func (c *NginxWorker) Update(dimensions *metrics.CommonDim, collectorConf *metrics.NginxCollectorConfig)

type NginxWorkerClient

type NginxWorkerClient struct{}

NginxWorkerClient allows you to fetch NGINX worker metrics from psutil via the PID of the master procs it implements an interface that we can mock for testing

func (*NginxWorkerClient) GetWorkerStats

func (client *NginxWorkerClient) GetWorkerStats(childProcs []*proto.NginxDetails) (*WorkerStats, error)

GetWorkerStats fetches the nginx master & worker metrics from psutil.

type NginxWorkerCollector

type NginxWorkerCollector interface {
	GetWorkerStats(childProcs []*proto.NginxDetails) (*WorkerStats, error)
}

func NewNginxWorkerClient

func NewNginxWorkerClient() NginxWorkerCollector

type Swap

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

func NewSwapSource

func NewSwapSource(namespace string, env core.Environment) *Swap

func (*Swap) Collect

func (c *Swap) Collect(ctx context.Context, wg *sync.WaitGroup, m chan<- *proto.StatsEntity)

type VirtualMemory

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

func NewVirtualMemorySource

func NewVirtualMemorySource(namespace string, env core.Environment) *VirtualMemory

func (*VirtualMemory) Collect

func (c *VirtualMemory) Collect(ctx context.Context, wg *sync.WaitGroup, m chan<- *proto.StatsEntity)

type WorkerStats

type WorkerStats struct {
	Workers *Workers
}

WorkerStats represents NGINX worker metrics

type Workers

type Workers struct {
	Count        float64
	KbsR         float64
	KbsW         float64
	CPUSystem    float64
	CPUTotal     float64
	CPUUser      float64
	FdsCount     float64
	MemVms       float64
	MemRss       float64
	MemRssPct    float64
	RlimitNofile float64
}

Workers represents metrics related to child nginx processes

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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