(ctx context.Context, req *InterceptionRecordEnded)
| 190 | } |
| 191 | |
| 192 | func (a *AsyncRecorder) RecordInterceptionEnded(ctx context.Context, req *InterceptionRecordEnded) error { |
| 193 | a.wg.Add(1) |
| 194 | go func() { |
| 195 | defer a.wg.Done() |
| 196 | timedCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), a.timeout) |
| 197 | defer cancel() |
| 198 | |
| 199 | err := a.wrapped.RecordInterceptionEnded(timedCtx, req) |
| 200 | if err != nil { |
| 201 | a.logger.Warn(timedCtx, "failed to record interception end", slog.F("type", "prompt"), slog.Error(err), slog.F("payload", req)) |
| 202 | } |
| 203 | }() |
| 204 | |
| 205 | return nil // Caller is not interested in error. |
| 206 | } |
| 207 | |
| 208 | func (a *AsyncRecorder) RecordPromptUsage(ctx context.Context, req *PromptUsageRecord) error { |
| 209 | a.wg.Add(1) |
no test coverage detected