newrelic / newrelic-telemetry-sdk-java

Java library for sending telemetry data to New Relic
Apache License 2.0
40 stars 38 forks source link

Infinite retries on 413 http error #320

Open pschucker opened 1 month ago

pschucker commented 1 month ago

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.

workato-integration[bot] commented 1 month ago

https://new-relic.atlassian.net/browse/NR-273350