jina-ai / jina

☁️ Build multimodal AI applications with cloud-native stack
https://docs.jina.ai
Apache License 2.0
20.54k stars 2.21k forks source link

feat: pass request-headers as metadata #6126

Open NarekA opened 7 months ago

NarekA commented 7 months ago

This PR is attempts to implement the solution in the discussion of https://github.com/jina-ai/jina/issues/6049. It adds a new parameter metadata for jina endpoints which can be used to pass in http headers or GRPC metadata.

This PR only implements the http headers, GRPC metadata will have to be done in a separate PR

Goals:

TODO:

codecov[bot] commented 7 months ago

Codecov Report

Attention: 14 lines in your changes are missing coverage. Please review.

Comparison is base (9eb4d09) 72.61% compared to head (2856423) 49.55%. Report is 2 commits behind head on master.

Files Patch % Lines
jina/serve/runtimes/gateway/streamer.py 0.00% 8 Missing :warning:
jina/serve/runtimes/worker/http_fastapi_app.py 0.00% 4 Missing :warning:
...ve/runtimes/gateway/http_fastapi_app_docarrayv2.py 0.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #6126 +/- ## =========================================== - Coverage 72.61% 49.55% -23.06% =========================================== Files 152 150 -2 Lines 14061 14027 -34 =========================================== - Hits 10210 6951 -3259 - Misses 3851 7076 +3225 ``` | [Flag](https://app.codecov.io/gh/jina-ai/jina/pull/6126/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=jina-ai) | Coverage Δ | | |---|---|---| | [jina](https://app.codecov.io/gh/jina-ai/jina/pull/6126/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=jina-ai) | `49.55% <12.50%> (-23.06%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=jina-ai#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

NarekA commented 6 months ago

@JoanFM I'm happy to change the parameter to headers, but I'm afraid it's too close to header which I've noticed is used for passing request_id during orchestration. How about request_headers?

JoanFM commented 6 months ago

@JoanFM I'm happy to change the parameter to headers, but I'm afraid it's too close to header which I've noticed is used for passing request_id during orchestration. How about request_headers?

it does not matter, header is something that is quite hidden from the Executor developer. I would still use headers