-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug/rds calculation is missing additional costs #143
Bug/rds calculation is missing additional costs #143
Conversation
collector/aws/resources/rds.go
Outdated
"region": r.awsManager.GetRegion(), | ||
}).Info("RDS instance detected as unutilized resource") | ||
|
||
instancePricingFilters := r.getPricingInstanceFilterInput(instance) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The price calculation really needs to be in the metrics loop?
the price can be changed when we have a different metric?
collector/aws/resources/rds.go
Outdated
} | ||
|
||
var hourlyStoragePrice float64 | ||
if rdsStorageType, found := rdsStorageType[*instance.StorageType]; found { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you say to move this logic into a function?
it will help us for better tests coverage + make Detect
function to be more readable
}, | ||
}, | ||
} | ||
} | ||
func (r *RDSManager) getPricingAuroraStorageFilterInput(rdsStorageType string, pricingRegionPrefix string) pricing.GetProductsInput { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a description on this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm not seeing testing on this function.
can you please add one?
return databaseEngine | ||
} | ||
|
||
func (r *RDSManager) getPricingDeploymentOption(instance *rds.DBInstance) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a description on this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm not seeing testing on this function.
can you please add one?
collector/aws/resources/rds.go
Outdated
log.WithField("storage_filters", storagePricingFilters).Debug("pricing storage filters") | ||
storagePrice, err := r.awsManager.GetPricingClient().GetPrice(storagePricingFilters, "", r.awsManager.GetRegion()) | ||
if err != nil { | ||
log.WithError(err).Error("Could not get rds storage price") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you say to add the filter object into the log to improve the troubleshoot
What type of PR is this?
/Bug
What this PR does / why we need it:
Fix a bug in RDS calculation
Fixes: #68