metrics

package
v0.69.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollocationTypeTag added in v0.56.0

func CollocationTypeTag(ctx context.Context, collocationType string) metrics.Tag

CollocationTypeTag returns a collocation type tag

func HostTag

func HostTag(ctx context.Context, host string) metrics.Tag

HostTag returns a host tag

func IncrementSingleAzDynamicAllocationPackFailure added in v0.47.0

func IncrementSingleAzDynamicAllocationPackFailure(ctx context.Context, zone string)

IncrementSingleAzDynamicAllocationPackFailure increments a counter for a zone we fail to schedule in, this allows us to keep track of exactly which zones are over utilised

func InstanceGroupTag

func InstanceGroupTag(ctx context.Context, instanceGroup string) metrics.Tag

InstanceGroupTag returns an instance group tag

func OutcomeTag

func OutcomeTag(ctx context.Context, outcome string) metrics.Tag

OutcomeTag returns an outcome tag

func PathTag

func PathTag(ctx context.Context, url url.URL) metrics.Tag

PathTag returns a url tag

func QueueIndexTag

func QueueIndexTag(ctx context.Context, index int) metrics.Tag

QueueIndexTag returns a queue index tag

func RegisterInformerDelayMetrics

func RegisterInformerDelayMetrics(ctx context.Context, informer coreinformers.PodInformer)

RegisterInformerDelayMetrics registers an event handler to the pod informer to report delays

func ReportCrossZoneMetric

func ReportCrossZoneMetric(ctx context.Context, instanceGroup string, driverNodeName string, executorNodeNames []string, nodes []*v1.Node)

ReportCrossZoneMetric reports metric about cross AZ traffic between pods of a spark application

func ReportInitialDriverExecutorCollocationMetric added in v0.56.0

func ReportInitialDriverExecutorCollocationMetric(ctx context.Context, instanceGroup string, driverNodeName string, executorNodeNames []string)

ReportInitialDriverExecutorCollocationMetric reports a metric about whether the driver is collocated with executors. This metric is only reported during the initial scheduling of the Spark application.

func ReportInitialNodeCountMetrics added in v0.57.0

func ReportInitialNodeCountMetrics(ctx context.Context, instanceGroup string, executorNodeNames []string)

ReportInitialNodeCountMetrics reports two metrics used to reason about how fragmented a Spark app is.

The first metric measures how many executors are hosted per node for a given spark application. This ignores executor-less applications.

For instance for an application with 6 executors being scheduled on a single node the metric would be 6, if this application was instead scheduled on 2 nodes, then the metric would be 3.

The second metric simply tracks how many unique nodes are being used to schedule all the executors.

Those metrics are only reported during the initial scheduling of the Spark application.

func ReportPackingEfficiency added in v0.47.0

func ReportPackingEfficiency(
	ctx context.Context,
	instanceGroupName string,
	packingFunctionName string,
	efficiency binpack.AvgPackingEfficiency)

ReportPackingEfficiency report packing efficiency metrics for a single packing result.

func ReportTimeToFirstBindMetrics added in v0.59.0

func ReportTimeToFirstBindMetrics(ctx context.Context, duration time.Duration)

ReportTimeToFirstBindMetrics reports how long it takes between a reservation being created and pods being bound to said reservation.

func SparkRoleTag

func SparkRoleTag(ctx context.Context, role string) metrics.Tag

SparkRoleTag returns a spark role tag

func StatusCodeTag

func StatusCodeTag(ctx context.Context, statusCode string) metrics.Tag

StatusCodeTag returns a status code tag

func VerbTag

func VerbTag(ctx context.Context, verb string) metrics.Tag

VerbTag returns a request verb tag

func ZoneTag added in v0.47.0

func ZoneTag(ctx context.Context, zone string) metrics.Tag

ZoneTag returns a zone tag

Types

type CacheMetrics

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

CacheMetrics reports metrics for resource reservation and demand caches

func NewCacheMetrics

func NewCacheMetrics(
	resourceReservationLister sparkschedulerlisters.ResourceReservationLister,
	resourceReservations *cache.ResourceReservationCache,
	demands *cache.SafeDemandCache,
) *CacheMetrics

NewCacheMetrics creates a new CacheMetrics object

func (*CacheMetrics) StartReporting

func (c *CacheMetrics) StartReporting(ctx context.Context)

StartReporting starts periodic reporting for cache metrics

type PendingPodQueueReporter

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

PendingPodQueueReporter reports queue sizes periodically

func NewQueueReporter

func NewQueueReporter(podLister corelisters.PodLister, instanceGroupTagLabel string) *PendingPodQueueReporter

NewQueueReporter returns a new ResourceUsageReporter instance

func (*PendingPodQueueReporter) StartReportingQueues

func (r *PendingPodQueueReporter) StartReportingQueues(ctx context.Context)

StartReportingQueues starts periodic resource usage reporting

type PodHistograms

type PodHistograms map[PodTags]histogramWithCount

PodHistograms keep the count and duration of lifecycle states of a spark pod

func (PodHistograms) Inc

func (p PodHistograms) Inc(key PodTags)

Inc increases the counter of the given key by one

func (PodHistograms) Mark

func (p PodHistograms) Mark(key PodTags, duration time.Duration)

Mark marks the histogram for the key with the nanoseconds of given duration

func (PodHistograms) MarkTimes

func (p PodHistograms) MarkTimes(ctx context.Context, pod *v1.Pod, instanceGroupTagLabel string, now time.Time)

MarkTimes inspects pod conditions and marks lifecycle transition times

type PodTags

type PodTags struct {
	InstanceGroup, SparkRole, Lifecycle metrics.Tag
}

PodTags represent a tag set for a lifecycle event for a spark pod

type ResourceReservationMetrics added in v0.58.0

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

ResourceReservationMetrics reports metrics on the ResourceReservationManager passed

func NewResourceReservationMetrics added in v0.58.0

func NewResourceReservationMetrics(resourceReservationCache *cache.ResourceReservationCache) *ResourceReservationMetrics

NewResourceReservationMetrics creates a ResourceReservationMetrics

func (*ResourceReservationMetrics) StartReporting added in v0.58.0

func (s *ResourceReservationMetrics) StartReporting(ctx context.Context)

StartReporting starts periodic reporting for ResourceReservationManager metrics

type ResourceUsageReporter

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

ResourceUsageReporter reports resource usage periodically

func NewResourceReporter

func NewResourceReporter(
	nodeLister corelisters.NodeLister,
	resourceReservations *cache.ResourceReservationCache,
	instanceGroupTagLabel string) *ResourceUsageReporter

NewResourceReporter returns a new ResourceUsageReporter instance

func (*ResourceUsageReporter) StartReportingResourceUsage

func (r *ResourceUsageReporter) StartReportingResourceUsage(ctx context.Context)

StartReportingResourceUsage starts periodic resource usage reporting

type ScheduleTimer

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

ScheduleTimer marks pod scheduling time metrics

func NewScheduleTimer

func NewScheduleTimer(ctx context.Context, instanceGroup string, pod *v1.Pod) *ScheduleTimer

NewScheduleTimer creates a new ScheduleTimer

func (*ScheduleTimer) Mark

func (s *ScheduleTimer) Mark(ctx context.Context, role, outcome string)

Mark marks scheduling timer metrics with durations from current time

func (*ScheduleTimer) MarkReconciliationFinished

func (s *ScheduleTimer) MarkReconciliationFinished(ctx context.Context)

MarkReconciliationFinished marks when the reconciliation finished successfully

type SoftReservationCompactionTimer

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

SoftReservationCompactionTimer tracks and reports the time it takes to compact soft reservations to resource reservations

func GetAndStartSoftReservationCompactionTimer

func GetAndStartSoftReservationCompactionTimer() *SoftReservationCompactionTimer

GetAndStartSoftReservationCompactionTimer returns a SoftReservationCompactionTimer which starts counting the time immediately

func (*SoftReservationCompactionTimer) MarkCompactionComplete

func (dct *SoftReservationCompactionTimer) MarkCompactionComplete(ctx context.Context)

MarkCompactionComplete emits a metric with the time difference between now and when the timer was started by GetAndStartSoftReservationCompactionTimer()

type SoftReservationMetrics

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

SoftReservationMetrics reports metrics on the SoftReservationStore passed

func NewSoftReservationMetrics

func NewSoftReservationMetrics(ctx context.Context, store *cache.SoftReservationStore, podLister corelisters.PodLister, resourceReservations *cache.ResourceReservationCache) *SoftReservationMetrics

NewSoftReservationMetrics creates a SoftReservationMetrics

func (*SoftReservationMetrics) StartReporting

func (s *SoftReservationMetrics) StartReporting(ctx context.Context)

StartReporting starts periodic reporting for SoftReservationStore metrics

type SparkPodConditions

type SparkPodConditions map[v1.PodConditionType]v1.PodCondition

SparkPodConditions provides spark related lifecycle events from pod conditions

func NewSparkPodConditions

func NewSparkPodConditions(conditions []v1.PodCondition) SparkPodConditions

NewSparkPodConditions creates a new SparkPodConditions instance

func (SparkPodConditions) TimeWhenTrue

func (s SparkPodConditions) TimeWhenTrue(conditionType v1.PodConditionType) (time.Time, bool)

TimeWhenTrue returns the last transition time if the given conditions status is true

type WasteMetricsReporter

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

WasteMetricsReporter tracks and reports on scheduler latencies between demand creation and pod scheduling times in granular phases so we can keep track of any delays. This is a best-effort reporter in that it keeps track of state in memory.

func NewWasteMetricsReporter

func NewWasteMetricsReporter(ctx context.Context, instanceGroupLabel string) *WasteMetricsReporter

NewWasteMetricsReporter returns an instance of WasteMetricsReporter

func (*WasteMetricsReporter) MarkFailedSchedulingAttempt

func (r *WasteMetricsReporter) MarkFailedSchedulingAttempt(pod *v1.Pod, outcome string)

MarkFailedSchedulingAttempt should be called to indicate that scheduling for the passed pod failed with that outcome.

func (*WasteMetricsReporter) StartSchedulingOverheadMetrics

func (r *WasteMetricsReporter) StartSchedulingOverheadMetrics(
	podInformer coreinformers.PodInformer,
	demandInformer *crd.LazyDemandInformer,
)

StartSchedulingOverheadMetrics will start tracking demand creation and fulfillment times and report scheduling wasted time per pod

Jump to

Keyboard shortcuts

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