@@ -182,29 +182,29 @@ func (p *ModelSelectorPipeline) runFilterPlugins(ctx context.Context, request *r
182182
183183 tracer := tracing .Tracer (modelSelectorTracerScope )
184184 for _ , filter := range p .filters {
185- name := filter .TypedName ()
185+ typedName := filter .TypedName ()
186186 if verboseEnabled {
187- verboseLogger .Info ("Running filter plugin" , "plugin" , name )
187+ verboseLogger .Info ("Running filter plugin" , "plugin" , typedName )
188188 }
189- spanCtx , span := tracer .Start (ctx , "plugin." + name .Type ,
189+ spanCtx , span := tracer .Start (ctx , "plugin." + typedName .Type ,
190190 trace .WithSpanKind (trace .SpanKindInternal ),
191191 trace .WithAttributes (
192192 attribute .String ("llm_d.plugin.extension_point" , filterExtensionPoint ),
193- attribute .String ("llm_d.plugin.type" , name .Type ),
194- attribute .String ("llm_d.plugin.name" , name .Name ),
193+ attribute .String ("llm_d.plugin.type" , typedName .Type ),
194+ attribute .String ("llm_d.plugin.name" , typedName .Name ),
195195 attribute .Int ("llm_d.filter.candidates_in" , len (filteredModels )),
196196 ))
197197 before := time .Now ()
198198 filteredModels = filter .Filter (spanCtx , cycleState , request , filteredModels )
199- metrics .RecordPluginProcessingLatency (filterExtensionPoint , name .Type , name .Name , time .Since (before ))
199+ metrics .RecordPluginProcessingLatency (filterExtensionPoint , typedName .Type , typedName .Name , time .Since (before ))
200200 span .SetAttributes (attribute .Int ("llm_d.filter.candidates_out" , len (filteredModels )))
201201 span .End ()
202202 if debugEnabled {
203- debugLogger .Info ("Completed running filter plugin" , "plugin" , name , "remainingModels" , len (filteredModels ))
203+ debugLogger .Info ("Completed running filter plugin" , "plugin" , typedName , "remainingModels" , len (filteredModels ))
204204 }
205205 if len (filteredModels ) == 0 {
206206 if verboseEnabled {
207- verboseLogger .Info ("Filter eliminated all models" , "plugin" , name )
207+ verboseLogger .Info ("Filter eliminated all models" , "plugin" , typedName )
208208 }
209209 break
210210 }
@@ -236,30 +236,30 @@ func (p *ModelSelectorPipeline) runScorerPlugins(ctx context.Context, request *r
236236
237237 tracer := tracing .Tracer (modelSelectorTracerScope )
238238 for _ , scorer := range p .scorers {
239- name := scorer .TypedName ()
239+ typedName := scorer .TypedName ()
240240 if verboseEnabled {
241- verboseLogger .Info ("Running scorer plugin" , "plugin" , name )
241+ verboseLogger .Info ("Running scorer plugin" , "plugin" , typedName )
242242 }
243- spanCtx , span := tracer .Start (ctx , "plugin." + name .Type ,
243+ spanCtx , span := tracer .Start (ctx , "plugin." + typedName .Type ,
244244 trace .WithSpanKind (trace .SpanKindInternal ),
245245 trace .WithAttributes (
246246 attribute .String ("llm_d.plugin.extension_point" , scorerExtensionPoint ),
247- attribute .String ("llm_d.plugin.type" , name .Type ),
248- attribute .String ("llm_d.plugin.name" , name .Name ),
247+ attribute .String ("llm_d.plugin.type" , typedName .Type ),
248+ attribute .String ("llm_d.plugin.name" , typedName .Name ),
249249 attribute .Int ("llm_d.scorer.candidate_count" , len (models )),
250250 attribute .Float64 ("llm_d.scorer.weight" , scorer .Weight ()),
251251 ))
252252 before := time .Now ()
253253 scores := scorer .Score (spanCtx , cycleState , request , models )
254- metrics .RecordPluginProcessingLatency (scorerExtensionPoint , name .Type , name .Name , time .Since (before ))
254+ metrics .RecordPluginProcessingLatency (scorerExtensionPoint , typedName .Type , typedName .Name , time .Since (before ))
255255 span .End ()
256256 for model , score := range scores {
257257 if sm , exists := scoredModels [model .GetName ()]; exists {
258258 sm .Score += enforceScoreRange (score ) * scorer .Weight ()
259259 }
260260 }
261261 if debugEnabled {
262- debugLogger .Info ("Completed running scorer plugin" , "plugin" , name )
262+ debugLogger .Info ("Completed running scorer plugin" , "plugin" , typedName )
263263 }
264264 }
265265 verboseLogger .Info ("Completed running scorer plugins" )
@@ -284,27 +284,25 @@ func (p *ModelSelectorPipeline) runPickerPlugin(ctx context.Context, cycleState
284284 i ++
285285 }
286286
287- name := p .picker .TypedName ()
287+ typedName := p .picker .TypedName ()
288288 if verboseEnabled {
289- verboseLogger .Info ("Running picker plugin" , "plugin" , name )
289+ verboseLogger .Info ("Running picker plugin" , "plugin" , typedName )
290290 }
291- spanCtx , span := tracing .Tracer (modelSelectorTracerScope ).Start (ctx , "plugin." + name .Type ,
291+ spanCtx , span := tracing .Tracer (modelSelectorTracerScope ).Start (ctx , "plugin." + typedName .Type ,
292292 trace .WithSpanKind (trace .SpanKindInternal ),
293293 trace .WithAttributes (
294294 attribute .String ("llm_d.plugin.extension_point" , pickerExtensionPoint ),
295- attribute .String ("llm_d.plugin.type" , name .Type ),
296- attribute .String ("llm_d.plugin.name" , name .Name ),
295+ attribute .String ("llm_d.plugin.type" , typedName .Type ),
296+ attribute .String ("llm_d.plugin.name" , typedName .Name ),
297297 attribute .Int ("llm_d.picker.candidate_count" , len (scoredModels )),
298298 ))
299299 before := time .Now ()
300300 result := p .picker .Pick (spanCtx , cycleState , scoredModels )
301- metrics .RecordPluginProcessingLatency (pickerExtensionPoint , name .Type , name .Name , time .Since (before ))
302- if result != nil && result .TargetModel != nil {
303- span .SetAttributes (attribute .String ("llm_d.picker.selected_model" , result .TargetModel .GetName ()))
304- }
301+ metrics .RecordPluginProcessingLatency (pickerExtensionPoint , typedName .Type , typedName .Name , time .Since (before ))
302+ span .SetAttributes (attribute .String ("llm_d.picker.selected_model" , result .TargetModel .GetName ()))
305303 span .End ()
306304 if debugEnabled {
307- debugLogger .Info ("Completed running picker plugin" , "plugin" , name , "result" , result )
305+ debugLogger .Info ("Completed running picker plugin" , "plugin" , typedName , "result" , result )
308306 }
309307
310308 return result
0 commit comments