Skip to content

Commit

Permalink
pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdurham committed Oct 1, 2024
1 parent 8ab6a26 commit a638c1a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/component/prometheus/remote/queue/network/loop.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ type loop struct {
sendBuffer []byte
}

func newLoop(cc types.ConnectionConfig, isMetaData bool, log log.Logger, stats func(s types.NetworkStats)) *loop {
func newLoop(cc types.ConnectionConfig, isMetaData bool, l log.Logger, stats func(s types.NetworkStats)) *loop {
// TODO @mattdurham add TLS support afer the initial push.
return &loop{
isMeta: isMetaData,
// In general we want a healthy queue of items, in this case we want to have 2x our maximum send sized ready.
seriesMbx: actor.NewMailbox[*types.TimeSeriesBinary](actor.OptCapacity(2 * cc.BatchCount)),
client: &http.Client{},
cfg: cc,
log: log,
log: log.With(l, "name", "loop", "url", cc.URL),
statsFunc: stats,
externalLabels: cc.ExternalLabels,
ticker: time.NewTicker(1 * time.Second),
Expand Down Expand Up @@ -215,6 +215,7 @@ func (l *loop) send(ctx context.Context, retryCount int) sendResult {
defer resp.Body.Close()
// 500 errors are considered recoverable.
if resp.StatusCode/100 == 5 || resp.StatusCode == http.StatusTooManyRequests {
result.err = fmt.Errorf("server responded with status code %d", resp.StatusCode)
result.retryAfter = retryAfterDuration(l.cfg.RetryBackoff, resp.Header.Get("Retry-After"))
result.recoverableError = true
return result
Expand Down

0 comments on commit a638c1a

Please sign in to comment.