Skip to content

[chore] [exporter/splunk_hec] Remove dead code #38113

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions exporter/splunkhecexporter/hec_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,9 @@ func (hec *defaultHecWorker) send(ctx context.Context, buf buffer, headers map[s
return err
}

// Do not drain the response when 429 or 502 status code is returned.
// HTTP client will not reuse the same connection unless it is drained.
// See https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/18281 for more details.
if resp.StatusCode != http.StatusTooManyRequests && resp.StatusCode != http.StatusBadGateway {
if _, errCopy := io.Copy(io.Discard, resp.Body); errCopy != nil {
return errCopy
}
}
return nil
// Drain the response body to avoid leaking connections.
_, errCopy := io.Copy(io.Discard, resp.Body)
return errCopy // TODO: Do not return error here. Draining errors is not a failure in data sending.
}

var _ hecWorker = &defaultHecWorker{}
Loading