Переглянути джерело

update log when unable to find pricing key for node (#3396)

Signed-off-by: nickcurie <ncurie@kubecost.com>
Nick Curie 7 місяців тому
батько
коміт
78a8f1cffd
2 змінених файлів з 4 додано та 2 видалено
  1. 2 1
      pkg/cloud/aws/provider.go
  2. 2 1
      pkg/costmodel/costmodel.go

+ 2 - 1
pkg/cloud/aws/provider.go

@@ -1445,8 +1445,9 @@ func (aws *AWS) NodePricing(k models.Key) (*models.Node, models.PricingMetadata,
 		}
 		return aws.createNode(terms, usageType, k)
 	} else { // Fall back to base pricing if we can't find the key. Base pricing is handled at the costmodel level.
+		// we seem to have an issue where this error gets thrown during app start.
+		// somehow the ValidPricingKeys map is being accessed before all the pricing data has been downloaded
 		return nil, meta, fmt.Errorf("Invalid Pricing Key \"%s\"", key)
-
 	}
 }
 

+ 2 - 1
pkg/costmodel/costmodel.go

@@ -886,7 +886,8 @@ func (cm *CostModel) GetNodeCost() (map[string]*costAnalyzerCloud.Node, error) {
 
 		cnode, _, err := cp.NodePricing(cp.GetKey(nodeLabels, n))
 		if err != nil {
-			log.Infof("Error getting node pricing. Error: %s", err.Error())
+			log.Infof("Could not get node pricing for node %s. Falling back to default pricing", name)
+			log.Debugf("Error getting node pricing: %s", err.Error())
 			if cnode != nil {
 				nodes[name] = cnode
 				continue