newrelic / newrelic-telemetry-sdk-java

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

Not handled error response codes by BatchDataSender #287

Open Sidburse opened 2 years ago

Sidburse commented 2 years ago

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)

kford-newrelic commented 2 years ago

@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...

Sidburse commented 2 years ago

@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.

workato-integration[bot] commented 2 years ago

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