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
- type ChartOptions
- type Measurement
- type Measurer
- func (m *Measurer) GetSource(name string) (sources.Source, bool)
- func (m *Measurer) Measure(ctx context.Context) *Measurement
- func (m *Measurer) MeasureUntil(ctx context.Context, timeout time.Duration, retryDelay time.Duration) (*Measurement, error)
- func (m *Measurer) MustWithDefaultConfig() *Measurer
- func (m *Measurer) RegisterDefaultEvents() (*Measurer, error)
- func (m *Measurer) RegisterDefaultSources() *Measurer
- func (m *Measurer) RegisterEvents(events ...*sources.Event) (*Measurer, error)
- func (m *Measurer) RegisterSources(srcs ...sources.Source) *Measurer
- func (m *Measurer) WithEC2Client(ec2Client *ec2.Client) *Measurer
- func (m *Measurer) WithIMDS(imdsClient *imds.Client) *Measurer
- func (m *Measurer) WithK8sClientset(clientset *kubernetes.Clientset) *Measurer
- func (m *Measurer) WithNodeName(nodeName string) *Measurer
- func (m *Measurer) WithPodNamespace(podNamespace string) *Measurer
- type Metadata
Constants ¶
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 (*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 ¶
MustWithDefaultConfig registers the default sources and events to the Measurer and panics if any errors occur
func (*Measurer) RegisterDefaultEvents ¶
RegisterDefaultEvents registers all default events shipped
func (*Measurer) RegisterDefaultSources ¶
RegisterDefaultSources registers the default sources to the Measurer
func (*Measurer) RegisterEvents ¶
RegisterEvents registers n events to the Measurer. The sources for the events must already be registered.
func (*Measurer) RegisterSources ¶
RegisterSources registers n sources to the Measurer
func (*Measurer) WithEC2Client ¶ added in v0.1.7
WithEC2Client is a builder func that adds an ec2 client to a Measurer
func (*Measurer) WithIMDS ¶
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
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
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