@@ -400,32 +400,18 @@ func IsMetricsEnabled() bool {
400400 return metricsEnabled
401401}
402402
403- // RecordSelection records a basic model selection event
404- func RecordSelection (method string , decision string , model string , score float64 ) {
403+ // RecordSelection records a basic model selection event with tier label.
404+ func RecordSelection (method string , decision string , model string , tier AlgorithmTier , score float64 ) {
405405 if ! metricsEnabled {
406406 return
407407 }
408408
409- ModelSelectionTotal .WithLabelValues (method , model , decision , "" ).Inc ()
409+ tierStr := string (tier )
410+ ModelSelectionTotal .WithLabelValues (method , model , decision , tierStr ).Inc ()
410411 ModelSelectionScore .WithLabelValues (method , model ).Observe (score )
411412 ModelSelectionHistory .WithLabelValues (method , decision ).Inc ()
412413}
413414
414- // RecordSelectionFull records a model selection event with all metrics
415- func RecordSelectionFull (method SelectionMethod , model string , decision string , score , confidence float64 , duration time.Duration ) {
416- if ! metricsEnabled {
417- return
418- }
419-
420- methodStr := string (method )
421-
422- ModelSelectionTotal .WithLabelValues (methodStr , model , decision , "" ).Inc ()
423- ModelSelectionDuration .WithLabelValues (methodStr , "" ).Observe (duration .Seconds ())
424- ModelSelectionScore .WithLabelValues (methodStr , model ).Observe (score )
425- ModelSelectionConfidence .WithLabelValues (methodStr , "" ).Observe (confidence )
426- ModelSelectionHistory .WithLabelValues (methodStr , decision ).Inc ()
427- }
428-
429415// RecordEloRating records the current Elo rating for a model in a category
430416func RecordEloRating (model , category string , rating float64 ) {
431417 if ! metricsEnabled {
@@ -608,15 +594,13 @@ func calculateAgreementRatio(choices []string) float64 {
608594}
609595
610596// RecordHybridSelection records metrics for a hybrid selection including component agreement
611- func RecordHybridSelection (selectedModel string , decision string , componentChoices map [string ]string , score , confidence float64 , duration time.Duration ) {
597+ func RecordHybridSelection (selectedModel string , decision string , componentChoices map [string ]string , tier AlgorithmTier , score , confidence float64 , duration time.Duration ) {
612598 if ! metricsEnabled {
613599 return
614600 }
615601
616- // Record standard selection metrics
617- RecordSelectionFull (MethodHybrid , selectedModel , decision , score , confidence , duration )
602+ RecordSelectionWithTier (MethodHybrid , selectedModel , decision , tier , score , confidence , duration )
618603
619- // Calculate and record component agreement
620604 if len (componentChoices ) > 1 {
621605 choices := make ([]string , 0 , len (componentChoices ))
622606 for _ , model := range componentChoices {
@@ -677,7 +661,7 @@ func RecordRouterDCAffinity(model string, affinity float64) {
677661// --- RL-Driven metrics recording functions ---
678662
679663// RecordRLSelection records a RL-driven model selection event
680- func RecordRLSelection (model , category , userID string , score float64 ) {
664+ func RecordRLSelection (model , category , userID string , tier AlgorithmTier , score float64 ) {
681665 if ! metricsEnabled {
682666 return
683667 }
@@ -686,11 +670,11 @@ func RecordRLSelection(model, category, userID string, score float64) {
686670 category = "_global"
687671 }
688672
689- ModelSelectionTotal .WithLabelValues ("rl_driven" , model , category , "experimental" ).Inc ()
673+ tierStr := string (tier )
674+ ModelSelectionTotal .WithLabelValues ("rl_driven" , model , category , tierStr ).Inc ()
690675 ModelSelectionScore .WithLabelValues ("rl_driven" , model ).Observe (score )
691676 ModelSelectionHistory .WithLabelValues ("rl_driven" , category ).Inc ()
692677
693- // Track personalized selections
694678 if userID != "" {
695679 RLDrivenPersonalizedSelections .WithLabelValues (model , category ).Inc ()
696680 }
0 commit comments