-
Notifications
You must be signed in to change notification settings - Fork 182
fix(http): instantiate the http.Transport
for connection limits
#376
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
base: master
Are you sure you want to change the base?
Conversation
c0feb28
to
bb8f471
Compare
@blakepettersson if I try to pass in those numbers as parameters to the NewTransport function, there will be a lot of services to be changed/ get impacted. Any input plz. |
@afzal442 yes indeed, but I don't think it's a bad idea to be allowed to set those http settings for any service that make use of it. So we can expand this task to allow all affected services to set these |
2738341
to
2f5f64d
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #376 +/- ##
==========================================
- Coverage 55.35% 54.61% -0.74%
==========================================
Files 35 46 +11
Lines 3438 4202 +764
==========================================
+ Hits 1903 2295 +392
- Misses 1256 1562 +306
- Partials 279 345 +66 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
800ebff
to
d3dfddf
Compare
@afzal442 can you
|
To verify this further, do I need to create instances and check against it using argocd CLI locally on this branch? |
So you'll need to setup a local copy of Argo CD. You'll need to configure github.com/argoproj/gitops-engine => github.com/afzal442/notifications-engine <your latest commit on this PR> then run Ideally we should check that setting up notifications both work without setting the new fields as well as by setting the new fields (to ensure we haven't broken anything). |
go mod tidy
|
@afzal442 what does your You should have a module github.com/argoproj/argo-cd/v3
go 1.24.3
require (
github.com/argoproj/notifications-engine v0.4.1-0.20250309174002-87bf0576a872
// Other requires snipped for brevity
)
// Other requires snipped for brevity
replace (
github.com/argoproj/notifications-engine => github.com/afzal442/notifications-engine d3dfddfec1fb8b2e9ce7af27317d42e880aa676a
// Other replaces snipped for brevity
) Once it looks like that, you can run |
Thanks! but any help on how I can set up notifications with setting the new fields. Do I need to setup Github notification svc? any further test? |
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.
Hey @afzal442, sorry for the (very) late review 😞
I gave this a spin and it generally LGTM, with the exception that duration strings cannot be directly parsed with Golang's JSON parser (that's on me, I thought that worked). So basically you will need to use strings and handle the conversions manually.
There's also a minor section where the wrong parameter is used.
Beyond that, could we get some docs documenting these values where applicable? Otherwise LGTM!
hey @blakepettersson any idea why this test is failing here https://github.com/argoproj/notifications-engine/actions/runs/16178565279/job/45669510709?pr=376#step:7:17? |
@afzal442 yes, before parsing the conn timeouts you need to check if the conn timeout is an empty string. If it's empty don't parse |
40c5811
to
9854d6e
Compare
How about making a separate PR for this? |
@afzal442, no these changes need to be documented in this PR, given that there are a bunch of parameters which are important to know about. |
0e908bc
to
0da98d1
Compare
037ea8b
to
01a91bd
Compare
43bc138
to
493a8e1
Compare
@afzal442 this looks good to me in general Before merging this, I believe you should do the following:
|
Looks good, but i would try to move transport creation in single place, otherwise we need to duplicate it in every provider |
@afzal442 do you have further thoughts regarding what Pasha said? |
sure! I think that makes sense. But I'll need to apply the suggestions it in order to check this. |
I tried moving the transport as a new helper function like below, but need your thoughts whether that is feasible; I'd create this inside transport.go and use it as a helper
|
@afzal442 yes, something like this should work func NewServiceHTTPClient(maxIdleConns, maxIdleConnsPerHost, maxConnsPerHost int, idleConnTimeout, serviceName string, insecureSkipVerify bool, apiURL string) (client *http.Client, err error) {
var timeout time.Duration
if idleConnTimeout != "" {
timeout, err = time.ParseDuration(idleConnTimeout)
if err != nil {
return nil, fmt.Errorf("failed to parse idle connection timeout: %w", err)
}
}
transport := httputil.NewTransport(apiURL, maxIdleConns, maxIdleConnsPerHost, maxConnsPerHost, timeout, insecureSkipVerify)
return &http.Client{
Transport: httputil.NewLoggingRoundTripper(transport, log.WithField("service", serviceName)),
}, nil
} |
Signed-off-by: Afzal Ansari <[email protected]>
Signed-off-by: Afzal Ansari <[email protected]>
Signed-off-by: Afzal Ansari <[email protected]>
Signed-off-by: Afzal Ansari <[email protected]>
Signed-off-by: Afzal Ansari <[email protected]>
Signed-off-by: Afzal Ansari <[email protected]>
Signed-off-by: Afzal Ansari <[email protected]>
Signed-off-by: Afzal Ansari <[email protected]>
Signed-off-by: Afzal Ansari <[email protected]>
Signed-off-by: Afzal Ansari <[email protected]>
Signed-off-by: Afzal Ansari <[email protected]>
Signed-off-by: Afzal Ansari <[email protected]>
Signed-off-by: Afzal Ansari <[email protected]>
Signed-off-by: Afzal Ansari <[email protected]>
* Adding info about template Signed-off-by: lrochette <[email protected]> * signing off Signed-off-by: lrochette <[email protected]> --------- Signed-off-by: lrochette <[email protected]> Signed-off-by: Afzal Ansari <[email protected]>
There's a major upgrade of it. This is an initial upgrade to make the changes as minimal as possible. Signed-off-by: Blake Pettersson <[email protected]> Co-authored-by: Michael Crenshaw <[email protected]> Signed-off-by: Afzal Ansari <[email protected]>
Try to slowly converge towards what exists on argo-cd. Signed-off-by: Blake Pettersson <[email protected]> Signed-off-by: Afzal Ansari <[email protected]>
Signed-off-by: Afzal Ansari <[email protected]>
74f642c
to
57306f0
Compare
For #22800