luispater commited on
Commit
a7eb286
·
unverified ·
1 Parent(s): 5e0970a

refactor(logger): remove unnecessary request details limit logic

Browse files
Files changed (1) hide show
  1. internal/usage/logger_plugin.go +0 -9
internal/usage/logger_plugin.go CHANGED
@@ -87,10 +87,6 @@ type modelStats struct {
87
  Details []RequestDetail
88
  }
89
 
90
- // maxDetailsPerModel limits the number of request details retained per model
91
- // to prevent unbounded memory growth. Oldest entries are dropped when exceeded.
92
- const maxDetailsPerModel = 1000
93
-
94
  // RequestDetail stores the timestamp and token usage for a single request.
95
  type RequestDetail struct {
96
  Timestamp time.Time `json:"timestamp"`
@@ -225,11 +221,6 @@ func (s *RequestStatistics) updateAPIStats(stats *apiStats, model string, detail
225
  modelStatsValue.TotalRequests++
226
  modelStatsValue.TotalTokens += detail.Tokens.TotalTokens
227
  modelStatsValue.Details = append(modelStatsValue.Details, detail)
228
- // Prevent unbounded growth by dropping oldest entries when limit exceeded
229
- if len(modelStatsValue.Details) > maxDetailsPerModel {
230
- excess := len(modelStatsValue.Details) - maxDetailsPerModel
231
- modelStatsValue.Details = modelStatsValue.Details[excess:]
232
- }
233
  }
234
 
235
  // Snapshot returns a copy of the aggregated metrics for external consumption.
 
87
  Details []RequestDetail
88
  }
89
 
 
 
 
 
90
  // RequestDetail stores the timestamp and token usage for a single request.
91
  type RequestDetail struct {
92
  Timestamp time.Time `json:"timestamp"`
 
221
  modelStatsValue.TotalRequests++
222
  modelStatsValue.TotalTokens += detail.Tokens.TotalTokens
223
  modelStatsValue.Details = append(modelStatsValue.Details, detail)
 
 
 
 
 
224
  }
225
 
226
  // Snapshot returns a copy of the aggregated metrics for external consumption.