fix(platform): avoid fake kafka lag
This commit is contained in:
@@ -21,7 +21,7 @@ export interface DashboardSummary {
|
||||
activeToday: number;
|
||||
frameToday: number;
|
||||
issueVehicles: number;
|
||||
kafkaLag: number;
|
||||
kafkaLag: number | null;
|
||||
protocols: ProtocolStat[];
|
||||
linkHealth: LinkHealth[];
|
||||
}
|
||||
@@ -124,7 +124,7 @@ export interface QualityIssueRow {
|
||||
|
||||
export interface OpsHealth {
|
||||
linkHealth: LinkHealth[];
|
||||
kafkaLag: number;
|
||||
kafkaLag: number | null;
|
||||
redisOnlineKeys: number;
|
||||
tdengineWritable: boolean;
|
||||
mysqlWritable: boolean;
|
||||
|
||||
@@ -11,6 +11,10 @@ const statusColor: Record<string, 'green' | 'orange' | 'red' | 'grey'> = {
|
||||
error: 'red'
|
||||
};
|
||||
|
||||
function formatLag(value?: number | null) {
|
||||
return value == null ? '未接入' : value.toLocaleString();
|
||||
}
|
||||
|
||||
export function Dashboard({ onOpenVehicle }: { onOpenVehicle: (vin: string) => void }) {
|
||||
const [summary, setSummary] = useState<DashboardSummary | null>(null);
|
||||
const [vehicles, setVehicles] = useState<VehicleRow[]>([]);
|
||||
@@ -104,7 +108,7 @@ export function Dashboard({ onOpenVehicle }: { onOpenVehicle: (vin: string) => v
|
||||
</Col>
|
||||
</Row>
|
||||
<Card title="实时积压" bordered style={{ marginTop: 16 }}>
|
||||
<Typography.Text>Kafka 当前消费积压:{summary?.kafkaLag ?? 0}</Typography.Text>
|
||||
<Typography.Text>Kafka 当前消费积压:{formatLag(summary?.kafkaLag)}</Typography.Text>
|
||||
</Card>
|
||||
<Card title="车辆服务覆盖" bordered style={{ marginTop: 16 }}>
|
||||
<Form layout="horizontal" onSubmit={(values) => loadCoverage(values as Record<string, string>)} style={{ marginBottom: 12 }}>
|
||||
|
||||
@@ -4,6 +4,10 @@ import { api } from '../api/client';
|
||||
import type { OpsHealth, QualityIssueRow } from '../api/types';
|
||||
import { PageHeader } from '../components/PageHeader';
|
||||
|
||||
function formatLag(value?: number | null) {
|
||||
return value == null ? '未接入' : value.toLocaleString();
|
||||
}
|
||||
|
||||
export function Quality() {
|
||||
const [issues, setIssues] = useState<QualityIssueRow[]>([]);
|
||||
const [health, setHealth] = useState<OpsHealth | null>(null);
|
||||
@@ -36,7 +40,7 @@ export function Quality() {
|
||||
<div className="vp-page">
|
||||
<PageHeader title="数据质量" description="断链、VIN 缺失、字段缺失和链路健康的排查入口" />
|
||||
<Row gutter={16}>
|
||||
<Col span={8}><Card bordered title="Kafka Lag">{health?.kafkaLag ?? 0}</Card></Col>
|
||||
<Col span={8}><Card bordered title="Kafka Lag">{formatLag(health?.kafkaLag)}</Card></Col>
|
||||
<Col span={8}><Card bordered title="Redis 在线 Key">{health?.redisOnlineKeys ?? 0}</Card></Col>
|
||||
<Col span={8}><Card bordered title="存储写入">{health?.tdengineWritable && health.mysqlWritable ? '正常' : '异常'}</Card></Col>
|
||||
</Row>
|
||||
|
||||
Reference in New Issue
Block a user