newrelic-telemetry-sdk-java icon indicating copy to clipboard operation
newrelic-telemetry-sdk-java copied to clipboard

Not handled error response codes by BatchDataSender

Open Sidburse opened this issue 2 years ago • 3 comments

Response codes 400, 403, 404, 405 and 411 are not handled separately by the BatchDataSender. Instead a common DiscardBatchException is thrown to handle these response codes. https://github.com/newrelic/newrelic-telemetry-sdk-java/blob/60fb68d4793da37b55d47b342c62f9c7f962ed13/telemetry-core/src/main/java/com/newrelic/telemetry/transport/BatchDataSender.java#L167

Also, is there a New Relic validation endpoint that can be accessed to test validity of credentials while accessing New Relic?

(Migrate to Jira)

Sidburse avatar May 11 '22 10:05 Sidburse

@Sidburse thanks for letting us know about this issue - what's the impact of this issue on what you're trying to accomplish?

Not sure whether there's an endpoint specifically for credential testing but will check...

kford-newrelic avatar May 16 '22 23:05 kford-newrelic

@kford-newrelic I'm writing a piece of code to validate New Relic credentials (API key). For this I'm sending a test metric via the MetricBatchSender sendBatch() function which returns Response code returned by the Ingest API by making a call to the BatchDataSender sendPayload() function. For invalid API key, the ingest API is expected to return a response code of '403-Forbidden request'. However, the cases for response codes 400, 403, 404, 405 and 411 are not handled individually and instead a common DiscardBatchException is thrown to handle these response codes. As response code 403 is not being returned by the function, I'm not able to handle that case for validating New Relic credentials.

Sidburse avatar May 17 '22 04:05 Sidburse

https://issues.newrelic.com/browse/NEWRELIC-4087