feat(telemetry): carry the page through its lifecycle events - #804
Merged
surajshetty3416 merged 2 commits intoSep 8, 2026
Merged
Conversation
Most Builder events recorded that something happened but not to what, so nothing could be joined across create, publish and template use (frappe#800). - builder_page_created, builder_page_published and builder_page_unpublished now carry the page id, plus source/template_page/block_count on create and is_first_publish/seconds_since_created/block_count/has_client_script/ has_data_script on publish. The created capture moves to after_insert: naming discards whatever name before_insert saw. - builder_page_unpublished never fired: the editor unpublishes with a plain field update, not the unpublish method. It now fires from on_update on the published 1 -> 0 transition, whichever path flips it. - builder_page_template_used and builder_template_group_imported send the page names they already had in hand. - New builder_editor_opened event when the editor switches to a page, with block_count and is_published, so pages that are created and then abandoned leave a trace. - Persona survey answers are attached to the site's Pulse profile through a new identify_persona endpoint, so any metric can be split by persona. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Confidence Score: 5/5The PR appears safe to merge. Both previous findings are resolved; the retry telemetry issue is fixed, and Frappe boundary validation makes the persona type-check concern inapplicable. Reviews (3): Last reviewed commit: "fix(telemetry): count a retried editor o..." | Re-trigger Greptile |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #804 +/- ##
===========================================
+ Coverage 66.06% 66.86% +0.79%
===========================================
Files 93 94 +1
Lines 10386 10496 +110
===========================================
+ Hits 6862 7018 +156
+ Misses 3524 3478 -46 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
setPage moved selectedPage before fetching, so a retry of the same page after a failed fetch looked like no switch and builder_editor_opened was dropped. Compare against the last page that actually loaded instead. Also covers count_blocks on a single legacy root block. Co-Authored-By: Claude <noreply@anthropic.com>
Member
Author
|
🎉 This PR is included in version 1.34.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Refs #800. Covers items 1, 2, 5, the reachable half of 3, and the dead
builder_page_unpublishedfrom 7.What
builder_page_creatednow carriespage,source(template/duplicate/blank/import),template_pageandblock_count. The two known origins are stamped by their API entry points; anything else with more than the root block came in with content (paste, REST), so it reads asimport. The capture moved frombefore_inserttoafter_insert: Frappe's naming discards whatever namebefore_insertsaw, so the id the issue expected there was never the real one.builder_page_publishedcarriespage,is_first_publish,seconds_since_created,block_count,has_client_script,has_data_script. First publish is read beforepublish()sets the flag, andpublished_atis checked too so an unpublish/republish cycle does not count as a second first.builder_page_unpublishednever fired because the editor unpublishes with a plainset_valueonpublished, never theunpublishdoc method. It now fires fromon_updateon the 1 → 0 transition, whichever path flips it, and carriespage.builder_page_template_usedsendspage(the new page's name) andbuilder_template_group_importedsendspages, both values the frontend already had in hand.New
builder_editor_openedevent, fired frompageStore.setPagewhenever the editor switches to a page other than the last one that loaded, withpage,block_count,is_published. Reloads of the same page (restore, revert, unpublish) do not refire; a retry after a failed fetch does. This is the first in-editor trace for the 256 sites whose last event wasbuilder_page_created.Persona survey answers are attached to the site's Pulse profile through a new
builder.api.identify_personaendpoint (builder_role,builder_use_case,builder_source). The existingbuilder_persona_submittedevent stays. Argument types are enforced byfrappe.whitelist(Builder setsrequire_type_annotated_api_methods), and the pulse import is local and guarded becauseidentifyonly exists on frappe v16+.Tests in
builder/builder/tests/test_telemetry.pycover every property above plus the not-first-publish and not-an-unpublish-on-insert edges.Left out, and why
user=on hook events) changes nothing: the Pulse client already defaultsusertofrappe.session.user. What it does not do is anonymizeAdministrator(a standard user), so events published as Administrator carry a user the ingest side apparently drops. Builder cannot fix that from its call sites.publish()to emit exception class names felt premature.builder_editor_closed(item 3) is unreliable on tab close and would bias session length, so it is skipped.schema_versionstamp and the dead-event test need Pulse data access, which a repo test does not have.builder_editor_openedsupersedesbuilder_page_opened, which can be retired once it has data.source: page.live_url ? "hub" : "local"key on the template events is alwayshubbecause every template now comes through the hub; left as is.Noticed, not touched
set_default_valuesderivesroutefrom a name that naming then throws away, so a page's route hash and its name hash never match. Harmless, but surprising.