The GitHub Actions job "CI" on 
rocketmq-dashboard.git/fix/alert-template-number-format has failed.
Run started by GitHub user unbridled-41 (triggered by unbridled-41).

Head commit for run:
75bac1a9159f8c2930d7d181473c074779108452 / unbridled-41 
<[email protected]>
fix(alert): stop the notification template from rendering values in scientific 
notation

AlertNotificationTemplate rendered ${value} (every metric except the percent
branch) and ${threshold} with String.valueOf(double). Double.toString switches
to computerized scientific notation at 1e7, so a consumer-lag alert whose
currentValue is 12,500,000 - the metric this alert family exists for - was
delivered to DingTalk/SMS/email as

  [warning] Consumer lag high - ...
  ... 1.25E7 ...

The operator cannot see this coming from the rule dialog: the live preview of
the same template (web/src/utils/alertTemplatePreview.ts, String(context.value))
prints 12500000 for the same number, and the threshold unit suffix is appended
verbatim, so the delivered text reads "1.25E7messages".

The same file already fixed exactly this divergence for the percent branch with
BigDecimal (see its comment: "plain double arithmetic renders the stored 0.29 as
28.999999999999996"); the plain branch was left on Double.toString.

Render both placeholders through that BigDecimal form, so only values with no
finite decimal form keep String.valueOf. The existing rendering of ordinary
values is unchanged (86.0 stays "86.0", 0.865% stays "86.5%").

Tests (server/):
mvn -o -B -ntp test -Dtest='org.apache.rocketmq.studio.ops.alert.**'
- new 
AlertNotificationTemplateTest#rendersLargeValuesAndThresholdsWithoutScientificNotationTest
  and #rendersNonFiniteValuesWithoutAPlainDecimalFormTest fail before this 
change
  ("12500000/12000000messages" expected, "1.25E7/1.2E7messages" observed) and 
pass after it.
- 328 tests in the alert package pass (including the two that pin "86.5%/85.0"
  and "Disk warning: 86.0 on local", which this change leaves untouched);
  mvn -o -B -ntp checkstyle:check passes.

Report URL: 
https://github.com/apache/rocketmq-dashboard/actions/runs/37959977654

With regards,
GitHub Actions via GitBox

Reply via email to