Transport

Sentry Java SDK by default comes with a lightweight transport implementation based on HttpUrlConnection. While this implementation is a great fit for the error reporting feature, it may provide enough throughput for high traffic, server applications using Sentry's Performance Monitoring.

In a separate module, as an optional dependency, the SDK also provides high-throughput implementation based on Apache HTTP Client 5. To use this module, include following dependency in your project:

Copied
<dependency>
    <groupId>io.sentry</groupId>
    <artifactId>sentry-apache-http-client-5</artifactId>
    <version>4.2.0</version>
</dependency>

Then configure SDK to use the new transport:

Copied
import io.sentry.Sentry;
import io.sentry.transport.apache.ApacheHttpClientTransportFactory;

Sentry.init(options -> {
  options.setTransportFactory(new ApacheHttpClientTransportFactory());
});

Note, ApacheHttpClientTransport does not support envelope caching which means that pending events and transactions are discarded on application shutdown.

You can edit this page on GitHub.