serve
serve copied to clipboard
Set request ID prefix via request header
Description
Implement #2292. If a request contains a value for header x-request-id-prefix
, this string is used as a prefix to the internal request id, which appears in logs and is returned in the response header x-request-id
. This can be useful for tracing individual requests in a multi-service architecture.
Type of change
- [x] New feature (non-breaking change which adds functionality)
- [x] This change requires a documentation update
Feature/Issue validation/testing
I have implemented a test testPredictionsRequestIdPrefixHeader
in ModelServerTest.java
, which makes a request with a header value x-request-id-prefix
and checks if it is the prefix of response header value x-request-id
.
The test can be reproduced by running ./gradlew clean test
in frontend/server
. I have also ran existing tests as well as spellcheck.sh
to ensure no new typos are introduced.
Checklist:
- [x] Did you have fun?
- [x] Have you added tests that prove your fix is effective or that this feature works?
- [x] Has code been commented, particularly in hard-to-understand areas?
- [x] Have you made corresponding changes to the documentation?
Note
This is my first feature PR. I plan to make more PRs in the future, so I would welcome any constructive feedback on the form of this PR to ensure that my future PRs will be useful.
I have added fcc
and ee
- which are parts of the example request ids used in the docs - to the spellcheck word list to make the test pass. However, I'm not sure if that's the best solution and would value any input on this.
Codecov Report
Merging #2347 (b0abcb1) into master (255a047) will decrease coverage by
0.66%
. The diff coverage isn/a
.
:exclamation: Current head b0abcb1 differs from pull request most recent head 93c9573. Consider uploading reports for the commit 93c9573 to get more accurate results
@@ Coverage Diff @@
## master #2347 +/- ##
==========================================
- Coverage 72.66% 72.01% -0.66%
==========================================
Files 78 78
Lines 3669 3648 -21
Branches 58 58
==========================================
- Hits 2666 2627 -39
- Misses 999 1017 +18
Partials 4 4
see 3 files with indirect coverage changes
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
@mpoemsl Thank you for the contribution. it looks good to me for the http part. Could you also add this feature on grpc side?
@mpoemsl Thank you for the contribution. it looks good to me for the http part. Could you also add this feature on grpc side?
Thanks! I'm not that familiar with gRPC, but I'll try to also implement the feature on that side.
@lxning should we still merge this without gRPC support to unblock OP?
@lxning should we still merge this without gRPC support to unblock OP?
That would also be okay for me! In terms of gRPC support, it's unclear to me to how to extract a HTTP header field with the existing libraries and if this makes sense at all. I haven't given up on it, but it's unlikely that I will be able to implement it soon.
Are there still plans to merge this?