Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // SKUMixPlacementRequestMetric tracks completed SKU Mix Placement API requests. // // STABILITY: ALPHA - This metric may change or be removed without notice. SKUMixPlacementRequestMetric = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: metrics.Namespace, Subsystem: capacityRecommendationSubsystem, Name: "requests_total", Help: "Total number of SKU Mix Placement API requests completed.", }, []string{metrics.CapacityTypeLabel, metrics.AllocationStrategyLabel, metrics.OSTypeLabel, metrics.PlacementScopeLabel, metrics.ResultLabel}, ) // SKUMixPlacementCacheRequestMetric tracks SKU Mix Placement recommendation cache requests. // // STABILITY: ALPHA - This metric may change or be removed without notice. SKUMixPlacementCacheRequestMetric = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: metrics.Namespace, Subsystem: capacityRecommendationSubsystem, Name: "cache_requests_total", Help: "Total number of SKU Mix Placement recommendation cache requests.", }, []string{metrics.CapacityTypeLabel, metrics.AllocationStrategyLabel, metrics.OSTypeLabel, metrics.PlacementScopeLabel, metrics.ResultLabel}, ) // SKUMixPlacementRequestDurationMetric tracks SKU Mix Placement API request latency. // // STABILITY: ALPHA - This metric may change or be removed without notice. SKUMixPlacementRequestDurationMetric = prometheus.NewHistogramVec( prometheus.HistogramOpts{ Namespace: metrics.Namespace, Subsystem: capacityRecommendationSubsystem, Name: "request_duration_seconds", Help: "Duration in seconds of SKU Mix Placement API requests.", Buckets: []float64{0.01, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 15, 20}, }, []string{metrics.CapacityTypeLabel, metrics.AllocationStrategyLabel, metrics.OSTypeLabel, metrics.PlacementScopeLabel, metrics.ResultLabel}, ) )
Functions ¶
This section is empty.
Types ¶
type DefaultProvider ¶
type DefaultProvider struct {
// contains filtered or unexported fields
}
DefaultProvider obtains and reactively caches SKU Mix Placement recommendations.
func NewProvider ¶
func NewProvider(client SKUMixPlacementScoresAPI, cache *cache.Cache, location string) *DefaultProvider
NewProvider creates a capacity recommendation provider using the supplied per-response expiry cache.
func (*DefaultProvider) GetRecommendations ¶
func (p *DefaultProvider) GetRecommendations(ctx context.Context, input *RankingInput) (RecommendationDetails, error)
GetRecommendations returns cached or freshly generated recommendations.
type Provider ¶
type Provider interface {
GetRecommendations(ctx context.Context, input *RankingInput) (RecommendationDetails, error)
}
Provider supplies capacity-aware VM placement recommendations.
type RankingInput ¶
type RankingInput struct {
VMSizes []string
Zones []string
CapacityType string
OSType corev1.OSName
Count int32
}
RankingInput identifies an allocation request to rank.
type Recommendation ¶
type Recommendation struct {
VMSize string
Zone string
CapacityType string
// Score of the recommendation. Higher is better.
Score int32
// ID is the ID of the recommendation. This can/should be passed along to CRP.
ID string
// Count is not currently used
Count int32
}
Recommendation is one VM allocation from an ordered placement choice.
type RecommendationDetails ¶
type RecommendationDetails struct {
Recommendations []Recommendation
CapacityLimits []*armrecommender.SKUMixPlacementCapacityLimit
}
RecommendationDetails contains placement recommendations and the capacity limits used to produce them.
type SKUMixPlacementScoresAPI ¶
type SKUMixPlacementScoresAPI interface {
Post(
ctx context.Context,
location string,
skuMixPlacementRequest armrecommender.SKUMixPlacementRequest,
options *armrecommender.SKUMixPlacementScoresClientPostOptions,
) (armrecommender.SKUMixPlacementScoresClientPostResponse, error)
}
Click to show internal directories.
Click to hide internal directories.