(ctx context.Context, req *InterceptionRecordEnded)
| 45 | } |
| 46 | |
| 47 | func (r *WrappedRecorder) RecordInterceptionEnded(ctx context.Context, req *InterceptionRecordEnded) (outErr error) { |
| 48 | ctx, span := r.tracer.Start(ctx, "Intercept.RecordInterceptionEnded", trace.WithAttributes(tracing.InterceptionAttributesFromContext(ctx)...)) |
| 49 | defer tracing.EndSpanErr(span, &outErr) |
| 50 | |
| 51 | client, err := r.clientFn() |
| 52 | if err != nil { |
| 53 | return xerrors.Errorf("acquire client: %w", err) |
| 54 | } |
| 55 | |
| 56 | req.EndedAt = time.Now().UTC() |
| 57 | if err = client.RecordInterceptionEnded(ctx, req); err == nil { |
| 58 | return nil |
| 59 | } |
| 60 | |
| 61 | r.logger.Warn(ctx, "failed to record that interception ended", slog.Error(err), slog.F("interception_id", req.ID)) |
| 62 | return err |
| 63 | } |
| 64 | |
| 65 | func (r *WrappedRecorder) RecordPromptUsage(ctx context.Context, req *PromptUsageRecord) (outErr error) { |
| 66 | ctx, span := r.tracer.Start(ctx, "Intercept.RecordPromptUsage", trace.WithAttributes(tracing.InterceptionAttributesFromContext(ctx)...)) |
nothing calls this directly
no test coverage detected