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

feat: add a field with the formula used to decide to activate stress relief #805

Merged
merged 2 commits into from
Jul 22, 2023

Conversation

RainofTerra
Copy link
Contributor

Which problem is this PR solving?

  • Currently we don't emit the values we used to determine if stress relief should be activated unless you enable debug logging, but I think the numbers at the time of activation are valuable enough to be present at WARN

Short description of the changes

  • adds a stress_formula field to the activation message, and adds formula to the StressRelief struct

@RainofTerra RainofTerra requested a review from a team as a code owner July 21, 2023 18:33
Copy link
Contributor

@kentquirk kentquirk left a comment

Choose a reason for hiding this comment

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

I think this is a good idea in general; one nit. Thanks.

for _, c := range s.calcs {
stress := 100 * s.algorithms[c.Algorithm](c.Numerator, c.Denominator)
if stress > level {
level = stress
reason = c.Reason
formula = fmt.Sprintf("%s(%v/%v)=%v", c.Algorithm, c.Numerator, c.Denominator, stress)
}
}
s.Logger.Debug().WithField("stress_level", level).WithField("reason", reason).Logf("calculated stress level")
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should add formula to this log message too, so you can see it with debug on, even if you're not actually in Monitor mode.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call! will push that in a moment

@RainofTerra RainofTerra merged commit 66302be into main Jul 22, 2023
@RainofTerra RainofTerra deleted the terra.add_formula_to_stress_activation branch July 22, 2023 01:00
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.

2 participants