Package com.newrelic.telemetry.logs
Class LogBatchSender
- java.lang.Object
-
- com.newrelic.telemetry.logs.LogBatchSender
-
public class LogBatchSender extends java.lang.Object
Manages the sending ofLogBatch
instances to the New Relic Logs API.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SenderConfiguration.SenderConfigurationBuilder
configurationBuilder()
static LogBatchSender
create(SenderConfiguration configuration)
Build the finalLogBatchSender
.static LogBatchSender
create(java.util.function.Supplier<HttpPoster> httpPosterCreator, BaseConfig baseConfig)
Creates a new LogBatchSender with the given supplier of HttpPoster impl and a BaseConfig instance, with all configuration NOT in BaseConfig being default.static java.net.URL
returnEndpoint(java.lang.String userRegion)
Response
sendBatch(LogBatch batch)
Send a batch of logs to New Relic.
-
-
-
Method Detail
-
sendBatch
public Response sendBatch(LogBatch batch) throws ResponseException
Send a batch of logs to New Relic.- Parameters:
batch
- The batch to send. This batch will be drained of accumulated logs as a part of this process.- Returns:
- The response from the ingest API.
- Throws:
ResponseException
- In cases where the batch is unable to be successfully sent, one of the subclasses ofResponseException
will be thrown. See the documentation on that hierarchy for details on the recommended ways to respond to those exceptions.
-
create
public static LogBatchSender create(java.util.function.Supplier<HttpPoster> httpPosterCreator, BaseConfig baseConfig)
Creates a new LogBatchSender with the given supplier of HttpPoster impl and a BaseConfig instance, with all configuration NOT in BaseConfig being default.- Parameters:
httpPosterCreator
- A supplier that returns an HttpPoster for this LogBatchSender to use.baseConfig
- basic configuration for the sender- Returns:
- a shiny new LogBatchSender instance
-
create
public static LogBatchSender create(SenderConfiguration configuration)
Build the finalLogBatchSender
.- Parameters:
configuration
- new relict rest api ingest configurations- Returns:
- the fully configured LogBatchSender object
-
returnEndpoint
public static java.net.URL returnEndpoint(java.lang.String userRegion) throws java.net.MalformedURLException
- Throws:
java.net.MalformedURLException
-
configurationBuilder
public static SenderConfiguration.SenderConfigurationBuilder configurationBuilder()
-
-