Skip to content

Version 3.0.0

Choose a tag to compare

@jbeemster jbeemster released this 09 Jan 03:45
· 11 commits to master since this release

This is a major upgrade to the tracker with several breaking API changes. The main focus in this release has been to convert and move to a modular package structure. This lets us remove erroneous dependencies (like sqlite3 if we are using the go-memdb storage implementation) but equally this is ensuring that only the required dependencies for the implementation are being brought in as the packages now need to be explicitly pulled.

Golang Version Changes

With this release we are now testing against Golang v1.19, 1.18 and 1.17. Versions older than this are not guaranteed to work anymore. Please let us know if you need the Tracker to work against older versions in an issue and we can consider investigating this.

API Changes

  • tracker.InitPayload(): The Payload struct now cannot be imported from tracker and instead needs to be imported from pkg/payload to be initialized. The constructor has been renamed from InitPayload -> Init within this package.
  • tracker.InitStorageMemory(): The StorageMemory implementation has been moved from tracker to pkg/storage/memory. The constructor has been renamed from InitStorageMemory -> Init within this package.
  • tracker.InitStorageSQLite3(): The StorageSQLite3 implementation has been moved from tracker to pkg/storage/sqlite3. The constructor has been renamed from InitStorageSQLite3 -> Init within this package.
  • tracker.Storage: For those that were providing a custom Storage layer implementation the interface now lives in pkg/storage/storageiface and contains the Storage interface and EventRow struct.

In the core tracker module the only interface change left is in the Emitter where OptionStorage and OptionDbName have been removed. You must now always provide a Storage implementation to the Emitter by:

  1. Importing or defining a Storage implementation
  2. Setting it with the RequireStorage function in the Emitter

As an example you can look at the below:

import (
  storagememory "github.com/snowplow/snowplow-golang-tracker/v3/pkg/storage/memory"
  tracker "github.com/snowplow/snowplow-golang-tracker/v3/tracker"
)

emitter := tracker.InitEmitter(tracker.RequireCollectorUri(collector),
  tracker.RequireStorage(storagememory.Init()), // ADD THIS
  tracker.OptionStorage(tracker.InitStorageMemory()), // REMOVE THIS
)

Other API moves

All helper functions used in the library have been moved from tracker to pkg/common.

Full changelog

  • Remove Vagrant testing integration (#65)
  • Remove unused script in project root (#66)
  • Remove unused dist directory (#67)
  • Upgrade to Golang v1.19 (#69)
  • Add modular pkg structure to remove erroneous imports (#70)
  • Add extra tests for storage/memory (#71)