We’re pleased to announce the newest release of our Java Tracker. Versions 0.10.1 and 0.10.0 are now available. This release includes significant performance improvements, based on a fork provided to us by bbplanon.
Firstly, payloads can now be created asynchronously, and the tracker will no longer block the thread that calls the
track() methods. We have also made it easier to set up and configure the tracker by creating a default HttpClientAdapter and adding support for Gradle Feature Variants to pull in optional dependencies. Lastly, there have been a number of version bumps to existing dependencies bringing the Java Tracker up to date as well as adding a Snyk.io integration to keep on top of security vulnerabilities in the future.
Read on below for:
- Considerable performance improvements
- Removal of need to create a HttpClientAdapter
- Support for Gradle Feature Variants
- Dependency updates
- Breaking changes
- Documentation and help
1. Considerable performance improvements
We have moved the payload construction into background threads, and considerably reduced the work done on the thread which calls the
Tracker.track() method. Specifically, the number of threads can be controlled when creating the Emitter. On top of the
threadCount, this creates an additional thread which is for the consumer of the buffer.
More information on this can be found in the Emitter documentation.
2. Removal of need to create a HttpClientAdapter
You no longer need to create a
HttpClientAdapter and inject it into the Emitter when using the Emitter builders. By default, the Java Tracker will create a
OkHttpClientAdapter with the default
OkHttpClient parameters. Of course, you can still pass in an
ApacheHttpClientAdapter with custom settings if you wish to.
3. Support for Gradle Feature Variants
The Java Tracker has two optional dependencies, depending on the
HttpClientAdapter you wish to use. Previously, you would have needed to include the correct version of the
ApacheHttp libraries. Whilst this is still the case when using Maven, we have leveraged the Feature Variants support in Gradle so you now only need to specify the feature you wish to use rather than the specific library.
4. Dependency updates
We have also bumped a number of dependencies in the Java Tracker in this release, bringing all of its dependencies up to date.
Specifically, we have updated the following libraries:
- Upgrade to Gradle 6 (#236)
- Bump org.apache.httpcomponents:httpasyncclient to 4.1.4 (#249)
- Bump org.apache.httpcomponents:httpclient to 4.5.12 (#248)
- Bump mockito-core to 3.3.3 (#247)
- Bump slf4j-api to 1.7.30 (#246)
- Bump commons-net to 3.6 (#245)
- Bump commons-codec to 1.14 (#241)
- Bump mockwebserver to 4.7.2 (#239)
- Bump guava to 29.0 (#238)
- Bump wiremock to 2.26.3 (#237)
- Bump jackson-databind to 2.11.0 (#235)
5. Breaking changes
By updating the Java Tracker to handle sending events asynchronously, we have also introduced some breaking changes in this release. While these provide a cleaner API, they will cause compilation errors if you have instrumented a previous version.
- The signature on the callback for
requestCallbackon the Emitter has changed, so events which have failed to send return the
Eventobject rather than the internal
TrackerPayload. This allows you to easily resend them using the usual
- Given the above, we have removed
Tracker.track(TrackerPayload)as you should never need to send the raw payload. If you do need to, you should rather extend
- Tracker parameters are now immutable once the Tracker has been constructed. This means functions such as
Tracker.setNamespace()no longer exist. To set these parameters, you can utilize the
TrackerBuilder. This change has been made as Payloads are now constructed asynchronously, so changing the Tracker parameters after initial construction may lead to unexpected results.
To upgrade, use the following URL
https://bintray.com/snowplow/snowplow-maven/ and change the version to
0.10.1. Further details and examples for Maven, Gradle and sbt can be found in our setup guide.
7. Documentation and help
Check out the Java Tracker’s documentation: