Skip to content

feat(telemetry): sync payload with upstream schema-1 (dev opt-out, env, activity, region) - #80

Merged
Rushaway merged 5 commits into
mainfrom
fix/telemetry-signals
Oct 26, 2026
Merged

Rushaway merged 5 commits into
mainfrom
fix/telemetry-signals

Conversation

@Rushaway

@Rushaway Rushaway commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Cherry-pick of upstream sbpp#1604, sbpp#1606 and sbpp#1609 (applied cleanly: our telemetry code was identical to upstream's).

Our panel posts to the same sbpp analytics Worker, whose schema-1 now expects these fields. This keeps the vendored lock file and the payload in sync with it.

What changes

Still no hostnames, IPs, admin names, SteamIDs or ban reasons. Opt-out is unchanged (Settings → Features).

⚠️ This sends more data to sbpp's analytics than before. If we'd rather not, close this PR and keep only sbpp#1604 (the dev-stack opt-out).

Tests

Telemetry|HostFingerprint|DevPrepend: 68 tests OK. PHPStan on includes/Telemetry: no errors.

CHANGELOG: 2.2.4-srcdslab.

rumblefrog and others added 4 commits October 26, 2026 08:45
The dev stack seeds its DB from data.sql, which ships
telemetry.enabled = 1 and the live cf-analytics endpoint. Every web
request in the dev container runs Telemetry::tickIfDue() at shutdown,
so local `./sbpp.sh up`, the E2E workflow and the CI docs-screenshot
capture each sent a ping from a throwaway install with a fresh
instance_id, polluting the production dataset.

dev-prepend.php (the dev container's auto_prepend_file) now defines
SBPP_SKIP_TELEMETRY for web SAPIs, the same per-request opt-out
/health.php already uses. The CLI is left alone so PHPUnit inside the
container keeps exercising tickIfDue() in TelemetryOptOutTest.

Claude-Session: https://claude.ai/code/session_019E8y1xAnzfbNHQhAkgFyMm

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit 4d09e4d)
sbpp#1606)

sbpp/cf-analytics#4 extended schema-1 with env.sapi, three env doubles
(memory_limit_mb, max_execution_time, disable_functions_count) and
twelve env bits, and called for a paired panel change. That change
never landed, so every ping arrived without them and the Analytics
Engine rows carried null / 0 in those slots for every install.

Add Sbpp\Telemetry\HostFingerprint, which computes the 16 fields per
cf-analytics#3 (each probe Throwable-guarded; open_basedir value,
DOCUMENT_ROOT and the disable_functions list reduced to a boolean or
count), and merge it into Telemetry::collectEnv(). Extend the vendored
JSON Schema and the parity test to match.

memory_limit_mb is null on unlimited hosts. The Worker's zod schema
rejects an explicit null (whole ping 400s), so send() now drops null
leaves and the Worker sees the key as absent, which it maps to a null
double as intended.

Claude-Session: https://claude.ai/code/session_01Bwe7AmJS69ccciKdc2PPQi

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit b67c6cd)
… region and export signals (sbpp#1609)

sbpp/cf-analytics#7 appended these slots to schema-1 for
sbpp/cf-analytics#6. Mirror them in the vendored JSON Schema and add
the matching extractors so the parity test stays green:

- scale.bans_30d / admins_active_30d: 30-day counts from
  :prefix_bans.created and :prefix_admins.lastvisit.
- scale.ban_history_months: whole calendar months since the oldest
  ban (created = 0 legacy rows ignored); null without bans, so it is
  dropped from the wire body.
- scale.web_bans_majority_30d: more than half of last-30d bans have
  sid = 0.
- scale.games.*: tf / cstrike / csgo / garrysmod / left4dead2 / other
  over enabled servers' modfolders. Other folder names never leave
  the panel.
- scale.perms.*: any web group (type 1), server group, override, or
  admin with immunity > 0.
- panel.exported_30d: a Data Export success row in :prefix_log in the
  last 30 days.
- panel.region: continent code via the new Sbpp\Telemetry\Region,
  from config.timezone when it holds a zone name, else PHP's default
  timezone. Fresh 2.0 installs have no config.timezone and pre-2.0
  upgrades can hold a bare UTC offset there, so the fallback is what
  most installs will use. Never derived from the request.

Operator docs and the Features help text list the new fields.

Refs sbpp/cf-analytics#6

Claude-Session: https://claude.ai/code/session_01XsiwAF3BzPy1aMBEuQcGZe

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit 1917e0a)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Rushaway
Rushaway requested review from cmer81 and maxijabase October 26, 2026 07:53
# Conflicts:
#	CHANGELOG.md
#	docker/README.md
@Rushaway
Rushaway merged commit f057f86 into main Oct 26, 2026
7 checks passed
@Rushaway
Rushaway deleted the fix/telemetry-signals branch October 26, 2026 08:07
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