Repository navigation
feat(telemetry): sync payload with upstream schema-1 (dev opt-out, env, activity, region) - #80
Merged
Merged
Conversation
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>
# Conflicts: # CHANGELOG.md # docker/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
dev-prepend.php).HostFingerprint).panel.region(a continent code derived from the configured timezone, never from an IP). The in-panel disclosure text and the 1.8→2.0 upgrade doc are updated.Still no hostnames, IPs, admin names, SteamIDs or ban reasons. Opt-out is unchanged (Settings → Features).
Tests
Telemetry|HostFingerprint|DevPrepend: 68 tests OK. PHPStan onincludes/Telemetry: no errors.CHANGELOG: 2.2.4-srcdslab.