1. Home
  2. Blog
  3. Releases
Releases

Snowplow Java Tracker 0.10.1 (and 0.10.0) released

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:

  1. Considerable performance improvements
  2. Removal of need to create a HttpClientAdapter
  3. Support for Gradle Feature Variants
  4. Dependency updates
  5. Breaking changes
  6. Upgrading
  7. 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.

Emitter batch = BatchEmitter.builder()
        .threadCount(20) // Default is 50
        .build();

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 OkHttpClientAdapter or ApacheHttpClientAdapter with custom settings if you wish to.

Emitter batch = BatchEmitter.builder()
        .httpClientAdapter(  )
        .build();

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 OkHttp or 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.

OkHttp Support

dependencies {
    implementation 'com.snowplowanalytics:snowplow-java-tracker:0.10.1'
    implementation ('com.snowplowanalytics:snowplow-java-tracker:0.10.1') {
        capabilities {
            requireCapability 'com.snowplowanalytics:snowplow-java-tracker-okhttp-support:0.10.1'
        }
    }
}

ApacheHttp Support

dependencies {
    implementation 'com.snowplowanalytics:snowplow-java-tracker:0.10.1'
    implementation ('com.snowplowanalytics:snowplow-java-tracker:0.10.1') {
        capabilities {
            requireCapability 'com.snowplowanalytics:snowplow-java-tracker-apachehttp-support:0.10.1'
        }
    }
}

More information on the Gradle setup can be found in the documentation. You can also read more about Gradle Feature Gradients here.

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.

  1. The signature on the callback for requestCallback on the Emitter has changed, so events which have failed to send return the Event object rather than the internal TrackerPayload. This allows you to easily resend them using the usual Tracker.track(Event) method.
  2. 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 AbstractEvent.
  3. 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.

6. Upgrading

Since version 0.9.0, the Java Tracker is available on Maven Central. It is also available via Snowplow’s Bintray Maven Repository.

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:

The v0.10.1 and v0.10.0 release pages on GitHub has the full list of changes made in this version.

Finally, if you run into any issues or have any questions, please raise an issue or get in touch with us via our Discourse forums.

More about
the author

Paul Boocock
Paul Boocock

Paul is a Head of Engineering and enjoys spending his time thinking about Snowplow use cases, the ethics of data collection and user privacy. He works mainly with the teams responsible for the Snowplow Trackers and Data Models.

View author

Unlock the value of your behavioral data with customer data infrastructure for AI, advanced analytics, and personalized experiences

Image of the Snowplow app UI