Commit 85615d5
feat: add Sentry metric for Copy Prompt button clicks (#18264)
## DESCRIBE YOUR PR
- **Preview has been validated**
- **Sentry data has been validated (see vercel preview in Sentry!)****
Track "Copy Prompt" button clicks in the Agent Skills Callout as a
Sentry application metric (`docs.copy_ai_prompt` counter).
**Metric attributes:**
- `page_path` -- first 3 URL segments (privacy-safe, matches existing
metrics)
- `skill` -- skill name (e.g. `sentry-nextjs-sdk`) or `generic` if no
skill specified
- `success` -- whether the clipboard copy succeeded
**Changes (2 files):**
- `src/metrics.ts` -- Add `copyAIPrompt` method to `DocMetrics`,
following the same pattern as existing metrics (`copyPage`,
`snippetCopy`, etc.)
- `src/components/agentSkillsCallout/index.tsx` -- Import `DocMetrics`
and call `copyAIPrompt` on success/failure in the click handler. Also
fixes `useCallback` dependency array to include `skill`.
## IS YOUR CHANGE URGENT?
- [x] None: Not urgent, can wait up to 1 week+
## PRE-MERGE CHECKLIST
- [ ] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)
Co-authored-by: Shannon Anahata <shannonanahata@gmail.com>1 parent 2ea6c18 commit 85615d5
2 files changed
Lines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| 70 | + | |
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
| 74 | + | |
72 | 75 | | |
73 | 76 | | |
74 | 77 | | |
75 | | - | |
| 78 | + | |
76 | 79 | | |
77 | 80 | | |
78 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
138 | 154 | | |
139 | 155 | | |
140 | 156 | | |
| |||
0 commit comments