Skip to content

Commit 3a55005

Browse files
committed
OpenAIRecorder: Capture User-Agent header in records
Signed-off-by: Dorin Geman <dorin.geman@docker.com>
1 parent ea9a321 commit 3a55005

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

pkg/metrics/openai_recorder.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type RequestResponsePair struct {
3838
Response string `json:"response"`
3939
Timestamp time.Time `json:"timestamp"`
4040
StatusCode int `json:"status_code"`
41+
UserAgent string `json:"user_agent,omitempty"`
4142
}
4243

4344
type ModelData struct {
@@ -90,6 +91,7 @@ func (r *OpenAIRecorder) RecordRequest(model string, req *http.Request, body []b
9091
URL: req.URL.Path,
9192
Request: string(body),
9293
Timestamp: time.Now(),
94+
UserAgent: req.UserAgent(),
9395
}
9496

9597
if r.records[model] == nil {

0 commit comments

Comments
 (0)