newrelic-telemetry-sdk-java
newrelic-telemetry-sdk-java copied to clipboard
Infinite retries on 413 http error
According to new relic docs, a 413 http status code is send when The payload was too big. Payloads must be under 1MB (10^6 bytes).
Currently, BatchDataSender throws a RetryWithSplitException in case of this status code https://github.com/newrelic/newrelic-telemetry-sdk-java/blob/c72d6ebc0e756efeb4bb59c34e6a22a5173c4998/telemetry-core/src/main/java/com/newrelic/telemetry/transport/BatchDataSender.java#L179-L185
And the TelemtryClient reacts by retrying the request with a split batch https://github.com/newrelic/newrelic-telemetry-sdk-java/blob/c72d6ebc0e756efeb4bb59c34e6a22a5173c4998/telemetry-core/src/main/java/com/newrelic/telemetry/TelemetryClient.java#L218-L220
Problem: If the batch size = 1, this ends in an infinite loop. Request should only be retried if batch can be split, so batch size > 1. Otherwise the payload is too big and there is no need for retrying.