snowplow / snowplow-java-tracker

Snowplow event tracker for Java. Add analytics to your Java desktop and server apps, servlets and games. (See also: snowplow-android-tracker)
http://snowplowanalytics.com
Apache License 2.0
23 stars 36 forks source link

Set default HTTP status codes not to retry on #337

Closed mscwilson closed 2 years ago

mscwilson commented 2 years ago

Related to Android tracker issue 518.

Since version 0.12.0, it has been possible to configure HTTP status codes which should not be retried (issue #316). This functionality relied on the developer providing a list of codes. It would be better to automatically not retry certain codes.

Instead of retrying collector requests for all non-2xx status codes, disable the retry functionality for the following HTTP status codes by default:

Code Description Rationale
400 Bad Request Server rejected to process the request due to an issue with it, trying again won't help.
401 Unauthorized (RFC 7235) Request is lacking correct authorization or refusing to process some IP address – intentional denial of request. Similar to 403 but specific to authorization issues.
403 Forbidden Server is refusing to take action, request should not be repeated.
410 Gone Indicates an intentional denial of the request as the resource was removed, request should not be retried and potentially the tracker should stop emitting events.
422 Unprocessable Entity (WebDAV; RFC 4918) Server was unable to process events in the request, should not be repeated without modification of the request.

All other non-2xx status codes should be retried on.

The list of HTTP status codes for which to retry or not-retry should be user customizable (e.g., the user should be able to force retries on 403 status code).