observer

package
v0.0.0-...-78ca630 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentMessageParser

type AgentMessageParser struct {
}

AgentMessageParser implements parsing of agent response

func (AgentMessageParser) Parse

func (parser AgentMessageParser) Parse(body []byte) (*NodeStatistics, error)

Parse agent response to struct

type ClustersApcuStatuses

type ClustersApcuStatuses map[string]map[string]map[string]NodeApcuStatus

type ClustersOpcacheStatuses

type ClustersOpcacheStatuses map[string]map[string]map[string]NodeOpcacheStatus

ClustersOpcacheStatuses represents collection of node opcache statuses Struct: {clusterName}.{groupName}.{nodeName} => NodeOpcacheStatus

type InternedStingsMemory

type InternedStingsMemory struct {
	Total        int // configuration.directives.opcache.interned_strings_buffer
	BufferSize   int // status.interned_strings_usage.buffer_size
	UsedMemory   int // status.interned_strings_usage.used_memory
	FreeMemory   int // status.interned_strings_usage.free_memory
	NumOfStrings int // status.interned_strings_usage.number_of_strings
}

type KeyHits

type KeyHits struct {
	Hits   int // status.opcache_statistics.hits
	Misses int // status.opcache_statistics.misses
}

type Keys

type Keys struct {
	Total       int // configuration.directives.opcache.max_accelerated_files, The maximum number of keys (and therefore scripts) in the OPcache hash table
	TotalPrime  int // status.opcache_statistics.max_cached_keys
	UsedKeys    int // status.opcache_statistics.num_cached_keys
	UsedScripts int // status.opcache_statistics.num_cached_scripts
	Free        int // may be defined as TotalPrime-UsedKeys
}

type Memory

type Memory struct {
	Total                   int     // configuration.directives.opcache.memory_consumption
	Used                    int     // status.memory_usage.used_memory
	Free                    int     // status.memory_usage.free_memory
	Wasted                  int     // status.memory_usage.wasted_memory
	MaxWastedPercentage     float64 // configuration.directives.opcache.max_wasted_percentage
	CurrentWastedPercentage float64 // status.memory_usage.current_wasted_percentage
}

type MetricSenderInterface

type MetricSenderInterface interface {
	Send(
		clusterName string,
		groupName string,
		hostName string,
		nodeStatistics NodeStatistics,
	)
}

type NodeApcuSetting

type NodeApcuSetting struct {
	GlobalValue string
	LocalValue  string
	Access      int
}

type NodeApcuSmaInfo

type NodeApcuSmaInfo struct {
	NumSeg   int
	SegSize  int // Total memory
	AvailMem int // Free memory

}

type NodeApcuStatus

type NodeApcuStatus struct {
	Enabled  bool
	SmaInfo  *NodeApcuSmaInfo
	Settings *map[string]NodeApcuSetting
}

type NodeOpcacheStatus

type NodeOpcacheStatus struct {
	Configuration map[string]interface{}
	PHPVersion    string // configuration.version.version
	Scripts       map[string]Script
	Optimizations []int //configuration.directives.opcache.optimization_level
	StartTime     int64 // status.opcache_statistics.start_time
	// If cache_full is true and num_cached_keys equals max_cached_keys then there are too many files.
	// No restart will be triggered. As a result there are scripts that don't get cached,
	// even though there might be memory available.
	CacheFull            bool // status.cache_full
	Memory               Memory
	InternedStingsMemory InternedStingsMemory
	Keys                 Keys
	KeyHits              KeyHits
	Restarts             Restarts
}

NodeOpcacheStatus represents status of opcache on single node

type NodeStatistics

type NodeStatistics struct {
	OpcacheStatistics NodeOpcacheStatus
	ApcuStatistics    NodeApcuStatus
}

type Observer

type Observer struct {
	Clusters         map[string]configuration.ClusterConfig
	LastStatusUpdate time.Time
	// contains filtered or unexported fields
}

Observer periodically reads status of observable nodes and aggregates received data

func NewObserver

func NewObserver(clusters map[string]configuration.ClusterConfig) *Observer

func (*Observer) AddMetricSender

func (o *Observer) AddMetricSender(metricSender MetricSenderInterface)

func (*Observer) GetApcuStatistics

func (o *Observer) GetApcuStatistics() ClustersApcuStatuses

GetApcuStatistics returns pulled APCu statuses for all clusters

func (*Observer) GetOpcacheStatistics

func (o *Observer) GetOpcacheStatistics() ClustersOpcacheStatuses

GetOpcacheStatistics returns pulled opcache statuses for all clusters

func (*Observer) PullAgents

func (o *Observer) PullAgents()

PullAgents fetches data from all agents and store it to internal struct

func (*Observer) ResetOpcache

func (o *Observer) ResetOpcache(clusterName string, groupName string, hostName string) error

func (*Observer) StartPulling

func (o *Observer) StartPulling(
	refreshIntervalNanoSeconds int64,
)

StartPulling observing of configured nodes

func (*Observer) StopPulling

func (o *Observer) StopPulling()

StopPulling stops observing ticker

type Restarts

type Restarts struct {
	// Restarts occured when:
	//  - wasted scripts > "opcache.max_wasted_percentage"
	//  - "status.opcache_statistics.num_cached_scripts" > "opcache.max_accelerated_files"
	OutOfMemoryCount int   // status.opcache_statistics.oom_restarts
	HashCount        int   // status.opcache_statistics.hash_restarts
	ManualCount      int   // status.opcache_statistics.manual_restarts
	LastRestartTime  int64 // status.opcache_statistics.last_restart_time
}

type Script

type Script struct {
	Hits              int
	CreateTimestamp   int64
	LastUsedTimestamp int64
	Memory            int
}

Script represents info abount signle script on one node

Jump to

Keyboard shortcuts

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