MCPcopy Create free account
hub / github.com/coder/coder / RecordInterceptionEnded

Method RecordInterceptionEnded

aibridge/recorder/recorder.go:47–63  ·  view source on GitHub ↗
(ctx context.Context, req *InterceptionRecordEnded)

Source from the content-addressed store, hash-verified

45}
46
47func (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
65func (r *WrappedRecorder) RecordPromptUsage(ctx context.Context, req *PromptUsageRecord) (outErr error) {
66 ctx, span := r.tracer.Start(ctx, "Intercept.RecordPromptUsage", trace.WithAttributes(tracing.InterceptionAttributesFromContext(ctx)...))

Callers

nothing calls this directly

Calls 6

EndSpanErrFunction · 0.92
StartMethod · 0.65
ErrorfMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected