Package com.newrelic.telemetry.spans
Class SpanBatchSender
- java.lang.Object
-
- com.newrelic.telemetry.spans.SpanBatchSender
-
public class SpanBatchSender extends java.lang.ObjectManages the sending ofSpanBatchinstances to the New Relic Spans API.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SenderConfiguration.SenderConfigurationBuilderconfigurationBuilder()static SpanBatchSendercreate(SenderConfiguration configuration)Build the finalSpanBatchSender.static SpanBatchSendercreate(java.util.function.Supplier<HttpPoster> httpPosterCreator, BaseConfig baseConfig)Creates a new SpanBatchSender with the given supplier of HttpPoster impl and a BaseConfig instance, with all configuration NOT in BaseConfig being default.static java.net.URLreturnEndpoint(java.lang.String userRegion)ResponsesendBatch(SpanBatch batch)/** Send a batch of spans to New Relic.
-
-
-
Method Detail
-
sendBatch
public Response sendBatch(SpanBatch batch) throws ResponseException
/** Send a batch of spans to New Relic.- Parameters:
batch- The batch to send. This batch will be drained of accumulated spans 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 ofResponseExceptionwill be thrown. See the documentation on that hierarchy for details on the recommended ways to respond to those exceptions.
-
create
public static SpanBatchSender create(java.util.function.Supplier<HttpPoster> httpPosterCreator, BaseConfig baseConfig)
Creates a new SpanBatchSender 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 SpanBatchSender to use.baseConfig- basic configuration for the sender- Returns:
- a shiny new SpanBatchSender instance
-
create
public static SpanBatchSender create(SenderConfiguration configuration)
Build the finalSpanBatchSender.- Parameters:
configuration- new relict rest api ingest configurations- Returns:
- the fully configured SpanBatchSender 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()
-
-