Skip to content
This repository has been archived by the owner on Aug 30, 2019. It is now read-only.

writer: don't discard the client on api errors #257

Merged
merged 1 commit into from
Mar 31, 2017
Merged

Conversation

talwai
Copy link

@talwai talwai commented Mar 30, 2017

Our payload buffering logic passes along a stateful APIEndpoint
when it receives upstream errors. A prior PR ( #251 ) added a client
to individual APIEndpoints without propagating this value to the error handler

Thus when an endpoint flush failed, all future flushes would use the
zero value for APIEndpoint.client which is nil

Our payload buffering logic passes along a stateful `APIEndpoint`
when it receives upstream errors. A prior PR added a `client`
to individual APIEndpoints without propagating this value to the error handler

Thus when an endpoint flush failed, all future flushes would use the
zero value for `APIEndpoint.client` which is `nil`
Copy link

@ufoot ufoot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but would require another pair of eyes, since this is so obvious we missed it in the first place.

@@ -124,6 +128,11 @@ func (a *APIEndpoint) Write(p model.AgentPayload) (int, error) {

endpointErr := newAPIError()

// if this payload cannot be flushed due to API errors
// we need to pass the client along for future submissions
// FIXME(aaditya)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Short-term fix is fine IMHO but as we see this now only, probably no test is going through that path for real. This is beyond the scope of this PR anyway.

@@ -70,6 +70,7 @@ func NewWriter(conf *config.AgentConfig) *Writer {
if conf.Proxy != nil {
// we have some kind of proxy configured.
// make sure our http client uses it
log.Infof("configuring proxy through host %s", conf.Proxy.Host)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@ufoot ufoot added this to the 5.12.3 milestone Mar 31, 2017
@ufoot ufoot merged commit 8789afe into master Mar 31, 2017
@dtilghman dtilghman deleted the talwai/endpointfix branch April 1, 2017 05:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants