serve icon indicating copy to clipboard operation
serve copied to clipboard

Set request ID prefix via request header

Open mpoemsl opened this issue 1 year ago • 7 comments

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.

mpoemsl avatar May 15 '23 21:05 mpoemsl

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.

mpoemsl avatar May 15 '23 21:05 mpoemsl

Codecov Report

Merging #2347 (b0abcb1) into master (255a047) will decrease coverage by 0.66%. The diff coverage is n/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

codecov[bot] avatar May 15 '23 21:05 codecov[bot]

@mpoemsl Thank you for the contribution. it looks good to me for the http part. Could you also add this feature on grpc side?

lxning avatar Jun 12 '23 21:06 lxning

@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.

mpoemsl avatar Jun 14 '23 18:06 mpoemsl

@lxning should we still merge this without gRPC support to unblock OP?

msaroufim avatar Jul 21 '23 22:07 msaroufim

@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.

mpoemsl avatar Jul 25 '23 18:07 mpoemsl

Are there still plans to merge this?

mhashas avatar Jan 30 '24 13:01 mhashas