metrics

package
v0.0.0-...-c4caace Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetProvider = provider.GetProvider

GetProvider returns the metrics provider singleton

Functions

This section is empty.

Types

type Collector

type Collector = provider.Collector

Collector defines an interface allowing to get stats from a containerID.

type CollectorMetadata

type CollectorMetadata = provider.CollectorMetadata

CollectorMetadata contains the characteristics of a collector to be registered with RegisterCollector

type ContainerCPUStats

type ContainerCPUStats = provider.ContainerCPUStats

ContainerCPUStats stores CPU stats.

type ContainerIOStats

type ContainerIOStats = provider.ContainerIOStats

ContainerIOStats store I/O statistics about a container.

type ContainerMemStats

type ContainerMemStats = provider.ContainerMemStats

ContainerMemStats stores memory statistics.

type ContainerNetworkStats

type ContainerNetworkStats = provider.ContainerNetworkStats

ContainerNetworkStats stores network statistics about a container per interface

type ContainerPIDStats

type ContainerPIDStats = provider.ContainerPIDStats

ContainerPIDStats stores stats about threads & processes.

type ContainerStats

type ContainerStats = provider.ContainerStats

ContainerStats wraps all container metrics

type DeviceIOStats

type DeviceIOStats = provider.DeviceIOStats

DeviceIOStats stores Device IO stats.

type InterfaceNetStats

type InterfaceNetStats = provider.InterfaceNetStats

InterfaceNetStats stores network statistics about a network interface

type MockCollector

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

MockCollector is a mocked collector

func NewMockCollector

func NewMockCollector(id string) *MockCollector

NewMockCollector creates a MockCollector

func (*MockCollector) Clear

func (mp *MockCollector) Clear()

Clear removes all entries

func (*MockCollector) DeleteContainerEntry

func (mp *MockCollector) DeleteContainerEntry(containerID string)

DeleteContainerEntry removes the entry for containerID

func (*MockCollector) GetContainerNetworkStats

func (mp *MockCollector) GetContainerNetworkStats(containerID string, cacheValidity time.Duration, networks map[string]string) (*ContainerNetworkStats, error)

GetContainerNetworkStats returns stats from MockContainerEntry

func (*MockCollector) GetContainerStats

func (mp *MockCollector) GetContainerStats(containerID string, cacheValidity time.Duration) (*ContainerStats, error)

GetContainerStats returns stats from MockContainerEntry

func (*MockCollector) ID

func (mp *MockCollector) ID() string

ID returns collector ID

func (*MockCollector) SetContainerEntry

func (mp *MockCollector) SetContainerEntry(containerID string, cEntry MockContainerEntry)

SetContainerEntry sets an entry for a given containerID

type MockContainerEntry

type MockContainerEntry struct {
	ContainerStats ContainerStats
	NetworkStats   ContainerNetworkStats
	Error          error
}

MockContainerEntry allows to customize mock responses

type MockMetricsProvider

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

MockMetricsProvider can be used to create tests

func NewMockMetricsProvider

func NewMockMetricsProvider() *MockMetricsProvider

NewMockMetricsProvider creates a mock provider

func (*MockMetricsProvider) Clear

func (mp *MockMetricsProvider) Clear()

Clear removes all collectors

func (*MockMetricsProvider) GetCollector

func (mp *MockMetricsProvider) GetCollector(runtime string) Collector

GetCollector emulates the MetricsProvider interface

func (*MockMetricsProvider) RegisterCollector

func (mp *MockMetricsProvider) RegisterCollector(collectorMeta CollectorMetadata)

RegisterCollector registers a collector

func (*MockMetricsProvider) RegisterConcreteCollector

func (mp *MockMetricsProvider) RegisterConcreteCollector(runtime string, c Collector)

RegisterConcreteCollector registers a collector

func (*MockMetricsProvider) RemoveCollector

func (mp *MockMetricsProvider) RemoveCollector(runtime string)

RemoveCollector removes a collector

type Provider

type Provider = provider.Provider

Provider interface allows to mock the metrics provider

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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