-
Notifications
You must be signed in to change notification settings - Fork 33
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
Common tracing and retry/backoff support for go-gather #1993
Common tracing and retry/backoff support for go-gather #1993
Conversation
9ff2ed0
to
d6089a2
Compare
Adds a `internal/http` package that can be used to configure HTTP clients with the default tracing, retry and backoff configuration. The configuration is applied to the internal OCI client abstraction for use in go-containerregistry.
Applies the common HTTP tracing, retry and backoff configuration to OCI and HTTP go-gather implementations.
Updates HTTP and OCI modules of go-gather.
d6089a2
to
0cc70f2
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1993 +/- ##
==========================================
+ Coverage 74.05% 74.25% +0.20%
==========================================
Files 87 88 +1
Lines 5716 5742 +26
==========================================
+ Hits 4233 4264 +31
+ Misses 1483 1478 -5
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave it a quick read. Lgtm, but maybe seek another review from a golang expert.
|
||
var _initialize = func() { | ||
if log.IsLevelEnabled(logrus.TraceLevel) { | ||
goci.Transport = http.NewTracingRoundTripperWithLogger(goci.Transport, log) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a follow up, we should use a solution that doesn't rely on global states. Besides being a safer approach it would also remove the need to use sync
. I understand that that would require changes in go-gather itself. Could you file a follow up issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return gather.Gather(ctx, source, destination) | ||
} | ||
|
||
var _initialize = func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be done during init
to avoid having to use sync.OnceFunc
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could not control it in tests then
More details in the commit messages. Adds a set of common variables used to configure the HTTP clients used by go-containerregistry and go-gather HTTP and OCI support via ORAS.
Requires enterprise-contract/go-gather#114 and enterprise-contract/go-gather#113 to be merged and versions to be bumped here.