sources

package
v2.33.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 30 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<- *metrics.StatsEntityWrapper)

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<- *metrics.StatsEntityWrapper)

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<- *metrics.StatsEntityWrapper)

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<- *metrics.StatsEntityWrapper)

type Disk

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

func NewDiskSource

func NewDiskSource(namespace string, env core.Environment) *Disk

func (*Disk) Collect

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

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<- *metrics.StatsEntityWrapper)

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<- *metrics.StatsEntityWrapper)

type MetricSourceLogger added in v2.24.0

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

func NewMetricSourceLogger added in v2.24.0

func NewMetricSourceLogger() *MetricSourceLogger

func (*MetricSourceLogger) Log added in v2.24.0

func (m *MetricSourceLogger) Log(message string)

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<- *metrics.StatsEntityWrapper)

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<- *metrics.StatsEntityWrapper)

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<- *metrics.StatsEntityWrapper)

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<- *metrics.StatsEntityWrapper)

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<- *metrics.StatsEntityWrapper)

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<- *metrics.StatsEntityWrapper)

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<- *metrics.StatsEntityWrapper)

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<- *metrics.StatsEntityWrapper)

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 {
	// contains filtered or unexported fields
}

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(env core.Environment) 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<- *metrics.StatsEntityWrapper)

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<- *metrics.StatsEntityWrapper)

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