From 8fcac9f8f27fa24f9a0d74c6fb52d428c9d60026 Mon Sep 17 00:00:00 2001 From: nicklas dohrn Date: Thu, 12 Sep 2024 06:48:44 +0200 Subject: [PATCH] Rebase and adopt changes from upstream --- src/pkg/egress/syslog/https.go | 9 ++++----- src/pkg/egress/syslog/https_batch.go | 6 +++--- src/pkg/egress/syslog/https_batch_test.go | 4 ++-- src/pkg/ingress/bindings/filtered_binding_fetcher.go | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/pkg/egress/syslog/https.go b/src/pkg/egress/syslog/https.go index f1a6996b7..fae1fffaf 100644 --- a/src/pkg/egress/syslog/https.go +++ b/src/pkg/egress/syslog/https.go @@ -50,6 +50,7 @@ func (w *HTTPSWriter) sendHttpRequest(msg []byte, msgCount float64) error { req.SetBody(msg) resp := fasthttp.AcquireResponse() + defer fasthttp.ReleaseResponse(resp) err := w.client.Do(req, resp) if err != nil { @@ -100,12 +101,10 @@ func (*HTTPSWriter) Close() error { return nil } -func httpClient(netConf NetworkTimeoutConfig, tlsConf *tls.Config) *fasthttp.Client { +func httpClient(_ NetworkTimeoutConfig, tlsConf *tls.Config) *fasthttp.Client { return &fasthttp.Client{ - MaxConnsPerHost: 5, - MaxIdleConnDuration: 90 * time.Second, + MaxConnsPerHost: 100, + MaxIdleConnDuration: 10 * time.Second, TLSConfig: tlsConf, - ReadTimeout: 20 * time.Second, - WriteTimeout: 20 * time.Second, } } diff --git a/src/pkg/egress/syslog/https_batch.go b/src/pkg/egress/syslog/https_batch.go index 874fc9a1f..3fcd68ff7 100644 --- a/src/pkg/egress/syslog/https_batch.go +++ b/src/pkg/egress/syslog/https_batch.go @@ -5,12 +5,12 @@ import ( "crypto/tls" "time" - "code.cloudfoundry.org/go-loggregator/v9/rpc/loggregator_v2" + "code.cloudfoundry.org/go-loggregator/v10/rpc/loggregator_v2" metrics "code.cloudfoundry.org/go-metric-registry" "code.cloudfoundry.org/loggregator-agent-release/src/pkg/egress" ) -const BATCHSIZE = 256 * 1024 +const BATCHSIZE = 1024 * 1024 type HTTPSBatchWriter struct { HTTPSWriter @@ -39,7 +39,7 @@ func NewHTTPSBatchWriter( syslogConverter: c, }, batchSize: BATCHSIZE, - sendInterval: 1 * time.Second, + sendInterval: 3 * time.Second, egrMsgCount: 0, msgs: make(chan []byte), } diff --git a/src/pkg/egress/syslog/https_batch_test.go b/src/pkg/egress/syslog/https_batch_test.go index 2a328f9b9..6379c2d70 100644 --- a/src/pkg/egress/syslog/https_batch_test.go +++ b/src/pkg/egress/syslog/https_batch_test.go @@ -8,8 +8,8 @@ import ( "net/http/httptest" "time" - "code.cloudfoundry.org/go-loggregator/v9/rfc5424" - "code.cloudfoundry.org/go-loggregator/v9/rpc/loggregator_v2" + "code.cloudfoundry.org/go-loggregator/v10/rfc5424" + "code.cloudfoundry.org/go-loggregator/v10/rpc/loggregator_v2" metricsHelpers "code.cloudfoundry.org/go-metric-registry/testhelpers" "code.cloudfoundry.org/loggregator-agent-release/src/pkg/egress" "code.cloudfoundry.org/loggregator-agent-release/src/pkg/egress/syslog" diff --git a/src/pkg/ingress/bindings/filtered_binding_fetcher.go b/src/pkg/ingress/bindings/filtered_binding_fetcher.go index b3fda7fcd..0921c95c3 100644 --- a/src/pkg/ingress/bindings/filtered_binding_fetcher.go +++ b/src/pkg/ingress/bindings/filtered_binding_fetcher.go @@ -14,7 +14,7 @@ import ( //go:generate hel --type IPChecker -var allowedSchemes = []string{"syslog", "syslog-tls", "https"} +var allowedSchemes = []string{"syslog", "syslog-tls", "https", "https-batch"} type IPChecker interface { ResolveAddr(host string) (net.IP, error)