feat: able to fetch every request's cost

This commit is contained in:
Laisky.Cai
2024-04-23 00:58:25 +00:00
parent 7047d9605e
commit 84a6817314
14 changed files with 119 additions and 19 deletions

View File

@@ -11,6 +11,7 @@ import (
"time"
"github.com/Laisky/one-api/common/config"
"github.com/Laisky/one-api/common/ctxkey"
"github.com/Laisky/one-api/common/helper"
"github.com/gin-gonic/gin"
)
@@ -87,7 +88,7 @@ func logHelper(ctx context.Context, level string, msg string) {
if level == loggerINFO {
writer = gin.DefaultWriter
}
id := ctx.Value(RequestIdKey)
id := ctx.Value(ctxkey.RequestId)
if id == nil {
id = helper.GenRequestID()
}