Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/costmodel/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ func NewClients(prodConfig, devConfig *ClientConfig) (*Clients, error) {
// GetCostPerCPU returns the average cost per CPU for a given cluster.
func (c *Client) GetCostPerCPU(ctx context.Context, cluster string) (Cost, error) {
query := fmt.Sprintf(queryCostPerCPU, cluster)
// TODO: Remove this once we've removed support for OpenCost
if c.useCloudCostExporterMetrics {
query = fmt.Sprintf(cloudcostExporterQueryCostPerCpu, cluster, cluster, cluster)
}
results, err := c.query(ctx, query)
if err != nil {
return Cost{}, err
Expand All @@ -176,6 +180,7 @@ func (c *Client) GetCostPerCPU(ctx context.Context, cluster string) (Cost, error
// GetMemoryCost returns the cost per memory for a given cluster
func (c *Client) GetMemoryCost(ctx context.Context, cluster string) (Cost, error) {
query := fmt.Sprintf(queryMemoryCost, cluster)
// TODO: Remove this once we've removed support for OpenCost
if c.useCloudCostExporterMetrics {
query = fmt.Sprintf(cloudcostExporterQueryMemoryCost, cluster, cluster, cluster)
}
Expand Down
Loading