Skip to content

fix(telemetry): send the release version so GA4 can report it - #3270

Merged
vpetersson merged 1 commit into
Screenly:masterfrom
vpetersson-bot:split/telemetry-version
Aug 7, 2026
Merged

fix(telemetry): send the release version so GA4 can report it#3270
vpetersson merged 1 commit into
Screenly:masterfrom
vpetersson-bot:split/telemetry-version

Conversation

@vpetersson-bot

Copy link
Copy Markdown
Contributor

Issues Fixed

No associated issue — reported directly from the GA4 dashboard, where the "Version distribution" report shows ~3,700 of ~3,700 active devices as "(not reported)".

Description

The report reads a version_name dimension that nothing has ever sent.

The current telemetry payload carries branch, commit_short, device_type, hardware_model, is_balena, resolution, audio_output, tls_enabled and asset counts — no version field of any kind. I checked the pre-#2798 payload too in case this was a regression: that one had Pi_Version, but it is parse_cpu_info()['model'], i.e. the hardware model, not the software release. Nothing in the tree sends version_name, app_version or appVersion.

So this is not a delivery problem or a sampling artefact — GA has nothing to populate the dimension with, and the report could not have worked at any point.

The change

Adds version_name to the device_active params, from get_anthias_release().

Sourced from get_anthias_release() rather than an env var deliberately: missing env vars are the known failure mode for these params (the same class of bug as device_type reporting unknown). get_anthias_release() reads pyproject.toml's [project].version, which ships inside the image, so it needs no compose or env plumbing. Verified inside the actual celery container on the Pi 5 testbed before relying on it:

$ docker exec anthias-anthias-celery-1 python -c "...get_anthias_release()"
'2026.7.3'

Falls back to 'unknown' rather than '' so a device whose version lookup fails gets its own visible bucket, instead of silently rejoining the "(not reported)" pile that hid this in the first place.

Resulting payload:

event: device_active
  version_name        = '2026.8.0'   <-- new
  branch              = 'master'
  commit_short        = 'fbe83e9'
  device_type         = 'pi5'
  ...

Also corrects the send_telemetry docstring, which still said it emits a version event; that was renamed to device_active in #2798.

Note on the two devices that DO report a version

The dashboard shows 2 devices on 2026.05.7 and 1 (previous period) on 2026.05.4. Since nothing in-tree has ever sent a version param, I cannot account for those from this source — most likely a patched or forked build. Flagging it rather than guessing; they should be easy to distinguish once real data starts flowing.

Rollout

Telemetry is rate-limited to one event per device per 24h via a Redis cooldown, so the report should populate within a day of devices picking this up.

Checklist

  • I have performed a self-review of my own code.
  • New and existing unit tests pass locally and on CI with my changes.
  • I have done an end-to-end test for Raspberry Pi devices.
  • I have tested my changes for x86 devices.
  • I added a documentation for the changes I have made (when necessary).

Device boxes unticked: no device behaviour changes, only an extra field in an outbound analytics payload. The one device-dependent assumption — that the version resolves inside the celery container without env plumbing — was verified on the Pi 5 testbed, as quoted above.

The GA4 "Version distribution" report reads a `version_name` dimension
that nothing has ever sent — not this payload, and not the pre-Screenly#2798 one
either, whose `Pi_Version` was the *hardware* model. So the report showed
~3,700 devices as "(not reported)" and could never have worked.

- add `version_name` from get_anthias_release() (pyproject.toml, which
  ships in the image) rather than an env var, since missing env vars are
  the known failure mode for telemetry params. Verified inside
  anthias-anthias-celery-1 on the pi5 testbed: resolves to '2026.7.3'
  with no extra plumbing
- fall back to 'unknown' rather than '', so a device whose version
  lookup fails gets its own bucket instead of silently rejoining the
  "(not reported)" pile that hid this
- correct the docstring: the event was renamed `version` ->
  `device_active` in Screenly#2798 and the docstring still said `version`
@vpetersson-bot vpetersson-bot self-assigned this Aug 7, 2026
@vpetersson-bot
vpetersson-bot requested a review from a team as a code owner August 7, 2026 08:19
@sonarqubecloud

sonarqubecloud Bot commented Aug 7, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (master@82c5def). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #3270   +/-   ##
=========================================
  Coverage          ?   90.71%           
=========================================
  Files             ?       76           
  Lines             ?     8440           
  Branches          ?      896           
=========================================
  Hits              ?     7656           
  Misses            ?      563           
  Partials          ?      221           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vpetersson
vpetersson merged commit bbab3d9 into Screenly:master Aug 7, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants