latency

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package latency provides a convenient abstraction around timing the startup and bootstrap of a Kubernetes node. latency provides an extensibility mechanism to register custom sources and events, but also ships with a set of default sources and events.

Index

Constants

View Source
const (
	ChartColumnEvent     = "Event"
	ChartColumnTimestamp = "Timestamp"
	ChartColumnT         = "T"
	ChartColumnComment   = "Comment"
)

Chart column label consts

Variables

This section is empty.

Functions

This section is empty.

Types

type ChartOptions added in v0.1.7

type ChartOptions struct {
	HiddenColumns []string
}

ChartOptions allows configuration of the markdown chart

type Measurement

type Measurement struct {
	Metadata *Metadata         `json:"metadata"`
	Timings  []*sources.Timing `json:"timings"`
}

Measurement is a specific timing produced from a Measurer run

func (*Measurement) Chart

func (m *Measurement) Chart(opts ChartOptions)

Chart generates a markdown chart view of a Measurement

func (*Measurement) EmitCloudWatchMetrics

func (m *Measurement) EmitCloudWatchMetrics(ctx context.Context, cw *cloudwatch.Client, experimentDimension string) error

EmitCloudWatchMetrics posts metric data to CloudWatch based on a Measurement

func (*Measurement) RegisterMetrics

func (m *Measurement) RegisterMetrics(register prometheus.Registerer, experimentDimension string)

RegisterMetrics registers prometheus metrics based on a measurement

type Measurer

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

Measurer holds registered sources and events to use for timing runs

func New

func New() *Measurer

New creates a new instance of a Measurer

func (*Measurer) GetSource

func (m *Measurer) GetSource(name string) (sources.Source, bool)

GetSource looks up a registered source by name

func (*Measurer) Measure

func (m *Measurer) Measure(ctx context.Context) *Measurement

Measure executes a single timing run with the registered sources and events

func (*Measurer) MeasureUntil

func (m *Measurer) MeasureUntil(ctx context.Context, timeout time.Duration, retryDelay time.Duration) (*Measurement, error)

MeasureUntil executes timing runs with the registered sources and events until all terminal events have timings or the timeout is reached

func (*Measurer) MustWithDefaultConfig

func (m *Measurer) MustWithDefaultConfig() *Measurer

MustWithDefaultConfig registers the default sources and events to the Measurer and panics if any errors occur

func (*Measurer) RegisterDefaultEvents

func (m *Measurer) RegisterDefaultEvents() (*Measurer, error)

RegisterDefaultEvents registers all default events shipped

func (*Measurer) RegisterDefaultSources

func (m *Measurer) RegisterDefaultSources() *Measurer

RegisterDefaultSources registers the default sources to the Measurer

func (*Measurer) RegisterEvents

func (m *Measurer) RegisterEvents(events ...*sources.Event) (*Measurer, error)

RegisterEvents registers n events to the Measurer. The sources for the events must already be registered.

func (*Measurer) RegisterSources

func (m *Measurer) RegisterSources(srcs ...sources.Source) *Measurer

RegisterSources registers n sources to the Measurer

func (*Measurer) WithEC2Client added in v0.1.7

func (m *Measurer) WithEC2Client(ec2Client *ec2.Client) *Measurer

WithEC2Client is a builder func that adds an ec2 client to a Measurer

func (*Measurer) WithIMDS

func (m *Measurer) WithIMDS(imdsClient *imds.Client) *Measurer

WithIMDS is a builder func that adds an EC2 Instance Metadata Service (IMDS) client to a Measurer

func (*Measurer) WithK8sClientset added in v0.1.7

func (m *Measurer) WithK8sClientset(clientset *kubernetes.Clientset) *Measurer

WithK8sClientset is a builder func that adds a k8s clientset to a Measurer

func (*Measurer) WithNodeName added in v0.1.7

func (m *Measurer) WithNodeName(nodeName string) *Measurer

WithNodeName sets the node name that will be used to query for the first scheduled pod on the given node name

func (*Measurer) WithPodNamespace added in v0.1.7

func (m *Measurer) WithPodNamespace(podNamespace string) *Measurer

WithPodNamespace sets the pod namespace that will be queried to measure pod creation to running time

type Metadata

type Metadata struct {
	Region           string `json:"region"`
	InstanceType     string `json:"instanceType"`
	InstanceID       string `json:"instanceID"`
	AccountID        string `json:"accountID"`
	Architecture     string `json:"architecture"`
	AvailabilityZone string `json:"availabilityZone"`
	PrivateIP        string `json:"privateIP"`
	AMIID            string `json:"amiID"`
}

Metadata provides data about the node where measurements are executed

Jump to

Keyboard shortcuts

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