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

pass X-Request-ID from upstream #4026

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

liubin
Copy link
Contributor

@liubin liubin commented Aug 29, 2023

This will get X-Request-ID from the caller and write to http.request.id filed in the log for distributed debugging purpose.

Related #1607 #1479, these two issues are serval years ago, I'm not sure this PR can fix these or give some hint to them.

Signed-off-by: bin liu <liubin0329@gmail.com>
@codecov-commenter
Copy link

codecov-commenter commented Aug 29, 2023

Codecov Report

Patch coverage: 57.14% and project coverage change: +0.34% 🎉

Comparison is base (1284c48) 57.70% compared to head (4609bb0) 58.04%.
Report is 164 commits behind head on main.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4026      +/-   ##
==========================================
+ Coverage   57.70%   58.04%   +0.34%     
==========================================
  Files         108      106       -2     
  Lines       10532    10360     -172     
==========================================
- Hits         6077     6013      -64     
+ Misses       3781     3683      -98     
+ Partials      674      664      -10     
Files Changed Coverage Δ
context/http.go 64.73% <57.14%> (-0.53%) ⬇️

... and 11 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@milosgajdos
Copy link
Member

milosgajdos commented Aug 29, 2023

I am not sure if moby is setting this; IIRC moby uses https://github.com/distribution/distribution/tree/5f8b59177b672011779a91143a2d2454e4fab2fd/registry/client client in its code, so if this header is not being set in it I see no point for this PR.

I wouldnt be against adding it to the client code, though. CC: @thaJeztah

// getXRequestID get X-Request-ID from HTTP header
// or generate an UUID if not found in header
func getXRequestID(r *http.Request) string {
rid := r.Header.Get("X-Request-ID")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you have a source for the specification of X-Request-ID field? Is it defined in the OCI spec?

@liubin
Copy link
Contributor Author

liubin commented Sep 6, 2023

@wy65701436 It's not an OCI request, it's a unofficial header, https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
@milosgajdos The clients are not limited to moby, in other tools, like harbor, it will proxy requests to distribution behind it.

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.

None yet

4 participants