feat(ops): 添加QPS脉搏线图并优化指标布局
- 添加实时QPS/TPS历史数据追踪(最近60个数据点) - 在平均QPS/TPS上方添加SVG脉搏线图(sparkline) - 将延迟和TTFT卡片的指标布局从2列改为3列 - 恢复Max指标显示(P95/P90/P50/Avg/Max)
This commit is contained in:
31
backend/internal/service/ops_upstream_context.go
Normal file
31
backend/internal/service/ops_upstream_context.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// Gin context keys used by Ops error logger for capturing upstream error details.
|
||||
// These keys are set by gateway services and consumed by handler/ops_error_logger.go.
|
||||
const (
|
||||
OpsUpstreamStatusCodeKey = "ops_upstream_status_code"
|
||||
OpsUpstreamErrorMessageKey = "ops_upstream_error_message"
|
||||
OpsUpstreamErrorDetailKey = "ops_upstream_error_detail"
|
||||
)
|
||||
|
||||
func setOpsUpstreamError(c *gin.Context, upstreamStatusCode int, upstreamMessage, upstreamDetail string) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
if upstreamStatusCode > 0 {
|
||||
c.Set(OpsUpstreamStatusCodeKey, upstreamStatusCode)
|
||||
}
|
||||
if msg := strings.TrimSpace(upstreamMessage); msg != "" {
|
||||
c.Set(OpsUpstreamErrorMessageKey, msg)
|
||||
}
|
||||
if detail := strings.TrimSpace(upstreamDetail); detail != "" {
|
||||
c.Set(OpsUpstreamErrorDetailKey, detail)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user