feat: sync current progress (P0 hardening + P1 observability + deploy docs/systemd)

This commit is contained in:
OpenClaw Agent
2026-02-28 23:51:23 +08:00
commit d17296d794
96 changed files with 6358 additions and 0 deletions

25
internal/api/requestid.go Normal file
View File

@@ -0,0 +1,25 @@
package api
import (
"crypto/rand"
"encoding/hex"
"github.com/gin-gonic/gin"
)
func RequestID() gin.HandlerFunc {
return func(c *gin.Context) {
id := c.GetHeader("X-Request-Id")
if id == "" {
b := make([]byte, 8)
if _, err := rand.Read(b); err == nil {
id = hex.EncodeToString(b)
} else {
id = "req-unknown"
}
}
c.Set("request_id", id)
c.Header("X-Request-Id", id)
c.Next()
}
}