-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Best Way to Pass Request Headers to Executor #6049
Comments
Hey @NarekA, This is the only way for the moment. May I ask what is the intended usage you want for this feature? |
Our service hits multiple remote deployments of the same model, and we want the ability to use fields in the request headers to determine which deployment the user hits. We can use parameters, but those are easier to spoof and are not auto-populated. In addition, there are some observability data in our headers which would be useful. |
Right now we do not have this chance. It would be interesting to understand how you would imagine this happening for you? How would u expect this to work? Would u get them in the Executor? Regardless of the protocol? how would the Jina Client work with them? |
It would be nice if we could just set argument For the client, we could add an argument for Alternatively, we could copy the flask approach and create a request context: from flask import Flask, request
@app.route('/query-example')
def query_example():
# if key doesn't exist, returns None
language = request.args.get('language') We need the request context for the same reasons any web application might need request context, building a gateway proxy just to get access to basic request parameters seems like overkill. |
Makes sense, I will try to work on it when I get the time. Thank you very much for the proposal |
@JoanFM I might be able to give this a shot. I assume most of the changes would be in the |
yes, but I would like to first discuss the user experience. Also it should be something u could enjoy from Grpc serving as metadata. |
That's a good idea, do we want to?
I like the first option because it will give users additional metadata such as |
I would limit the scope to headers, otherwise user would expect in Requests to get all the data, and this is something I want to hide, because I think is still good to simply get docarray in and out as the basic operatio s. |
That makes it easier as both headers and GRPC metadata can be passed in as dictionaries. We can have an optional argument called |
yes this looks reasonable. |
Looks like we're moving towards consensus (headers and gRPC metadata in a unified What will it take to get this into the framework? |
I will see if I can get this prioritized, we are currently using a workaround (of passing header values as inputs) but it's not ideal. |
@jina-ai/product This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 14 days |
@jina-ai/product This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 14 days |
Describe your proposal/problem
I've been looking for a way to pass http request headers to my Executor, and this is the only way I've been able to do it.
Is there a simpler way to do this? The approach above only works for flows, is there a way that works for deployments?
Environment
PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6020
The text was updated successfully, but these errors were encountered: