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
|
||||
|
||||
Reference in New Issue
Block a user