metrics

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyNtpHosts    = errors.New("ntp host list is empty")
	ErrGettingNtpOffset = errors.New("cannot get ntp offset")
)

Functions

func FilterStorageSamples

func FilterStorageSamples(samples sample.EventBatch) []*storage.Sample

filterStorageSamples will be used to remove disk samples that should not be taken into account. e.g. duplicates.

func NewProcessSample

func NewProcessSample(pid int32) *types.ProcessSample

Types

type CPUMonitor

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

func NewCPUMonitor

func NewCPUMonitor(context agent.AgentContext) *CPUMonitor

func (*CPUMonitor) Sample

func (self *CPUMonitor) Sample() (sample *CPUSample, err error)

type CPUSample

type CPUSample struct {
	CPUPercent       float64 `json:"cpuPercent"`
	CPUUserPercent   float64 `json:"cpuUserPercent"`
	CPUSystemPercent float64 `json:"cpuSystemPercent"`
	CPUIOWaitPercent float64 `json:"cpuIOWaitPercent"`
	CPUIdlePercent   float64 `json:"cpuIdlePercent"`
	CPUStealPercent  float64 `json:"cpuStealPercent"`
}

type ContainerSampler

type ContainerSampler interface {
	Enabled() bool
	NewDecorator() (ProcessDecorator, error)
}

func NewDockerSampler

func NewDockerSampler(cacheTTL time.Duration, apiVersion string) ContainerSampler

func NewDockerSamplerWithClient

func NewDockerSamplerWithClient(client helpers.Docker, cacheTTL time.Duration, apiVersion string) ContainerSampler

type DiskMonitor

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

func NewDiskMonitor

func NewDiskMonitor(storageSampler *storage.Sampler) *DiskMonitor

func (*DiskMonitor) Sample

func (m *DiskMonitor) Sample() (result *DiskSample, err error)

type DiskSample

type DiskSample struct {
	UsedBytes               float64 `json:"diskUsedBytes"`
	UsedPercent             float64 `json:"diskUsedPercent"`
	FreeBytes               float64 `json:"diskFreeBytes"`
	FreePercent             float64 `json:"diskFreePercent"`
	TotalBytes              float64 `json:"diskTotalBytes"`
	UtilizationPercent      float64 `json:"diskUtilizationPercent"`
	ReadUtilizationPercent  float64 `json:"diskReadUtilizationPercent"`
	WriteUtilizationPercent float64 `json:"diskWriteUtilizationPercent"`
	ReadsPerSec             float64 `json:"diskReadsPerSecond"`
	WritesPerSec            float64 `json:"diskWritesPerSecond"`
}

type DockerSampler

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

func (*DockerSampler) Enabled

func (d *DockerSampler) Enabled() bool

polls on docker availability

func (*DockerSampler) NewDecorator

func (d *DockerSampler) NewDecorator() (ProcessDecorator, error)

type HeartbeatSample

type HeartbeatSample struct {
	sample.BaseEvent
	HeartbeatCounter int `json:"heartBeatCounter"`
}

type HeartbeatSampler

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

HeartbeatSampler is used only when IsSecureForwardOnly configuration is true. The Rate of this sampler could be increased since we've set it up to 1 min but it could be way higher.

func NewHeartbeatSampler

func NewHeartbeatSampler(context agent.AgentContext) *HeartbeatSampler

func (*HeartbeatSampler) Disabled

func (hb *HeartbeatSampler) Disabled() bool

func (*HeartbeatSampler) Interval

func (hb *HeartbeatSampler) Interval() time.Duration

func (*HeartbeatSampler) Name

func (*HeartbeatSampler) Name() string

func (*HeartbeatSampler) OnStartup

func (*HeartbeatSampler) OnStartup()

func (*HeartbeatSampler) Sample

func (f *HeartbeatSampler) Sample() (sample.EventBatch, error)

type HostMonitor added in v0.1.0

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

func NewHostMonitor added in v0.1.0

func NewHostMonitor(ntpMonitor NtpMonitor) *HostMonitor

func (*HostMonitor) Sample added in v0.1.0

func (m *HostMonitor) Sample() (*HostSample, error)

type HostSample added in v0.1.0

type HostSample struct {
	Uptime    uint64   `json:"uptime"`
	NtpOffset *float64 `json:"ntpOffset,omitempty"`
}

type InternalProcess

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

func NewInternalProcess

func NewInternalProcess(p *process.Process) *InternalProcess

func (*InternalProcess) Ppid

func (pw *InternalProcess) Ppid() (int32, error)

type InternalProcessInterrogator

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

func NewInternalProcessInterrogator

