This is an automated email from the ASF dual-hosted git repository.
lizhimins pushed a commit to branch rocketmq-studio
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git
The following commit(s) were added to refs/heads/rocketmq-studio by this push:
new a42ed0ae9 fix(message): badge a critical trace by what is actually
critical (#4900)
a42ed0ae9 is described below
commit a42ed0ae9567273e70b58d378e8d26d5f5b3aa88
Author: 烤化の初雪 <[email protected]>
AuthorDate: Thu Sep 24 18:20:49 2026 +0800
fix(message): badge a critical trace by what is actually critical (#4900)
fix(message): badge a critical trace by what is actually critical
A critical trace diagnostics status is not always a delivery failure: a
phase
over the critical node cost or an end-to-end span over criticalEndToEndMs is
critical too, and STATUS_KEY mapped every critical status to
messagePage.traceStatusDeliveryCritical ("投递异常 / Delivery Critical").
A trace whose only delivery succeeded and whose phases all finished was
therefore badged as a delivery failure while the issue tags next to it
described latency, and the generic messagePage.traceStatusCritical key that
message.tsx already defines went unused.
Pick the label from the critical findings: keep the delivery wording for a
failed trace node or a failed consumer delivery, and use the generic key
for a
latency-only critical.
Regression test: a 31s end-to-end trace with every phase below the critical
node cost and a successful delivery now expects traceStatusCritical, failing
before the change.
---
web/src/utils/messageTraceDiagnostics.test.ts | 25 ++++++++++++++++++++++++
web/src/utils/messageTraceDiagnostics.ts | 28 +++++++++++++++++++++++++--
2 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/web/src/utils/messageTraceDiagnostics.test.ts
b/web/src/utils/messageTraceDiagnostics.test.ts
index a9cde97e3..eabfbd1d9 100644
--- a/web/src/utils/messageTraceDiagnostics.test.ts
+++ b/web/src/utils/messageTraceDiagnostics.test.ts
@@ -150,6 +150,31 @@ describe('message trace diagnostics', () => {
]);
});
+ it('does not claim a delivery failure when only the latency is critical', ()
=> {
+ const diagnostics = analyzeMessageTrace(
+ baseTrace({
+ nodes: [
+ node('Producer 发送', '2026-07-01T10:00:00.000Z', 4),
+ node('Broker 存储', '2026-07-01T10:00:00.040Z', 8),
+ // 31s end to end, while every phase stays far below the 5s critical
node cost,
+ // and the only delivery of the trace succeeded.
+ node('Consumer 消费', '2026-07-01T10:00:31.000Z', 70),
+ ],
+ consumerStatus: [delivery('cg-orders')],
+ }),
+ );
+
+ expect(diagnostics.status).toBe('critical');
+ expect(diagnostics.issues).toEqual(
+ expect.arrayContaining([
+ expect.objectContaining({ code: 'SLOW_END_TO_END_TRACE', severity:
'critical' }),
+ ]),
+ );
+ expect(diagnostics.issues.map((issue) =>
issue.code)).not.toContain('FAILED_TRACE_NODE');
+ expect(diagnostics.issues.map((issue) =>
issue.code)).not.toContain('FAILED_CONSUMER_DELIVERY');
+ expect(diagnostics.statusKey).toBe('messagePage.traceStatusCritical');
+ });
+
it('flags consumer delivery failures, pending statuses, unknown states and
retries', () => {
const diagnostics = analyzeMessageTrace(
baseTrace({
diff --git a/web/src/utils/messageTraceDiagnostics.ts
b/web/src/utils/messageTraceDiagnostics.ts
index b0d029117..e5b0818f2 100644
--- a/web/src/utils/messageTraceDiagnostics.ts
+++ b/web/src/utils/messageTraceDiagnostics.ts
@@ -118,7 +118,31 @@ const DEFAULT_OPTIONS: Required<TraceDiagnosticOptions> = {
const STATUS_KEY: Record<TraceDiagnosticStatus, string> = {
healthy: 'messagePage.traceStatusHealthy',
warning: 'messagePage.traceStatusWarning',
- critical: 'messagePage.traceStatusDeliveryCritical',
+ critical: 'messagePage.traceStatusCritical',
+};
+
+/** Critical findings that are actually about delivery, not about latency. */
+const DELIVERY_CRITICAL_CODES = new Set<TraceIssueCode>([
+ 'FAILED_TRACE_NODE',
+ 'FAILED_CONSUMER_DELIVERY',
+]);
+
+const DELIVERY_CRITICAL_KEY = 'messagePage.traceStatusDeliveryCritical';
+
+/**
+ * A critical status can come from a failed step or from a latency hotspot (a
critical slow node
+ * or end-to-end span). The delivery wording only fits the first kind, so a
trace whose deliveries
+ * all succeeded and whose phases all finished must not be badged "投递异常 /
Delivery Critical"
+ * just because it was slow.
+ */
+const statusKeyFor = (status: TraceDiagnosticStatus, issues:
TraceDiagnosticIssue[]): string => {
+ if (status !== 'critical') {
+ return STATUS_KEY[status];
+ }
+ const deliveryFailure = issues.some(
+ (issue) => issue.severity === 'critical' &&
DELIVERY_CRITICAL_CODES.has(issue.code),
+ );
+ return deliveryFailure ? DELIVERY_CRITICAL_KEY : STATUS_KEY.critical;
};
const STATUS_COLOR: Record<TraceDiagnosticStatus, 'success' | 'warning' |
'error'> = {
@@ -562,7 +586,7 @@ export function analyzeMessageTrace(
return {
status,
- statusKey: STATUS_KEY[status],
+ statusKey: statusKeyFor(status, issues),
statusColor: STATUS_COLOR[status],
score: calculateScore(issues),
summary,