debug

package
v1.30.8 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 25 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpAllNamespaceInfo

func DumpAllNamespaceInfo(ctx context.Context, c clientset.Interface, namespace string)

DumpAllNamespaceInfo dumps events, pods and nodes information in the given namespace.

func DumpNodeDebugInfo

func DumpNodeDebugInfo(ctx context.Context, c clientset.Interface, nodeNames []string, logFunc func(fmt string, args ...interface{}))

DumpNodeDebugInfo dumps debug information of the given nodes.

Types

type ContainerResourceGatherer

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

ContainerResourceGatherer is a struct for gathering container resource.

func NewResourceUsageGatherer

func NewResourceUsageGatherer(ctx context.Context, c clientset.Interface, options ResourceGathererOptions, pods *v1.PodList) (*ContainerResourceGatherer, error)

NewResourceUsageGatherer returns a new ContainerResourceGatherer.

func (*ContainerResourceGatherer) StartGatheringData

func (g *ContainerResourceGatherer) StartGatheringData(ctx context.Context)

StartGatheringData starts a stat gathering worker blocks for each node to track, and blocks until StopAndSummarize is called.

func (*ContainerResourceGatherer) StopAndSummarize

func (g *ContainerResourceGatherer) StopAndSummarize(percentiles []int, constraints map[string]ResourceConstraint) (*ResourceUsageSummary, error)

StopAndSummarize stops stat gathering workers, processes the collected stats, generates resource summary for the passed-in percentiles, and returns the summary. It returns an error if the resource usage at any percentile is beyond the specified resource constraints.

type ContainerResourceUsage

type ContainerResourceUsage struct {
	Name                    string
	Timestamp               time.Time
	CPUUsageInCores         float64
	MemoryUsageInBytes      uint64
	MemoryWorkingSetInBytes uint64
	MemoryRSSInBytes        uint64
	// The interval used to calculate CPUUsageInCores.
	CPUInterval time.Duration
}

ContainerResourceUsage is a structure for gathering container resource usage.

type EventsLister

type EventsLister func(opts metav1.ListOptions, ns string) (*v1.EventList, error)

EventsLister is a func that lists events.

type LogSizeDataTimeseries

type LogSizeDataTimeseries map[string]map[string][]TimestampedSize

LogSizeDataTimeseries is map of timestamped size.

type LogSizeGatherer

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

LogSizeGatherer is a worker which grabs a WorkItem from the channel and does assigned work.

func (*LogSizeGatherer) Run

func (g *LogSizeGatherer) Run(ctx context.Context)

Run starts log size gathering.

func (*LogSizeGatherer) Work

func (g *LogSizeGatherer) Work(ctx context.Context) bool

Work does a single unit of work: tries to take out a WorkItem from the queue, ssh-es into a given machine, gathers data, writes it to the shared <data> map, and creates a gorouting which reinserts work item into the queue with a <pollingPeriod> delay. Returns false if worker should exit.

type LogsSizeData

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

LogsSizeData is a structure for handling timeseries of log size data and lock.

type LogsSizeDataSummary

type LogsSizeDataSummary map[string]map[string]SingleLogSummary

LogsSizeDataSummary is map of log summary. node -> file -> data

func (*LogsSizeDataSummary) PrintHumanReadable

func (s *LogsSizeDataSummary) PrintHumanReadable() string

PrintHumanReadable returns string of log size data summary. TODO: make sure that we don't need locking here

func (*LogsSizeDataSummary) PrintJSON

func (s *LogsSizeDataSummary) PrintJSON() string

PrintJSON returns the summary of log size data with JSON format.

func (*LogsSizeDataSummary) SummaryKind

func (s *LogsSizeDataSummary) SummaryKind() string

SummaryKind returns the summary of log size data summary.

type LogsSizeVerifier

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

LogsSizeVerifier gathers data about log files sizes from master and node machines. It oversees a <workersNo> workers which do the gathering.

func NewLogsVerifier

func NewLogsVerifier(ctx context.Context, c clientset.Interface) *LogsSizeVerifier

NewLogsVerifier creates a new LogsSizeVerifier which will stop when stopChannel is closed

func (*LogsSizeVerifier) GetSummary

func (s *LogsSizeVerifier) GetSummary() *LogsSizeDataSummary

GetSummary returns a summary (average generation rate and number of probes) of the data gathered by LogSizeVerifier

func (*LogsSizeVerifier) Run

func (s *LogsSizeVerifier) Run(ctx context.Context)

Run starts log size gathering. It starts a gorouting for every worker and then blocks until stopChannel is closed

type NodesSet

type NodesSet int

NodesSet is a value of nodes set.

const (
	// AllNodes means all containers on all nodes.
	AllNodes NodesSet = 0
	// MasterNodes means all containers on Master nodes only.
	MasterNodes NodesSet = 1
	// MasterAndDNSNodes means all containers on Master nodes and DNS containers on other nodes.
	MasterAndDNSNodes NodesSet = 2
)

type ResourceConstraint

type ResourceConstraint struct {
	CPUConstraint    float64
	MemoryConstraint uint64
}

ResourceConstraint is a struct to hold constraints.

type ResourceGathererOptions

type ResourceGathererOptions struct {
	InKubemark                  bool
	Nodes                       NodesSet
	ResourceDataGatheringPeriod time.Duration
	ProbeDuration               time.Duration
	PrintVerboseLogs            bool
}

ResourceGathererOptions is a struct to hold options for resource.

type ResourceUsagePerContainer

type ResourceUsagePerContainer map[string]*ContainerResourceUsage

ResourceUsagePerContainer is map of ContainerResourceUsage

type ResourceUsageSummary

type ResourceUsageSummary map[string][]SingleContainerSummary

ResourceUsageSummary is a struct to hold resource usage summary. we can't have int here, as JSON does not accept integer keys.

func (*ResourceUsageSummary) PrintHumanReadable

func (s *ResourceUsageSummary) PrintHumanReadable() string

PrintHumanReadable prints resource usage summary in human readable.

func (*ResourceUsageSummary) PrintJSON

func (s *ResourceUsageSummary) PrintJSON() string

PrintJSON prints resource usage summary in JSON.

func (*ResourceUsageSummary) SummaryKind

func (s *ResourceUsageSummary) SummaryKind() string

SummaryKind returns string of ResourceUsageSummary

type SingleContainerSummary

type SingleContainerSummary struct {
	Name string
	CPU  float64
	Mem  uint64
}

SingleContainerSummary is a struct to hold single container summary.

type SingleLogSummary

type SingleLogSummary struct {
	AverageGenerationRate int
	NumberOfProbes        int
}

SingleLogSummary is a structure for handling average generation rate and number of probes.

type TimestampedSize

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

TimestampedSize contains a size together with a time of measurement.

type WorkItem

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

WorkItem is a command for a worker that contains an IP of machine from which we want to gather data and paths to all files we're interested in.

Directories

Path Synopsis
Package init sets debug.DumpAllNamespaceInfo as implementation in the framework and enables log size verification and resource gathering.
Package init sets debug.DumpAllNamespaceInfo as implementation in the framework and enables log size verification and resource gathering.

Jump to

Keyboard shortcuts

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