@@ -107,6 +107,10 @@ func (s *SLOAwareRouter) deleteSLOContextForRequest(request *schedulingtypes.LLM
107107
108108func (t * SLOAwareRouter ) PreRequest (ctx context.Context , request * schedulingtypes.LLMRequest , schedulingResult * schedulingtypes.SchedulingResult ) {
109109 logger := log .FromContext (ctx )
110+ if request == nil {
111+ logger .V (logutil .DEBUG ).Info ("SLOAwareRouter.PreRequest: request is nil, skipping" )
112+ return
113+ }
110114
111115 if schedulingResult == nil || len (schedulingResult .ProfileResults ) == 0 {
112116 logger .V (logutil .TRACE ).Info ("SLOAwareRouter: Skipping PreRequest because no scheduling result was provided." )
@@ -157,6 +161,10 @@ func (t *SLOAwareRouter) PreRequest(ctx context.Context, request *schedulingtype
157161
158162func (t * SLOAwareRouter ) ResponseReceived (ctx context.Context , request * schedulingtypes.LLMRequest , response * requestcontrol.Response , targetPod * backend.Pod ) {
159163 logger := log .FromContext (ctx )
164+ if request == nil {
165+ logger .V (logutil .DEBUG ).Info ("SLOAwareRouter.ResponseReceived: request is nil, skipping" )
166+ return
167+ }
160168 if ! t .checkPredictor (logger , targetPod ) {
161169 return
162170 }
@@ -177,6 +185,10 @@ func (t *SLOAwareRouter) ResponseReceived(ctx context.Context, request *scheduli
177185
178186func (t * SLOAwareRouter ) ResponseStreaming (ctx context.Context , request * schedulingtypes.LLMRequest , response * requestcontrol.Response , pod * backend.Pod ) {
179187 logger := log .FromContext (ctx )
188+ if request == nil {
189+ logger .V (logutil .DEBUG ).Info ("SLOAwareRouter.ResponseStreaming: request is nil, skipping" )
190+ return
191+ }
180192 if ! t .checkPredictor (logger , pod ) || response .EndOfStream {
181193 return
182194 }
@@ -199,6 +211,10 @@ func (t *SLOAwareRouter) ResponseStreaming(ctx context.Context, request *schedul
199211
200212func (t * SLOAwareRouter ) ResponseComplete (ctx context.Context , request * schedulingtypes.LLMRequest , response * requestcontrol.Response , pod * backend.Pod ) {
201213 logger := log .FromContext (ctx )
214+ if request == nil {
215+ logger .V (logutil .DEBUG ).Info ("SLOAwareRouter.ResponseComplete: request is nil, skipping" )
216+ return
217+ }
202218 targetPod := pod
203219 if ! t .checkPredictor (logger , targetPod ) {
204220 return
0 commit comments