@@ -28,8 +28,8 @@ import (
2828)
2929
3030func TestMessagesProcessorFactory (t * testing.T ) {
31- chatMetrics := metrics .NewChatCompletion (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})
32- factory := MessagesProcessorFactory (chatMetrics )
31+ m := metrics .NewMessagesFactory (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})
32+ factory := MessagesProcessorFactory (m )
3333 require .NotNil (t , factory , "MessagesProcessorFactory should return a non-nil factory" )
3434
3535 // Test creating a router filter.
@@ -401,7 +401,7 @@ func TestMessagesProcessorUpstreamFilter_ProcessRequestHeaders_WithMocks(t *test
401401 }
402402
403403 // Create mock metrics.
404- chatMetrics := metrics .NewChatCompletion (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})
404+ chatMetrics := metrics .NewChatCompletionFactory (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})( )
405405
406406 // Create processor.
407407 processor := & messagesProcessorUpstreamFilter {
@@ -436,7 +436,7 @@ func TestMessagesProcessorUpstreamFilter_ProcessResponseHeaders_WithMocks(t *tes
436436 retErr : nil ,
437437 }
438438
439- chatMetrics := metrics .NewChatCompletion (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})
439+ chatMetrics := metrics .NewChatCompletionFactory (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})( )
440440 processor := & messagesProcessorUpstreamFilter {
441441 config : & processorConfig {},
442442 requestHeaders : make (map [string ]string ),
@@ -461,7 +461,7 @@ func TestMessagesProcessorUpstreamFilter_ProcessResponseBody_WithMocks(t *testin
461461 retErr : nil ,
462462 }
463463
464- chatMetrics := metrics .NewChatCompletion (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})
464+ chatMetrics := metrics .NewChatCompletionFactory (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})( )
465465 processor := & messagesProcessorUpstreamFilter {
466466 config : & processorConfig {},
467467 requestHeaders : make (map [string ]string ),
@@ -532,7 +532,7 @@ func TestMessagesProcessorUpstreamFilter_ProcessResponseBody_CompletionOnlyAtEnd
532532}
533533
534534func TestMessagesProcessorUpstreamFilter_MergeWithTokenLatencyMetadata (t * testing.T ) {
535- chatMetrics := metrics .NewChatCompletion (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})
535+ chatMetrics := metrics .NewChatCompletionFactory (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})( )
536536 processor := & messagesProcessorUpstreamFilter {
537537 config : & processorConfig {},
538538 logger : slog .Default (),
@@ -561,7 +561,7 @@ func TestMessagesProcessorUpstreamFilter_MergeWithTokenLatencyMetadata(t *testin
561561
562562func TestMessagesProcessorUpstreamFilter_SetBackend (t * testing.T ) {
563563 headers := map [string ]string {":path" : "/anthropic/v1/messages" }
564- chatMetrics := metrics .NewChatCompletion (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})
564+ chatMetrics := metrics .NewChatCompletionFactory (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})( )
565565 processor := & messagesProcessorUpstreamFilter {
566566 config : & processorConfig {
567567 requestCosts : []processorConfigRequestCost {
@@ -587,7 +587,7 @@ func TestMessagesProcessorUpstreamFilter_SetBackend(t *testing.T) {
587587
588588func Test_messagesProcessorUpstreamFilter_SetBackend_Success (t * testing.T ) {
589589 headers := map [string ]string {":path" : "/anthropic/v1/messages" , internalapi .ModelNameHeaderKeyDefault : "claude" }
590- chatMetrics := metrics .NewChatCompletion (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})
590+ chatMetrics := metrics .NewChatCompletionFactory (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})( )
591591 p := & messagesProcessorUpstreamFilter {
592592 config : & processorConfig {},
593593 requestHeaders : headers ,
@@ -724,7 +724,7 @@ func TestMessagesProcessorUpstreamFilter_ProcessRequestHeaders_WithHeaderMutatio
724724 }
725725
726726 // Create mock metrics.
727- chatMetrics := metrics .NewChatCompletion (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})
727+ chatMetrics := metrics .NewChatCompletionFactory (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})( )
728728
729729 // Create processor.
730730 processor := & messagesProcessorUpstreamFilter {
@@ -801,7 +801,7 @@ func TestMessagesProcessorUpstreamFilter_ProcessRequestHeaders_WithHeaderMutatio
801801 }
802802
803803 // Create mock metrics.
804- chatMetrics := metrics .NewChatCompletion (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})
804+ chatMetrics := metrics .NewMessagesFactory (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})( )
805805
806806 // Create processor.
807807 processor := & messagesProcessorUpstreamFilter {
@@ -888,7 +888,7 @@ func TestMessagesProcessorUpstreamFilter_ProcessRequestHeaders_WithHeaderMutatio
888888 }
889889
890890 // Create mock metrics.
891- chatMetrics := metrics .NewChatCompletion (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})
891+ chatMetrics := metrics .NewChatCompletionFactory (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})( )
892892
893893 // Create processor.
894894 processor := & messagesProcessorUpstreamFilter {
@@ -924,7 +924,7 @@ func TestMessagesProcessorUpstreamFilter_ProcessRequestHeaders_WithHeaderMutatio
924924func TestMessagesProcessorUpstreamFilter_SetBackend_WithHeaderMutations (t * testing.T ) {
925925 t .Run ("header mutator created correctly" , func (t * testing.T ) {
926926 headers := map [string ]string {":path" : "/anthropic/v1/messages" }
927- chatMetrics := metrics .NewChatCompletion (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})
927+ chatMetrics := metrics .NewChatCompletionFactory (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})( )
928928 p := & messagesProcessorUpstreamFilter {
929929 config : & processorConfig {},
930930 requestHeaders : headers ,
@@ -980,7 +980,7 @@ func TestMessagesProcessorUpstreamFilter_SetBackend_WithHeaderMutations(t *testi
980980
981981 t .Run ("header mutator with original headers" , func (t * testing.T ) {
982982 headers := map [string ]string {":path" : "/anthropic/v1/messages" }
983- chatMetrics := metrics .NewChatCompletion (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})
983+ chatMetrics := metrics .NewChatCompletionFactory (noop .NewMeterProvider ().Meter ("test" ), map [string ]string {})( )
984984 p := & messagesProcessorUpstreamFilter {
985985 config : & processorConfig {},
986986 requestHeaders : headers ,
0 commit comments