Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine request context with parent receiver context #733

Merged
merged 1 commit into from
Oct 22, 2021

Conversation

benmoss
Copy link
Contributor

@benmoss benmoss commented Oct 22, 2021

PR #718 changed the handler to always receive the request context in
order to support middleware that alters the context. This however means
we lose any context values (loggers, etc) that are set on the outer
context.

This change introduces a delegating context that will prioritize the
child (request) context for values and cancellation, but fallback to the
parent context for missing values.

Fixes #732

@benmoss benmoss force-pushed the inheriting-contexts branch 3 times, most recently from a1a6be6 to 17cdb77 Compare October 22, 2021 16:37
PR cloudevents#718 changed the handler to always receive the request context in
order to support middleware that alters the context.  This however means
we lose any context values (loggers, etc) that are set on the outer
context.

This change introduces a delegating context that will prioritize the
child (request) context for values and cancellation, but fallback to the
parent context for missing values.

Signed-off-by: Ben Moss <benm@vmware.com>
@benmoss benmoss force-pushed the inheriting-contexts branch from 17cdb77 to 4d48d54 Compare October 22, 2021 16:37
Copy link
Member

@n3wscott n3wscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nicely done @benmoss

LGTM

@n3wscott n3wscott merged commit 2140c5a into cloudevents:main Oct 22, 2021
n3wscott pushed a commit that referenced this pull request Oct 22, 2021
PR #718 changed the handler to always receive the request context in
order to support middleware that alters the context.  This however means
we lose any context values (loggers, etc) that are set on the outer
context.

This change introduces a delegating context that will prioritize the
child (request) context for values and cancellation, but fallback to the
parent context for missing values.

Signed-off-by: Ben Moss <benm@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

With v0.2.6 release injected logger is not used anymore
2 participants