Skip to content

Commit 229e081

Browse files
authored
Merge pull request docker#147 from docker/openairecorder
refactor(OpenAIRecorder): use Unix timestamp instead of time.Time
2 parents 3d702d7 + 5449fc9 commit 229e081

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

pkg/metrics/openai_recorder.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ func (rr *responseRecorder) Flush() {
4141
}
4242

4343
type RequestResponsePair struct {
44-
ID string `json:"id"`
45-
Model string `json:"model"`
46-
Method string `json:"method"`
47-
URL string `json:"url"`
48-
Request string `json:"request"`
49-
Response string `json:"response,omitempty"`
50-
Error string `json:"error,omitempty"`
51-
Timestamp time.Time `json:"timestamp"`
52-
StatusCode int `json:"status_code"`
53-
UserAgent string `json:"user_agent,omitempty"`
44+
ID string `json:"id"`
45+
Model string `json:"model"`
46+
Method string `json:"method"`
47+
URL string `json:"url"`
48+
Request string `json:"request"`
49+
Response string `json:"response,omitempty"`
50+
Error string `json:"error,omitempty"`
51+
Timestamp int64 `json:"timestamp"`
52+
StatusCode int `json:"status_code"`
53+
UserAgent string `json:"user_agent,omitempty"`
5454
}
5555

5656
type ModelData struct {
@@ -108,7 +108,7 @@ func (r *OpenAIRecorder) RecordRequest(model string, req *http.Request, body []b
108108
Method: req.Method,
109109
URL: req.URL.Path,
110110
Request: string(body),
111-
Timestamp: time.Now(),
111+
Timestamp: time.Now().Unix(),
112112
UserAgent: req.UserAgent(),
113113
}
114114

0 commit comments

Comments
 (0)