MCPcopy Index your code
hub / github.com/coder/coder / RecordInterceptionEnded

Method RecordInterceptionEnded

coderd/aibridgedserver/aibridgedserver.go:208–235  ·  view source on GitHub ↗
(ctx context.Context, in *proto.RecordInterceptionEndedRequest)

Source from the content-addressed store, hash-verified

206}
207
208func (s *Server) RecordInterceptionEnded(ctx context.Context, in *proto.RecordInterceptionEndedRequest) (*proto.RecordInterceptionEndedResponse, error) {
209 //nolint:gocritic // AIBridged has specific authz rules.
210 ctx = dbauthz.AsAIBridged(ctx)
211
212 intcID, err := uuid.Parse(in.GetId())
213 if err != nil {
214 return nil, xerrors.Errorf("invalid interception ID %q: %w", in.GetId(), err)
215 }
216
217 if s.structuredLogging {
218 s.logger.Info(ctx, InterceptionLogMarker,
219 slog.F("record_type", "interception_end"),
220 slog.F("interception_id", intcID.String()),
221 slog.F("ended_at", in.EndedAt.AsTime()),
222 )
223 }
224
225 _, err = s.store.UpdateAIBridgeInterceptionEnded(ctx, database.UpdateAIBridgeInterceptionEndedParams{
226 ID: intcID,
227 EndedAt: in.EndedAt.AsTime(),
228 CredentialHint: in.CredentialHint,
229 })
230 if err != nil {
231 return nil, xerrors.Errorf("end interception: %w", err)
232 }
233
234 return &proto.RecordInterceptionEndedResponse{}, nil
235}
236
237func (s *Server) RecordTokenUsage(ctx context.Context, in *proto.RecordTokenUsageRequest) (*proto.RecordTokenUsageResponse, error) {
238 //nolint:gocritic // AIBridged has specific authz rules.

Callers 1

TestStructuredLoggingFunction · 0.95

Calls 7

AsAIBridgedFunction · 0.92
ParseMethod · 0.65
GetIdMethod · 0.45
ErrorfMethod · 0.45
InfoMethod · 0.45
StringMethod · 0.45

Tested by 1

TestStructuredLoggingFunction · 0.76