Skip to content

Commit

Permalink
Send down the labels into the dispatch requests from the lazy router
Browse files Browse the repository at this point in the history
  • Loading branch information
Krithika Sundararajan committed Nov 3, 2022
1 parent d2dc9aa commit 0aa265c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ var (
CtxComponentIDKey CtxKey = "CTX_COMPONENT_ID"
// CtxComponentKindKey is used to denote the component's kind in the request context
CtxComponentKindKey CtxKey = "CTX_COMPONENT_KIND"
// CtxComponentLabelsKey is used to denote the component's labels in the request context
CtxComponentLabelsKey CtxKey = "CTX_COMPONENT_LABELS"
)

// Interceptor is the interface for a structural interceptor
Expand Down
2 changes: 1 addition & 1 deletion lazy_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (r *LazyRouter) Dispatch(ctx context.Context, req Request) ResponseQueue {
for _, route := range routes {
copyReq, _ := req.Clone()
responses := make([]Response, 0)
responseCh := route.Dispatch(ctx, copyReq).Iter()
responseCh := route.Dispatch(context.WithValue(ctx, CtxComponentLabelsKey, labels), copyReq).Iter()
ok := true
for ok {
select {
Expand Down

0 comments on commit 0aa265c

Please sign in to comment.