record response time
This commit is contained in:
@@ -133,6 +133,7 @@ func processRequest(c *gin.Context, upstream *OPENAI_UPSTREAM, record *Record, s
|
|||||||
}
|
}
|
||||||
proxy.ErrorHandler = func(w http.ResponseWriter, r *http.Request, err error) {
|
proxy.ErrorHandler = func(w http.ResponseWriter, r *http.Request, err error) {
|
||||||
haveResponse = true
|
haveResponse = true
|
||||||
|
record.ResponseTime = time.Now().Sub(record.CreatedAt)
|
||||||
log.Println("Error", err, upstream.SK, upstream.Endpoint)
|
log.Println("Error", err, upstream.SK, upstream.Endpoint)
|
||||||
|
|
||||||
errCtx = err
|
errCtx = err
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ type Record struct {
|
|||||||
Body string `gorm:"serializer:json"`
|
Body string `gorm:"serializer:json"`
|
||||||
Model string
|
Model string
|
||||||
Response string
|
Response string
|
||||||
|
ResponseTime time.Duration
|
||||||
ElapsedTime time.Duration
|
ElapsedTime time.Duration
|
||||||
Status int
|
Status int
|
||||||
UpstreamID uint
|
UpstreamID uint
|
||||||
|
|||||||
Reference in New Issue
Block a user