Skip to content
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

Move logs about incompatible instance types to debug #415

Merged
merged 1 commit into from
Feb 4, 2020

Conversation

gabegorelick
Copy link
Contributor

Previously, the amount of logs generated when replacing a large
number of on-demand instances could be overwhelming since info about
each candidate instance type was logged. Now, we still log when an
instance type matches, but now all the logs about every instance type
that does not match will be at debug level.

This change was begun in https://github.com/AutoSpotting/AutoSpotting/pull/354/files#diff-fa23d3c4fb090da3bc9f71371d6e1d95R446.

Issue Type

  • Feature Pull Request

Summary

Reduce amount of logs generated when attempting to find compatible instance types.

Code contribution checklist

  1. I hereby allow the Copyright holder the rights to distribute this piece of
    code under any software license.
  2. The contribution fixes a single existing github issue, and it is linked
    to it.
  3. The code is as simple as possible, readable and follows the idiomatic Go
    guidelines.
  4. All new functionality is covered by automated test cases so the overall
    test coverage doesn't decrease.
  5. No issues are reported when running make full-test.
  6. Functionality not applicable to all users should be configurable.
  7. Configurations should be exposed through Lambda function environment
    variables which are also passed as parameters to the
    CloudFormation
    and
    Terraform
    stacks defined as infrastructure code.
  8. Global configurations set from the infrastructure stack level should also
    support per-group overrides using tags.
  9. Tags names and expected values should be similar to the other existing
    configurations.
  10. Both global and tag-based configuration mechanisms should be tested and
    proven to work using log output from various test runs.
  11. The logs should be kept as clean as possible (use log levels as
    appropriate) and formatted consistently to the existing log output.
  12. The documentation is updated to cover the new behavior, as well as the
    new configuration options for both stack parameters and tag overrides.
  13. A code reviewer reproduced the problem and can confirm the code
    contribution actually resolves it.

Previously, the amount of logs generated when replacing a large
number of on-demand instances could be overwhelming since info about
each candidate instance type was logged. Now, we still log when an
instance type matches, but now all the logs about every instance type
that does not match will be at debug level.

This change was begun in https://github.com/AutoSpotting/AutoSpotting/pull/354/files#diff-fa23d3c4fb090da3bc9f71371d6e1d95R446.
@codeclimate
Copy link

codeclimate bot commented Feb 4, 2020

Code Climate has analyzed commit 015a284 and detected 0 issues on this pull request.

View more on Code Climate.

@@ -243,7 +243,7 @@ func (a *autoScalingGroup) loadConfSpot() bool {
}
if newValue, done := a.loadBiddingPolicy(tagValue); done {
a.region.conf.BiddingPolicy = newValue
logger.Println("BiddingPolicy =", a.region.conf.BiddingPolicy)
debug.Println("BiddingPolicy =", a.region.conf.BiddingPolicy)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this adds anything since the default bidding policy was already logged on startup.

@@ -460,16 +460,16 @@ func (i *instance) launchSpotReplacement() error {
func (i *instance) getPricetoBid(
baseOnDemandPrice float64, currentSpotPrice float64) float64 {

logger.Println("BiddingPolicy: ", i.region.conf.BiddingPolicy)
debug.Println("BiddingPolicy: ", i.region.conf.BiddingPolicy)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 2 logs statements below are enough to infer the bidding policy.

@@ -391,7 +391,7 @@ func (i *instance) getCompatibleSpotInstanceTypesListSortedAscendingByPrice(allo
i.isStorageCompatible(candidate, attachedVolumesNumber) &&
i.isVirtualizationCompatible(candidate.virtualizationTypes) {
acceptableInstanceTypes = append(acceptableInstanceTypes, acceptableInstance{candidate, candidatePrice})
logger.Println("\tMATCH FOUND, added", candidate.instanceType, "to launch candiates list")
logger.Println("\tMATCH FOUND, added", candidate.instanceType, "to launch candiates list for instance", i.InstanceId)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding instanceID to some of these logs to help provide context.

@gabegorelick gabegorelick marked this pull request as ready for review February 4, 2020 17:05
@cristim cristim merged commit 985d675 into LeanerCloud:master Feb 4, 2020
@gabegorelick gabegorelick deleted the comparison-logs branch February 4, 2020 19:53
@gabegorelick
Copy link
Contributor Author

Thanks for merging this so quickly @cristim.

@cristim
Copy link
Member

cristim commented Feb 5, 2020

Thanks for your contribution!

I'm doing my best to keep up with you and get these things merged and delivered to the users timely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants