Skip to content

Commit 113012a

Browse files
committed
修改threshold阈值小数,修改数据库表不一致问题
1 parent 0a3e84c commit 113012a

File tree

8 files changed

+25
-18
lines changed

8 files changed

+25
-18
lines changed

client/src/views/ChangeLogView.vue

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@
6868
</template>
6969
</div>
7070
</el-tab-pane>
71-
72-
<el-tab-pane label="xxx 变更记录" name="other1">
73-
<div class="placeholder">占位</div>
74-
</el-tab-pane>
75-
76-
<el-tab-pane label="xxx 变更记录" name="other2">
77-
<div class="placeholder">占位</div>
78-
</el-tab-pane>
7971
</el-tabs>
8072
</div>
8173
</template>

docker-compose.prod.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ services:
5656
volumes:
5757
- ./configs:/app/configs:ro
5858
- ./config.docker.json:/app/config.json:ro
59+
- ./internal/deploy/config.yaml:/app/internal/deploy/config.yaml:ro
5960
ports:
6061
- "8080:8080"
6162
healthcheck:

docs/alerting/database-design.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ erDiagram
157157
timestamp report_at
158158
timestamp resolved_at
159159
varchar health_state
160-
varchar correlation_id
160+
varchar alert_issue_ids
161161
}
162162
163163
alert_issues {

docs/service_manager/model/schema.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ CREATE TABLE IF NOT EXISTS service_states (
3737
report_at TIMESTAMP,
3838
resolved_at TIMESTAMP,
3939
health_state VARCHAR(50),
40-
correlation_id VARCHAR(255),
40+
alert_issue_ids VARCHAR(255),
4141
PRIMARY KEY (service, version),
4242
FOREIGN KEY (service) REFERENCES services(name) ON DELETE CASCADE
4343
);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package healthcheck
2+
3+
import (
4+
"fmt"
5+
"math"
6+
"testing"
7+
)
8+
9+
func TestCommon(t *testing.T) {
10+
baseTh := 97.0
11+
12+
newThreshold := baseTh - math.Ceil(baseTh*0.01)
13+
fmt.Println(newThreshold)
14+
}

internal/alerting/service/healthcheck/scheduler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ func runPrometheusAnomalyDetection(ctx context.Context, deps PrometheusDeps) err
357357
log.Debug().Str("alert_name", q.AlertName).Str("service", service).Str("version", version).Msg("no exact meta threshold found; skip")
358358
continue
359359
}
360-
newThreshold := baseTh * 0.99
360+
newThreshold := baseTh - math.Ceil(baseTh*0.01)
361361

362362
// fetch all metas for this service (across versions)
363363
metas, ferr := fetchMetasForService(ctx, deps.DB, q.AlertName, service)

internal/service_manager/database/info_repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ func (d *Database) CreateServiceInstance(ctx context.Context, instance *model.Se
155155

156156
// GetServiceState 获取服务状态
157157
func (d *Database) GetServiceState(ctx context.Context, serviceName string) (*model.ServiceState, error) {
158-
query := `SELECT service, version, report_at, resolved_at, health_state, correlation_id
158+
query := `SELECT service, version, report_at, resolved_at, health_state, alert_issue_ids
159159
FROM service_states WHERE service = $1 ORDER BY report_at DESC LIMIT 1`
160160
row := d.QueryRowContext(ctx, query, serviceName)
161161

internal/service_manager/model/service_state.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import "time"
44

55
// ServiceState 服务状态信息
66
type ServiceState struct {
7-
Service string `json:"service" db:"service"` // varchar(255) - 联合PK
8-
Version string `json:"version" db:"version"` // varchar(255) - 联合PK
9-
ReportAt time.Time `json:"reportAt" db:"report_at"` // time - 报告时间
10-
ResolvedAt *time.Time `json:"resolvedAt" db:"resolved_at"` // time - 解决时间
11-
HealthState HealthState `json:"healthState" db:"health_state"` // 健康状态
12-
CorrelationID string `json:"correlationId" db:"correlation_id"` // varchar - 关联ID
7+
Service string `json:"service" db:"service"` // varchar(255) - 联合PK
8+
Version string `json:"version" db:"version"` // varchar(255) - 联合PK
9+
ReportAt time.Time `json:"reportAt" db:"report_at"` // time - 报告时间
10+
ResolvedAt *time.Time `json:"resolvedAt" db:"resolved_at"` // time - 解决时间
11+
HealthState HealthState `json:"healthState" db:"health_state"` // 健康状态
12+
CorrelationID string `json:"alertIssueIds" db:"alert_issue_ids"` // varchar - 关联ID
1313
}

0 commit comments

Comments
 (0)