Skip to content

feat(telemetry): add seer.outcome span tag for Seer command metrics#609

Merged
BYK merged 3 commits intomainfrom
feat/seer-telemetry-outcomes
Mar 30, 2026
Merged

feat(telemetry): add seer.outcome span tag for Seer command metrics#609
BYK merged 3 commits intomainfrom
feat/seer-telemetry-outcomes

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Mar 30, 2026

Summary

Closes #118

  • Add seer.outcome span tag to issue explain and issue plan commands for structured outcome classification
  • No metrics counters — spans at 100% sample rate are sufficient for Discover queries
  • Created "CLI Seer Health" dashboard at https://sentry.sentry.io/dashboard/1763619/

Outcome values

Outcome Trigger
success Command yielded data
timeout Polling exceeded 6 min
no_budget SeerError: paid plan required
not_enabled SeerError: Seer not enabled
ai_disabled SeerError: AI features disabled
no_solution 0 root causes or null solution
api_error Non-Seer API errors (404, 5xx)
error Autofix ERROR/CANCELLED, unknown

Changes

  • src/lib/telemetry.ts: SeerOutcome type, recordSeerOutcome(), classifySeerError()
  • src/commands/issue/explain.ts: outcome recording at all exit points with recorded guard
  • src/commands/issue/plan.ts: same pattern + handleSeerCommandError() helper (Biome complexity)
  • test/lib/seer-telemetry.test.ts: 7 tests for classifySeerError()

…118)

Add structured outcome classification to issue explain and issue plan
commands via a seer.outcome span tag on the cli.command transaction.

Since tracesSampleRate is 1, every execution is already captured as a
span — no separate metrics.increment() or metrics.distribution() calls
needed. Discover queries can slice by outcome, duration, org, etc.

Outcome values: success, timeout, no_budget, not_enabled, ai_disabled,
no_solution, api_error, error.

Helpers:
- recordSeerOutcome(outcome) — sets Sentry.setTag("seer.outcome", ...)
- classifySeerError(error) — maps error types to outcome values
- handleSeerCommandError() — extracted catch block for plan.ts to stay
  under Biome complexity limit

Dashboard: "CLI Seer Health" at sentry.sentry.io/dashboard/1763619/
with 8 widgets tracking command volume, outcomes, duration, and org
breakdown.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 30, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (telemetry) Add seer.outcome span tag for Seer command metrics by BYK in #609
  • (upgrade) Show changelog summary during CLI upgrade by BYK in #594

Bug Fixes 🐛

Upgrade

  • Prevent spinner freeze during delta patch application by BYK in #608
  • Indent changelog, add emoji to heading, hide empty sections by BYK in #604

Other

  • (dashboard) Reject MRI queries with actionable tracemetrics guidance by BYK in #601
  • (skill) Avoid unnecessary auth, reinforce auto-detection, fix field examples by BYK in #599
  • 2 bug fixes — subcommand crash, negative span depth, pagination JSON parse by cursor in #607

Documentation 📚

  • (skill) Document dashboard widget constraints and deprecated datasets by BYK in #605

Internal Changes 🔧

  • Regenerate skill files and command docs by github-actions[bot] in 664362ca

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 30, 2026

Codecov Results 📊

129 passed | Total: 129 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 94.12%. Project has 1277 uncovered lines.
❌ Project coverage is 95.73%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
src/lib/telemetry.ts 92.00% ⚠️ 2 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    95.74%    95.73%    -0.01%
==========================================
  Files          203       203         —
  Lines        29912     29936       +24
  Branches         0         0         —
==========================================
+ Hits         28640     28659       +19
- Misses        1272      1277        +5
- Partials         0         0         —

Generated by Codecov Action

When validateRootCauses throws for 0 root causes, the catch block
classified it as "error" via classifySeerError (ValidationError maps
to "error"). Inline the check and record "no_solution" explicitly,
matching the explain.ts pattern.
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Move the error handling helper from plan.ts to utils.ts so both
explain.ts and plan.ts use the same function. This ensures outcome
classification stays consistent if the logic is updated.
@BYK BYK merged commit dc8684b into main Mar 30, 2026
21 checks passed
@BYK BYK deleted the feat/seer-telemetry-outcomes branch March 30, 2026 17:28
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.

feat(telemetry): Add metrics for Seer command outcomes

1 participant