Snowplow Scala Tracker 0.3.0 released

14 May 2016  •  Anton Parkhomenko

We are pleased to release version 0.3.0 of the Snowplow Scala Tracker. This release introduces a user-settable “true timestamp”, as well as several bug fixes.

In the rest of this post we will cover:

  1. True timestamp
  2. Availability on JCenter and Maven Central
  3. Minor updates and bug fixes
  4. Upgrading
  5. Roadmap
  6. Getting help

1. True timestamp

Last year we published the blog post Improving Snowplow’s understanding of time, which introduced a new tracker parameter, true_tstamp.

This parameter denotes an event’s definitive timestamp where available; if this is sent with an event then our enrichment process will use it unaltered as the derived_tstamp (rather than calculating it from other timestamps such as device_created_tstamp, dvce_sent_tstamp, collector_tstamp).

To use it inside Scala Tracker you need to “tag” the optional timestamp parameter as TrueTimestamp:

val tracker = new Tracker(emitters, trackerNS, appName)
val timestamp = Tracker.TrueTimestamp(1459778542000L)
tracker.trackStructEvent(category, action, timestamp=Some(timestamp))

Using above code, tracker will send the event with the ttm parameter attached, per the Snowplow Tracker Protocol. If you do not tag timestamp as a TrueTimestamp and instead provide a simple timestamp of type Long, the tracker will send it as the dtm parameter as before. Under the hood this implementation uses a Scala-specific feature - implicit conversions.

A warning: you should only use TrueTimestamp when you are absolutely sure that this is the definitive timestamp for the event, uncorrupted by a defective device clock or malicious user.

2. Availability on JCenter and Maven Central

Historically we were using our own Maven repository for hosting Snowplow JVM artifacts. We are now steadily moving new releases of all such projects to the much more common community repositories, such as JCenter and Maven Central.

As of this release, Snowplow Scala Tracker is available in JCenter and Maven Central.

If in your project, you’re using only Scala Tracker among all Snowplow libraries, you can now remove our Maven repository:

  "Snowplow Analytics" at "http://maven.snplow.com/releases/",

3. Minor updates and bug fixes

This release also bring few minor updates and bug fixes.

Several Subject methods (such as setLang, setUseragent etc) were missing in our previous releases. These have now all been implemented, thanks to a contribution from community member Christoph Bünte!

Another great contribution from community member Dominic Kendrick is full support of HTTPS. Now all emitters can be configured to send events to collectors with secure connection.

We also fixed an important bug (issue #29), where the EC2 custom context introduced in version 0.2.0 was being sent with the incorrect schema URI.

One other update is the new trackSelfDescribingEvent method, which is an alias for trackUnstructEvent. We’re adding this method to all our trackers because a “self-describing event” is a better description of that functionality than “unstructured event”.

4. Upgrading

If you were using our Maven repository, we’re strongly recommend you to switch to Maven Central, which is available by default in Maven, SBT and Gradle.

You can find out more about installing and upgrading this tracker on the Scala Setup Guide on our wiki.

5. Roadmap

We are planning two refactorings to make the Scala Tracker more modular and lightweight.

First, we plan on including the upcoming scala-iglu-core library. With Iglu Core we can exclude the Json4s library shipped with Scala Tracker by default. This will make things easier for users who want to use the Snowplow Scala Tracker with a different Scala (or Java) JSON library. Scala Iglu Core will make the handling of self-describing JSONs more type-safe.

Another step in the direction of modularity will be to allow users to re-use an existing Akka system in their app for the Scala Tracker. Currently the tracker starts a new Akka system just to send events, but it could be very useful to let you re-use your application’s existing Akka system.

6. Getting help

You can find the Scala Tracker usage manual on our wiki.

The full release notes are on GitHub as Snowplow Scala Tracker v0.3.0 release.

In the meantime, if you have any questions or run into any problems, please [raise an issue] [scala-issues] or get in touch with us through the usual channels!