Skip to content

Commit 0174f0b

Browse files
Fix typo in variable names
1 parent 4adf72e commit 0174f0b

File tree

7 files changed

+36
-36
lines changed

7 files changed

+36
-36
lines changed

pkg/epp/handlers/response.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func (s *StreamingServer) HandleResponseHeaders(ctx context.Context, reqCtx *Req
9393
}
9494
}
9595

96-
reqCtx, err := s.director.HandleResponseRecieved(ctx, reqCtx)
96+
reqCtx, err := s.director.HandleResponseReceived(ctx, reqCtx)
9797

9898
return reqCtx, err
9999
}

pkg/epp/handlers/server.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func NewStreamingServer(datastore Datastore, director Director) *StreamingServer
5454

5555
type Director interface {
5656
HandleRequest(ctx context.Context, reqCtx *RequestContext) (*RequestContext, error)
57-
HandleResponseRecieved(ctx context.Context, reqCtx *RequestContext) (*RequestContext, error)
57+
HandleResponseReceived(ctx context.Context, reqCtx *RequestContext) (*RequestContext, error)
5858
HandleResponseBodyStreaming(ctx context.Context, reqCtx *RequestContext) (*RequestContext, error)
5959
HandleResponseBodyComplete(ctx context.Context, reqCtx *RequestContext) (*RequestContext, error)
6060
GetRandomPod() *backend.Pod
@@ -123,7 +123,7 @@ const (
123123
HeaderRequestResponseComplete StreamRequestState = 1
124124
BodyRequestResponsesComplete StreamRequestState = 2
125125
TrailerRequestResponsesComplete StreamRequestState = 3
126-
ResponseRecieved StreamRequestState = 4
126+
ResponseReceived StreamRequestState = 4
127127
HeaderResponseResponseComplete StreamRequestState = 5
128128
BodyResponseResponsesComplete StreamRequestState = 6
129129
TrailerResponseResponsesComplete StreamRequestState = 7
@@ -253,7 +253,7 @@ func (s *StreamingServer) Process(srv extProcPb.ExternalProcessor_ProcessServer)
253253
loggerTrace.Info("model server is streaming response")
254254
}
255255
}
256-
reqCtx.RequestState = ResponseRecieved
256+
reqCtx.RequestState = ResponseReceived
257257

258258
var responseErr error
259259
reqCtx, responseErr = s.HandleResponseHeaders(ctx, reqCtx, v)
@@ -379,7 +379,7 @@ func (r *RequestContext) updateStateAndSendIfNeeded(srv extProcPb.ExternalProces
379379
return status.Errorf(codes.Unknown, "failed to send response back to Envoy: %v", err)
380380
}
381381
}
382-
if r.RequestState == ResponseRecieved && r.respHeaderResp != nil {
382+
if r.RequestState == ResponseReceived && r.respHeaderResp != nil {
383383
loggerTrace.Info("Sending response header response", "obj", r.respHeaderResp)
384384
if err := srv.Send(r.respHeaderResp); err != nil {
385385
return status.Errorf(codes.Unknown, "failed to send response back to Envoy: %v", err)

pkg/epp/requestcontrol/director.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func NewDirectorWithConfig(datastore Datastore, scheduler Scheduler, saturationD
6666
scheduler: scheduler,
6767
saturationDetector: saturationDetector,
6868
preRequestPlugins: config.preRequestPlugins,
69-
postResponseRecievedPlugins: config.postResponseRecievedPlugins,
69+
postResponseReceivedPlugins: config.postResponseReceivedPlugins,
7070
postResponseStreamingPlugins: config.postResponseStreamingPlugins,
7171
postResponseCompletePlugins: config.postResponseCompletePlugins,
7272
defaultPriority: 0, // define default priority explicitly
@@ -79,7 +79,7 @@ type Director struct {
7979
scheduler Scheduler
8080
saturationDetector SaturationDetector
8181
preRequestPlugins []PreRequest
82-
postResponseRecievedPlugins []PostResponseRecieved
82+
postResponseReceivedPlugins []PostResponseReceived
8383
postResponseStreamingPlugins []PostResponseStreaming
8484
postResponseCompletePlugins []PostResponseComplete
8585
// we just need a pointer to an int variable since priority is a pointer in InferenceObjective
@@ -282,16 +282,16 @@ func (d *Director) toSchedulerPodMetrics(pods []backendmetrics.PodMetrics) []sch
282282
return pm
283283
}
284284

285-
// HandleResponseRecieved is called when the first chunk of the response arrives.
286-
func (d *Director) HandleResponseRecieved(ctx context.Context, reqCtx *handlers.RequestContext) (*handlers.RequestContext, error) {
285+
// HandleResponseReceived is called when the first chunk of the response arrives.
286+
func (d *Director) HandleResponseReceived(ctx context.Context, reqCtx *handlers.RequestContext) (*handlers.RequestContext, error) {
287287
response := &Response{
288288
RequestId: reqCtx.Request.Headers[requtil.RequestIdHeaderKey],
289289
Headers: reqCtx.Response.Headers,
290290
}
291291

292292
// TODO: to extend fallback functionality, handle cases where target pod is unavailable
293293
// https://github.com/kubernetes-sigs/gateway-api-inference-extension/issues/1224
294-
d.runPostResponseRecievedPlugins(ctx, reqCtx.SchedulingRequest, response, reqCtx.TargetPod)
294+
d.runPostResponseReceivedPlugins(ctx, reqCtx.SchedulingRequest, response, reqCtx.TargetPod)
295295

296296
return reqCtx, nil
297297
}
@@ -347,13 +347,13 @@ func (d *Director) runPreRequestPlugins(ctx context.Context, request *scheduling
347347
}
348348
}
349349

350-
func (d *Director) runPostResponseRecievedPlugins(ctx context.Context, request *schedulingtypes.LLMRequest, response *Response, targetPod *backend.Pod) {
350+
func (d *Director) runPostResponseReceivedPlugins(ctx context.Context, request *schedulingtypes.LLMRequest, response *Response, targetPod *backend.Pod) {
351351
loggerDebug := log.FromContext(ctx).V(logutil.DEBUG)
352-
for _, plugin := range d.postResponseRecievedPlugins {
352+
for _, plugin := range d.postResponseReceivedPlugins {
353353
loggerDebug.Info("Running post-response plugin", "plugin", plugin.TypedName())
354354
before := time.Now()
355-
plugin.PostResponseRecieved(ctx, request, response, targetPod)
356-
metrics.RecordPluginProcessingLatency(PostResponseRecievedExtensionPoint, plugin.TypedName().Type, plugin.TypedName().Name, time.Since(before))
355+
plugin.PostResponseReceived(ctx, request, response, targetPod)
356+
metrics.RecordPluginProcessingLatency(PostResponseReceivedExtensionPoint, plugin.TypedName().Type, plugin.TypedName().Name, time.Since(before))
357357
loggerDebug.Info("Completed running post-response plugin successfully", "plugin", plugin.TypedName())
358358
}
359359
}

pkg/epp/requestcontrol/director_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -592,13 +592,13 @@ func TestGetRandomPod(t *testing.T) {
592592
}
593593
}
594594

595-
func TestDirector_HandleResponseRecieved(t *testing.T) {
596-
pr1 := newTestPostResponseRecieved("pr1")
595+
func TestDirector_HandleResponseReceived(t *testing.T) {
596+
pr1 := newTestPostResponseReceived("pr1")
597597

598598
ctx := logutil.NewTestLoggerIntoContext(context.Background())
599599
ds := datastore.NewDatastore(t.Context(), nil)
600600
mockSched := &mockScheduler{}
601-
director := NewDirectorWithConfig(ds, mockSched, nil, NewConfig().WithPostResponseRecievedPlugins(pr1))
601+
director := NewDirectorWithConfig(ds, mockSched, nil, NewConfig().WithPostResponseReceivedPlugins(pr1))
602602

603603
reqCtx := &handlers.RequestContext{
604604
Request: &handlers.Request{
@@ -613,7 +613,7 @@ func TestDirector_HandleResponseRecieved(t *testing.T) {
613613
TargetPod: &backend.Pod{NamespacedName: types.NamespacedName{Namespace: "namespace1", Name: "test-pod-name"}},
614614
}
615615

616-
_, err := director.HandleResponseRecieved(ctx, reqCtx)
616+
_, err := director.HandleResponseReceived(ctx, reqCtx)
617617
if err != nil {
618618
t.Fatalf("HandleResponse() returned unexpected error: %v", err)
619619
}
@@ -702,12 +702,12 @@ func TestDirector_HandleResponseComplete(t *testing.T) {
702702
}
703703

704704
const (
705-
testPostResponseRecievedType = "test-post-response"
705+
testPostResponseReceivedType = "test-post-response"
706706
testPostStreamingType = "test-post-streaming"
707707
testPostCompleteType = "test-post-complete"
708708
)
709709

710-
type testPostResponseRecieved struct {
710+
type testPostResponseReceived struct {
711711
tn plugins.TypedName
712712
lastRespOnResponse *Response
713713
lastTargetPodOnResponse string
@@ -725,9 +725,9 @@ type testPostResponseComplete struct {
725725
lastTargetPodOnComplete string
726726
}
727727

728-
func newTestPostResponseRecieved(name string) *testPostResponseRecieved {
729-
return &testPostResponseRecieved{
730-
tn: plugins.TypedName{Type: testPostResponseRecievedType, Name: name},
728+
func newTestPostResponseReceived(name string) *testPostResponseReceived {
729+
return &testPostResponseReceived{
730+
tn: plugins.TypedName{Type: testPostResponseReceivedType, Name: name},
731731
}
732732
}
733733

@@ -743,7 +743,7 @@ func newTestPostResponseComplete(name string) *testPostResponseComplete {
743743
}
744744
}
745745

746-
func (p *testPostResponseRecieved) TypedName() plugins.TypedName {
746+
func (p *testPostResponseReceived) TypedName() plugins.TypedName {
747747
return p.tn
748748
}
749749

@@ -755,7 +755,7 @@ func (p *testPostResponseComplete) TypedName() plugins.TypedName {
755755
return p.tn
756756
}
757757

758-
func (p *testPostResponseRecieved) PostResponseRecieved(_ context.Context, _ *schedulingtypes.LLMRequest, response *Response, targetPod *backend.Pod) {
758+
func (p *testPostResponseReceived) PostResponseReceived(_ context.Context, _ *schedulingtypes.LLMRequest, response *Response, targetPod *backend.Pod) {
759759
p.lastRespOnResponse = response
760760
p.lastTargetPodOnResponse = targetPod.NamespacedName.String()
761761
}

pkg/epp/requestcontrol/plugins.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626

2727
const (
2828
PreRequestExtensionPoint = "PreRequest"
29-
PostResponseRecievedExtensionPoint = "PostResponseRecieved"
29+
PostResponseReceivedExtensionPoint = "PostResponseReceived"
3030
PostResponseStreamingExtensionPoint = "PostResponseStreaming"
3131
PostResponseCompleteExtensionPoint = "PostResponseComplete"
3232
)
@@ -38,11 +38,11 @@ type PreRequest interface {
3838
PreRequest(ctx context.Context, request *types.LLMRequest, schedulingResult *types.SchedulingResult, targetPort int)
3939
}
4040

41-
// PostResponseRecieved is called by the director after a successful response is sent.
41+
// PostResponseReceived is called by the director after a successful response is sent.
4242
// The given pod argument is the pod that served the request.
43-
type PostResponseRecieved interface {
43+
type PostResponseReceived interface {
4444
plugins.Plugin
45-
PostResponseRecieved(ctx context.Context, request *types.LLMRequest, response *Response, targetPod *backend.Pod)
45+
PostResponseReceived(ctx context.Context, request *types.LLMRequest, response *Response, targetPod *backend.Pod)
4646
}
4747

4848
// PostResponseStreaming is called by the director after each chunk of streaming response is sent.

pkg/epp/requestcontrol/request_control_config.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
func NewConfig() *Config {
2525
return &Config{
2626
preRequestPlugins: []PreRequest{},
27-
postResponseRecievedPlugins: []PostResponseRecieved{},
27+
postResponseReceivedPlugins: []PostResponseReceived{},
2828
postResponseStreamingPlugins: []PostResponseStreaming{},
2929
postResponseCompletePlugins: []PostResponseComplete{},
3030
}
@@ -33,7 +33,7 @@ func NewConfig() *Config {
3333
// Config provides a configuration for the requestcontrol plugins.
3434
type Config struct {
3535
preRequestPlugins []PreRequest
36-
postResponseRecievedPlugins []PostResponseRecieved
36+
postResponseReceivedPlugins []PostResponseReceived
3737
postResponseStreamingPlugins []PostResponseStreaming
3838
postResponseCompletePlugins []PostResponseComplete
3939
}
@@ -47,8 +47,8 @@ func (c *Config) WithPreRequestPlugins(plugins ...PreRequest) *Config {
4747

4848
// WithPostResponsePlugins sets the given plugins as the PostResponse plugins.
4949
// If the Config has PostResponse plugins already, this call replaces the existing plugins with the given ones.
50-
func (c *Config) WithPostResponseRecievedPlugins(plugins ...PostResponseRecieved) *Config {
51-
c.postResponseRecievedPlugins = plugins
50+
func (c *Config) WithPostResponseReceivedPlugins(plugins ...PostResponseReceived) *Config {
51+
c.postResponseReceivedPlugins = plugins
5252
return c
5353
}
5454

@@ -75,8 +75,8 @@ func (c *Config) AddPlugins(pluginObjects ...plugins.Plugin) {
7575
if preRequestPlugin, ok := plugin.(PreRequest); ok {
7676
c.preRequestPlugins = append(c.preRequestPlugins, preRequestPlugin)
7777
}
78-
if postResponseRecievedPlugin, ok := plugin.(PostResponseRecieved); ok {
79-
c.postResponseRecievedPlugins = append(c.postResponseRecievedPlugins, postResponseRecievedPlugin)
78+
if postResponseReceivedPlugin, ok := plugin.(PostResponseReceived); ok {
79+
c.postResponseReceivedPlugins = append(c.postResponseReceivedPlugins, postResponseReceivedPlugin)
8080
}
8181
if postResponseStreamingPlugin, ok := plugin.(PostResponseStreaming); ok {
8282
c.postResponseStreamingPlugins = append(c.postResponseStreamingPlugins, postResponseStreamingPlugin)

pkg/epp/server/server_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func (ts *testDirector) HandleRequest(ctx context.Context, reqCtx *handlers.Requ
181181
return reqCtx, nil
182182
}
183183

184-
func (ts *testDirector) HandleResponseRecieved(ctx context.Context, reqCtx *handlers.RequestContext) (*handlers.RequestContext, error) {
184+
func (ts *testDirector) HandleResponseReceived(ctx context.Context, reqCtx *handlers.RequestContext) (*handlers.RequestContext, error) {
185185
return reqCtx, nil
186186
}
187187

0 commit comments

Comments
 (0)