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

Add request_context flag to utilize (*http.Request).Context() in handlers #265

Merged
merged 4 commits into from
Jan 25, 2017

Conversation

tmc
Copy link
Collaborator

@tmc tmc commented Nov 20, 2016

This is a simplification of #251.

This PR adds the request_context flag which when true will utilize the incoming *http.Request's context when invoking grpc methods.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm.

@tmc
Copy link
Collaborator Author

tmc commented Nov 20, 2016

@kokaz can you comment here to pass the cla bot?

@zirkome
Copy link

zirkome commented Nov 20, 2016

I agreed to the CLA @googlebot

@tmc
Copy link
Collaborator Author

tmc commented Nov 20, 2016

Thanks @kokaz -- I want one more LGTM from another contributor before merging. ping @yugui @kazegusuri @achew22 @t-yuki

@achew22
Copy link
Collaborator

achew22 commented Nov 20, 2016

Is there a strategy for making this the default in the future or will it remain an optional feature?

Should we have a generated example with this turned on?

@tmc
Copy link
Collaborator Author

tmc commented Nov 20, 2016

I think this should become the default once we're okay with degrading 1.6 support.
I added testing this code path to the travisci configuration, I'm not certain adding a generated example provides that much value.

@zirkome
Copy link

zirkome commented Nov 30, 2016

@tmc Is there any progress on that?

@AmandaCameron
Copy link
Contributor

Any chance on getting this merged sometime soon? It'd be very helpful with stuff such as routing tracing through the grpc-gateway to the backend grpc service.

@achew22
Copy link
Collaborator

achew22 commented Jan 18, 2017

@tmc what information are you trying to get out of the HTTP request context that isn't available now?

@tmc
Copy link
Collaborator Author

tmc commented Jan 18, 2017

@achew22 i think a pretty good use-case is tracing (opentracing or google cloud trace)

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@AmandaCameron
Copy link
Contributor

Tracing is what my usecase is for this PR. It's easier to thread the nessary tracing information through a http middleware instead of a grpc serverinterceptor, and more clean, I feel. It'd also allow middleware to do whatever other context manupulation it wants.

Copy link
Member

@yugui yugui left a comment

Choose a reason for hiding this comment

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

LGTM with a comment -- I expect that this behavior will be enabled by default at some point because I did not do this just because req did not have Context().

I really love this PR and I believe this is the direction we should take.

@yugui yugui merged commit 41edff7 into grpc-ecosystem:master Jan 25, 2017
@tmc tmc deleted the request_context branch February 8, 2017 00:18
@tamalsaha tamalsaha mentioned this pull request Mar 30, 2017
1 task
adasari pushed a commit to adasari/grpc-gateway that referenced this pull request Apr 9, 2020
…lers (grpc-ecosystem#265)

* Add usage of http.Request's Context
* add request_context flag

Contribution by @kokaz, @tmc and @yugui
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.

6 participants