-
[OPIK-6640] [BE][FE] fix: return KPI error rate as percentage (was raw count) (#6866)
发布于
2026-05-29 13:03:44 +00:00 - [OPIK-6640] [BE][FE] fix: return KPI error rate as percentage (was raw count)
The errors KPI card was rendering nonsensical values like "312.0%" because
the backend SQL returned a raw count of errored entities while the frontend
labelled the card "Error rate" and appended "%". Replace the count expression
with the same division-guarded rate formula used by ProjectMetricsDAO so the
value is a percentage in [0, 100], document the new semantics on the
KpiMetricType.ERRORS enum and the OpenAPI example, tighten the frontend
formatter for sub-1% precision, and hide the relative-change delta on a card
whose value is itself a percentage.Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com
- [OPIK-6640] [BE][FE] address review: doc unit, pp-delta, rename SQL aliases
- Add @Schema descriptions on KpiMetric.current_value/previous_value so the
generated OpenAPI spec carries the unit (errors is a percentage in [0,100]). - Rename SQL column aliases current_errors/previous_errors to
current_error_rate/previous_error_rate (internal-only; the JSON wire field
is current_value, unchanged). Documents the semantic shift at the data layer. - Replace hideDelta with a pp-delta renderer: MetricCard now supports a
deltaUnit prop ("%" or "pp"). The errors card uses "pp" so a 5% -> 6% change
shows as "+1pp" instead of being suppressed. computeDelta treats partial-null
as undefined for pp mode to avoid implying improvement on absent data. - Strip trailing zeros from formatter output (100% instead of "100.0%",
0% instead of "0.00%") via parseFloat(toFixed(...)). - Bump OpenAPI example values from 2.5/2.4 (too close) to 3.5/1.2.
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com
Co-authored-by: Claude Opus 4.7 noreply@anthropic.com
下载附件