Skip to content

Commit 454cd8b

Browse files
committed
traceNewStreaming rename
1 parent 1ac08c1 commit 454cd8b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

intercept_anthropic_messages_streaming.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ newStream:
135135
break
136136
}
137137

138-
stream := i.traceNewStreaming(streamCtx, svc, messages) // traces svc.NewStreaming(streamCtx, messages)
138+
stream := i.newStream(streamCtx, svc, messages)
139139

140140
var message anthropic.Message
141141
var lastToolName string
@@ -522,7 +522,8 @@ func (s *AnthropicMessagesStreamingInterception) encodeForStream(payload []byte,
522522
return buf.Bytes()
523523
}
524524

525-
func (s *AnthropicMessagesStreamingInterception) traceNewStreaming(ctx context.Context, svc anthropic.MessageService, messages anthropic.MessageNewParams) *ssestream.Stream[anthropic.MessageStreamEventUnion] {
525+
// newStream traces svc.NewStreaming(streamCtx, messages)
526+
func (s *AnthropicMessagesStreamingInterception) newStream(ctx context.Context, svc anthropic.MessageService, messages anthropic.MessageNewParams) *ssestream.Stream[anthropic.MessageStreamEventUnion] {
526527
_, span := s.tracer.Start(ctx, "Intercept.ProcessRequest.Upstream", trace.WithAttributes(tracing.InterceptionAttributesFromContext(ctx)...))
527528
defer span.End()
528529

intercept_openai_chat_streaming.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func (i *OpenAIStreamingChatInterception) ProcessRequest(w http.ResponseWriter,
116116
)
117117
for {
118118
// TODO add outer loop span (https://github.com/coder/aibridge/issues/67)
119-
stream = i.traceNewStreaming(streamCtx, svc) // traces svc.NewStreaming(streamCtx, i.req.ChatCompletionNewParams) call
119+
stream = i.newStream(streamCtx, svc)
120120
processor := newStreamProcessor(streamCtx, i.logger.Named("stream-processor"), i.getInjectedToolByName)
121121

122122
var toolCall *openai.FinishedChatCompletionToolCall
@@ -346,7 +346,8 @@ func (i *OpenAIStreamingChatInterception) encodeForStream(payload []byte) []byte
346346
return buf.Bytes()
347347
}
348348

349-
func (i *OpenAIStreamingChatInterception) traceNewStreaming(ctx context.Context, svc openai.ChatCompletionService) *ssestream.Stream[openai.ChatCompletionChunk] {
349+
// newStream traces svc.NewStreaming(streamCtx, i.req.ChatCompletionNewParams) call
350+
func (i *OpenAIStreamingChatInterception) newStream(ctx context.Context, svc openai.ChatCompletionService) *ssestream.Stream[openai.ChatCompletionChunk] {
350351
_, span := i.tracer.Start(ctx, "Intercept.ProcessRequest.Upstream", trace.WithAttributes(tracing.InterceptionAttributesFromContext(ctx)...))
351352
defer span.End()
352353

0 commit comments

Comments
 (0)