func NewInternalProcessInterrogator(privileged bool) *InternalProcessInterrogator

func (*InternalProcessInterrogator) NewProcess

func (ip *InternalProcessInterrogator) NewProcess(pid int32) (ProcessWrapper, error)

type LoadMonitor

type LoadMonitor struct {
}

func NewLoadMonitor

func NewLoadMonitor() *LoadMonitor

func (*LoadMonitor) Sample

func (self *LoadMonitor) Sample() (sample *LoadSample, err error)

type LoadSample

type LoadSample struct {
	LoadOne     float64 `json:"loadAverageOneMinute"`
	LoadFive    float64 `json:"loadAverageFiveMinute"`
	LoadFifteen float64 `json:"loadAverageFifteenMinute"`
}

type MemoryMonitor

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

func NewMemoryMonitor

func NewMemoryMonitor(ignoreReclaimable bool) *MemoryMonitor

NewMemoryMonitor returns a memory monitor. If consistentMemory is true, the reported free memory is reported as: total - free - buffers - cached - sreclaimable, as a consistent implementation that does not change between different kernel versions or library implementations. If consistentMemory is false, it reports the free memory as the Available Memory, dependant on the current kernel or library implementations.

func (*MemoryMonitor) Sample

func (mm *MemoryMonitor) Sample() (result *MemorySample, err error)

type MemorySample

type MemorySample struct {
	MemoryTotal       float64 `json:"memoryTotalBytes"`
	MemoryFree        float64 `json:"memoryFreeBytes"`
	MemoryUsed        float64 `json:"memoryUsedBytes"`
	MemoryFreePercent float64 `json:"memoryFreePercent"`
	MemoryUsedPercent float64 `json:"memoryUsedPercent"`
	MemoryCachedBytes float64 `json:"memoryCachedBytes"`
	MemorySlabBytes   float64 `json:"memorySlabBytes"`
	MemorySharedBytes float64 `json:"memorySharedBytes"`
	SwapSample
}

type Ntp added in v0.1.0

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

func NewNtp added in v0.1.0

func NewNtp(pool []string, timeout uint, interval uint) *Ntp

NewNtp creates a new Ntp instance timeout is expressed in secods interval is expressed in minutes.

func (*Ntp) Offset added in v0.1.0

func (p *Ntp) Offset() (time.Duration, error)

type NtpMonitor added in v0.1.0

type NtpMonitor interface {
	Offset() (time.Duration, error)
}

type ProcessCacheEntry

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

Deprecated (just for windows compatibility before we migrate it to the "process" package)

type ProcessDecorator

type ProcessDecorator interface {
	Decorate(process *metricTypes.ProcessSample)
}

type ProcessInterrogator

type ProcessInterrogator interface {
	NewProcess(int32) (ProcessWrapper, error)
}

Deprecated (just for windows compatibility before we migrate it to the "process" package)

type ProcessWrapper

type ProcessWrapper interface {
	Ppid() (int32, error)
}

Deprecated (just for windows compatibility before we migrate it to the "process" package)

type SwapSample added in v0.1.0

type SwapSample struct {
	SwapTotal float64 `json:"swapTotalBytes"`
	SwapFree  float64 `json:"swapFreeBytes"`
	SwapUsed  float64 `json:"swapUsedBytes"`
	// only available (gopsutil) in Linux
	SwapIn  *float64 `json:"swapInBytes,omitempty"`
	SwapOut *float64 `json:"swapOutBytes,omitempty"`
}

type SystemSample

SystemSample uses pointers to embedded structs to ensure that those attribute are only present if they are successfully collected.

type SystemSampler

type SystemSampler struct {
	CpuMonitor    *CPUMonitor
	DiskMonitor   *DiskMonitor
	LoadMonitor   *LoadMonitor
	MemoryMonitor *MemoryMonitor
	HostMonitor   *HostMonitor
	// contains filtered or unexported fields
}

func NewSystemSampler

func NewSystemSampler(context agent.AgentContext, storageSampler *storage.Sampler, ntpMonitor NtpMonitor) *SystemSampler

func (*SystemSampler) Disabled

func (s *SystemSampler) Disabled() bool

func (*SystemSampler) Interval

func (s *SystemSampler) Interval() time.Duration

func (*SystemSampler) Name

func (s *SystemSampler) Name() string

func (*SystemSampler) OnStartup

func (s *SystemSampler) OnStartup()

func (*SystemSampler) Sample

func (s *SystemSampler) Sample() (results sample.EventBatch, err error)

Directories

Path Synopsis
nfs

Jump to

Keyboard shortcuts

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