fix(v2/events): send a go-prefixed module version as the tracker version

The Snowplow tracker in LabKit v2 now sends go-<module version> as the tracker version (tv), in place of the fixed 0.0.1. This lets the Data team keep Go events with one tracker_version LIKE 'go%' rule, so events from LabKit v2 services reach the modelled Snowflake tables.

Closes #173 (closed)

What changes

  • tv is go- plus the version of gitlab.com/gitlab-org/labkit/v2 in the binary, for example go-v2.66.0. The value comes from runtime/debug.ReadBuildInfo, read once per process.
  • tv is go-unknown when the binary has no build information, the module isn't a dependency, the version is empty, or the module is replaced with a replace directive.
  • No public API changes.
Why the prefix is go- and not labkit-
  • Snowplow tracker versions name the language, not the library, and the dbt allowlist follows that: js%, rb%, py%, java%, rust%. GitLab Rails wraps the Ruby tracker and still sends rb-. go- adds one more rule of the same kind.
  • A labkit- prefix would need a new kind of allowlist rule and buy little precision. LabKit is already identifiable from the user agent (GitLab Analytics Golang Tracker), the service from app_id, and the version string is a LabKit release.
  • go% also accepts any other Go Snowplow tracker, which matches how the allowlist treats the other languages.
Design notes
  • The lookup is a pure function, trackerVersionFromBuildInfo, so the tests cover each branch without patching a global.
  • A replaced module falls back because the version in go.mod doesn't describe the code that runs.
  • LabKit's own test binaries always get go-unknown, because LabKit is the main module there, not a dependency.
  • Pseudo-versions pass through unchanged, for example go-v2.66.1-0.20261102082407-e0b7ace12345.

Verification

  • go test ./events/snowplow/... passes in v2.
  • golangci-lint run ./events/snowplow/... reports 0 issues.

🤖 Generated with Claude Code

Edited by Pawel Rozlach

Merge request reports

Loading
Loading