fix(platform): avoid fake redis online keys
This commit is contained in:
@@ -178,10 +178,11 @@ func (m *MockStore) QualityIssues(_ context.Context, query url.Values) (Page[Qua
|
||||
|
||||
func (m *MockStore) OpsHealth(context.Context) (OpsHealth, error) {
|
||||
summary, _ := m.DashboardSummary(context.Background())
|
||||
redisOnlineKeys := 92
|
||||
return OpsHealth{
|
||||
LinkHealth: summary.LinkHealth,
|
||||
KafkaLag: summary.KafkaLag,
|
||||
RedisOnlineKeys: 92,
|
||||
RedisOnlineKeys: &redisOnlineKeys,
|
||||
TDengineWritable: true,
|
||||
MySQLWritable: true,
|
||||
}, nil
|
||||
|
||||
@@ -135,7 +135,7 @@ type QualityIssueRow struct {
|
||||
type OpsHealth struct {
|
||||
LinkHealth []LinkHealth `json:"linkHealth"`
|
||||
KafkaLag *int `json:"kafkaLag"`
|
||||
RedisOnlineKeys int `json:"redisOnlineKeys"`
|
||||
RedisOnlineKeys *int `json:"redisOnlineKeys"`
|
||||
TDengineWritable bool `json:"tdengineWritable"`
|
||||
MySQLWritable bool `json:"mysqlWritable"`
|
||||
}
|
||||
|
||||
@@ -377,8 +377,6 @@ func (s *ProductionStore) OpsHealth(ctx context.Context) (OpsHealth, error) {
|
||||
mysqlStatus = "error"
|
||||
mysqlDetail = err.Error()
|
||||
}
|
||||
var redisKeys int
|
||||
_ = s.db.QueryRowContext(ctx, `SELECT COUNT(*) FROM vehicle_realtime_snapshot WHERE updated_at >= DATE_SUB(NOW(), INTERVAL 1 MINUTE)`).Scan(&redisKeys)
|
||||
return OpsHealth{
|
||||
LinkHealth: []LinkHealth{
|
||||
{Name: "MySQL realtime", Status: mysqlStatus, Detail: mysqlDetail},
|
||||
@@ -386,8 +384,8 @@ func (s *ProductionStore) OpsHealth(ctx context.Context) (OpsHealth, error) {
|
||||
{Name: "vehicle_realtime_location", Status: "ok", Detail: "读取实时位置表"},
|
||||
{Name: "TDengine raw_frames", Status: tdengineStatus(s.tdengine), Detail: tdengineDetail(s.tdengine)},
|
||||
{Name: "Kafka lag", Status: "warning", Detail: "平台暂未接入 Kafka consumer lag 监控"},
|
||||
{Name: "Redis online keys", Status: "warning", Detail: "平台暂未接入 Redis 在线 key 读取"},
|
||||
},
|
||||
RedisOnlineKeys: redisKeys,
|
||||
TDengineWritable: s.tdengine != nil,
|
||||
MySQLWritable: mysqlStatus == "ok",
|
||||
}, nil
|
||||
|
||||
@@ -125,7 +125,7 @@ export interface QualityIssueRow {
|
||||
export interface OpsHealth {
|
||||
linkHealth: LinkHealth[];
|
||||
kafkaLag: number | null;
|
||||
redisOnlineKeys: number;
|
||||
redisOnlineKeys: number | null;
|
||||
tdengineWritable: boolean;
|
||||
mysqlWritable: boolean;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ export function Quality() {
|
||||
<PageHeader title="数据质量" description="断链、VIN 缺失、字段缺失和链路健康的排查入口" />
|
||||
<Row gutter={16}>
|
||||
<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="Redis 在线 Key">{formatLag(health?.redisOnlineKeys)}</Card></Col>
|
||||
<Col span={8}><Card bordered title="存储写入">{health?.tdengineWritable && health.mysqlWritable ? '正常' : '异常'}</Card></Col>
|
||||
</Row>
|
||||
<Card bordered title="质量问题" style={{ marginTop: 16 }}>
|
||||
|
||||
Reference in New Issue
Block a user