Telemetry: add event.name and url.full to CTA events#3604
Conversation
cta_viewed/cta_clicked previously only carried their event name in the log body (a text field), making them hard to filter on with an exact keyword query. Adds event.name per OTel semantic conventions, plus url.full to distinguish the page the user was on from the CTA's destination (cta.url). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR refactors CTA telemetry logging in main.ts by introducing a Sequence Diagram(s)sequenceDiagram
participant Observer as IntersectionObserver
participant ClickHandler as Document click handler
participant logCtaEvent
participant logInfo
Observer->>logCtaEvent: logCtaEvent('cta_viewed', cta)
ClickHandler->>logCtaEvent: logCtaEvent('cta_clicked', cta)
logCtaEvent->>logInfo: logInfo(eventName, {ATTR_EVENT_NAME, ...ctaAttributes, ATTR_URL_FULL})
Estimated code review effort: 2 out of 5 Related PRs: None found. Suggested labels: enhancement, telemetry, frontend Suggested reviewers: None identified. 🐰 A rabbit hops through code so neat, 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Why
cta_viewed/cta_clickedcurrently carry their event identity only in the OTel logbody, a text field. Filtering these events in Elasticsearch means a fuzzy text match instead of an exact keyword lookup, which makes dashboards and ES|QL queries awkward.What
Adds
event.nameas a proper log record attribute (mirroring the body) on both CTA events, following the OTel semantic convention, so they can be filtered with:Also adds
url.full(the full page URL) alongside the existingurl.path, so the page the user was on can be distinguished from the CTA's destination (cta.url).Test plan
tsc --noEmitpasseseslintpassescta_viewed/cta_clickedincludeattributes.event.nameandattributes.url.full