From d66cdcc9d1da1f547a194a3774e10b61e4583cda Mon Sep 17 00:00:00 2001 From: jay-dee7 Date: Fri, 29 Oct 2021 04:08:07 +0530 Subject: [PATCH] refactor: removed concurrent retry for failed log messages We've commented the code for concurrent retries for failed log messages. This was needed since we're flooding the NIC with too many requests and it causes unexpected behaviours Signed-off-by: jay-dee7 --- telemetry/fluent-bit/fluent_bit.go | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/telemetry/fluent-bit/fluent_bit.go b/telemetry/fluent-bit/fluent_bit.go index deeeaeaf..baccacc0 100644 --- a/telemetry/fluent-bit/fluent_bit.go +++ b/telemetry/fluent-bit/fluent_bit.go @@ -4,7 +4,6 @@ import ( "bytes" "context" "net/http" - "sync" "time" "github.com/containerish/OpenRegistry/config" @@ -17,10 +16,8 @@ type ( } fluentBit struct { - wg sync.WaitGroup client *http.Client retryMessages map[string]retryLogMsg - gate chan struct{} config *config.RegistryConfig } @@ -39,8 +36,6 @@ func New(config *config.RegistryConfig) (FluentBit, error) { fbClient := &fluentBit{ client: httpClient, config: config, - wg: sync.WaitGroup{}, - gate: make(chan struct{}, 5), retryMessages: make(map[string]retryLogMsg), } @@ -101,19 +96,12 @@ func (fb *fluentBit) retry() { // lets not do more than 5 req/second just to not flood our free instance of grafana cloud for range ticker.C { for id, logMsg := range fb.retryMessages { - fb.gate <- struct{}{} - fb.wg.Add(1) - go fb.retrier(logMsg.content, id) + fb.retrier(logMsg.content, id) } } } func (fb *fluentBit) retrier(logBytes []byte, id string) { - defer func() { - fb.wg.Done() - <-fb.gate - }() - // TODO - (@jay-dee7) what to do then? maybe have a different way to ship these logs? like via promtail? if msg, ok := fb.retryMessages[id]; ok && msg.count > 3 { delete(fb.retryMessages, id)