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

fix: use the correct formatter for the description #5388

Merged
merged 2 commits into from
Jul 1, 2024

Conversation

srikanthccv
Copy link
Member

@srikanthccv srikanthccv commented Jul 1, 2024

Summary

Here is how the conversion happens in alerts.

  1. The y-axis unit is the unit of the underlying data. For example, for durationNano, ns is the unit.
  2. The user selects the y-axis unit for an alert
  3. At the alert condition step, they have a convenient way to define the threshold/target instead of writing it in the same unit as the underlying data. For example, they can say above 1000 ms rather than above 1000000000

How do we do the comparison?

  1. We send the query without any unit knowledge to ClickHouse.
  2. The results are fetched and compared against the threshold/target
  3. When comparing, we take the threshold/target value and convert it to the same unit as the underlying data here
    func (r *ThresholdRule) targetVal() float64 {
    if r.ruleCondition == nil || r.ruleCondition.Target == nil {
    return 0
    }
    unitConverter := converter.FromUnit(converter.Unit(r.ruleCondition.TargetUnit))
    value := unitConverter.Convert(converter.Value{F: *r.ruleCondition.Target, U: converter.Unit(r.ruleCondition.TargetUnit)}, converter.Unit(r.Unit()))
    return value.F
    }

Now that the targetVal is already converted to same unit as data, we need to use the same formatter.

Copy link

github-actions bot commented Jul 1, 2024

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@github-actions github-actions bot added the bug Something isn't working label Jul 1, 2024
Copy link

github-actions bot commented Jul 1, 2024

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@srikanthccv srikanthccv marked this pull request as ready for review July 1, 2024 10:34
@nityanandagohain nityanandagohain merged commit 326dec2 into develop Jul 1, 2024
12 of 13 checks passed
@nityanandagohain nityanandagohain deleted the fix-formatter branch July 1, 2024 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants