Skip to content
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

Handle all 2XX HTTP response status codes as success #324

Merged
merged 1 commit into from
May 14, 2024
Merged

Conversation

pondzix
Copy link
Contributor

@pondzix pondzix commented May 14, 2024

For HTTP target:

  • Before - only 200 HTTP response code was treated as successful response.
  • After - all 2XX are treated as successful response.

For HTTP target:

Before - only 200 HTTP response code was treated as successful response.
After - all 2XX are treated as successful response.
@@ -219,7 +219,7 @@ func (ht *HTTPTarget) Write(messages []*models.Message) (*models.TargetWriteResu
continue
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusOK {
if resp.StatusCode >= 200 && resp.StatusCode < 300 {
Copy link
Member

Choose a reason for hiding this comment

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

Should 3xx be treated as successful as well? I know in the Trackers a broad range of codes are seen as successful to ensure events do not get re-tried.

Copy link
Member

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

No, 3xx should not be treated as a success.

The go http client by default follows redirects, up to 10 times per request. So if we get a 3xx here then it means the server has issued 10 redirects in a row. That would be highly unexpected, it probably means the server is misconfigured, and it means our event has not landed safely in the destination.

Copy link
Member

Choose a reason for hiding this comment

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

That's fair! Feels like we might need a follow-on ticket to think through how to handle other status code groups though as currently all 3xx, 4xx and 5xx will end up being retried forever.

It might not be worth retrying certain codes forever and certain codes might not be worth retrying at all (like if we hit 3xx requests with 10+ redirects - is it worth retrying that event to have that very expensive flow followed again and again?)...

Copy link
Collaborator

Choose a reason for hiding this comment

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

@jbeemster yeah agree - it's beyond the scope of this ticket (which is just a quick fix for a customer issue), but the intention is to make this configurable, so that behaviour can be tailored to what's best suited to a given target.

I'm hoping to flesh this out in a design doc alongside other supportability work. :)

Copy link
Collaborator

@colmsnowplow colmsnowplow left a comment

Choose a reason for hiding this comment

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

LGTM! I like having response-code-specific tests. That'll be useful!

@pondzix pondzix merged commit 9f307e5 into develop May 14, 2024
1 check passed
@pondzix pondzix deleted the handle_2XX branch May 14, 2024 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants