Skip to content

Commit

Permalink
chore: adjust on-demand pricing to account for a 28% compute savings …
Browse files Browse the repository at this point in the history
…plan discount
  • Loading branch information
craiglink committed Apr 11, 2024
1 parent b37761a commit 0f46f68
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/providers/pricing/pricing.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,15 @@ func (p *Provider) UpdateOnDemandPricing(ctx context.Context) error {
return fmt.Errorf("no on-demand pricing found")
}

// account for 28% compute savings plan for on-demand instances
p.onDemandPrices = lo.Assign(onDemandPrices, onDemandMetalPrices)
for instanceType, price := range p.onDemandPrices {
InstancePriceEstimate.With(prometheus.Labels{
InstanceTypeLabel: instanceType,
CapacityTypeLabel: ec2.UsageClassTypeOnDemand,
RegionLabel: p.region,
TopologyLabel: "",
}).Set(price)
}).Set(price* 0.72)
}
if p.cm.HasChanged("on-demand-prices", p.onDemandPrices) {
logging.FromContext(ctx).With("instance-type-count", len(p.onDemandPrices)).Debugf("updated on-demand pricing")
Expand Down

0 comments on commit 0f46f68

Please sign in to comment.