Skip to content

Cursor: Add Enterprise API key support and analytics dashboards - #9204

Open
jbsmith7741 wants to merge 12 commits into
apache:mainfrom
jbsmith7741:feat-cursor-enterprise
Open

jbsmith7741 wants to merge 12 commits into
apache:mainfrom
jbsmith7741:feat-cursor-enterprise

Conversation

@jbsmith7741

Copy link
Copy Markdown
Contributor

Summary

This PR adds Enterprise API key support to the Cursor plugin, enabling the collection of analytics data exclusively available to Cursor Enterprise teams. It also introduces automatic token-tier detection and new Grafana dashboards for enterprise metrics.

Enterprise Data Collection (New Collectors)

Collector Enterprise Only? Description
AI Code Commits ✅ Yes Commit-level AI code tracking
AI Code Changes ✅ Yes File/line-level AI code attribution
AI Code Commit Details ✅ Yes Per-commit enrichment (requires probe)
BugBot Reviews ✅ Yes (optional) BugBot automated review analytics
Conversation Insights ✅ Yes (optional) AI conversation intent/outcome data

** Auto-Refresh Permissions at Pipeline Start**
Each pipeline run re-probes optional endpoints and updates the connection's capability flags — no manual "Test Connection" click required when team settings change.

New Grafana Dashboards

Two new dashboards (MySQL + PostgreSQL variants each):

  • cursor-enterprise — AI code tracking: commits, changes, annotated code ranges; enterprise spend; member usage breakdown
  • cursor-bugbot — BugBot review counts, severity distribution, finding trends

Does this close any open issues?

N/A

Screenshots

Connection overview — key type badge and capability tags:

Cursor_connection_overview

Team Admin key (blue tag):

Cursor_team_token

Personal key — clear error guidance:

Cursor_Personal_token_error

Enterprise key (purple tag) — all collectors available:

Cursor_enterprise

cursor-enterprise Grafana dashboard:

cursor-enterprise

cursor-bugbot Grafana dashboard:

cursor-bugbot

Other Information

  • 7 migration scripts added covering new tables, schema fixes, and column widening
  • E2E snapshot tests cover all new extractors (AI code commits/changes/commit-details, BugBot reviews, Conversation Insights)
  • KeyTier is never downgraded by a transient probe failure to prevent enterprise collector flapping
  • Labels to add: pr-type/feature-development

  * Derive included spend from overallSpendCents when the Enterprise API omits includedSpendCents.
  * Add unit and end-to-end fixtures covering team and Enterprise spend response shapes.

Signed-off-by: Joshua Smith <jbsmith7741@gmail.com>
  * Detect and store API key tier on create, update, and test, and show it in Config UI.
  * Collect Enterprise AI code commits and changes when the connection key tier is enterprise.

Signed-off-by: Joshua Smith <jbsmith7741@gmail.com>
  * Add AI line coverage, commit source, agent-edits, and tab panels to cursor-usage
  * Extend diagnostics data volume table with enterprise tool tables

Signed-off-by: Joshua Smith <jbsmith7741@gmail.com>
  * Ingest bugbot-reviews into normalized review and finding tool tables when hasBugbotReviews is set
  * Add TestConnection probe, Grafana panels, Config UI messaging, and end-to-end extractor tests

Signed-off-by: Joshua Smith <jbsmith7741@gmail.com>
  * Fix AI code schema, ingested_at timestamps, and API items pagination for enterprise commits and changes.
  * Add Grafana top-repos and PR AI share panels and a dedicated BugBot review dashboard.

Signed-off-by: Joshua Smith <jbsmith7741@gmail.com>
  * Add enterprise Analytics API collector, extractor, migration, and connection probe for conversation-insights aggregates.
  * Add Conversation Insights Grafana panels and refine PR AI Line Share columns in cursor-usage.

Signed-off-by: Joshua Smith <jbsmith7741@gmail.com>
  * Re-probe BugBot and Conversation Insights at pipeline start, persist flags, and show capability status in Config UI.
  * Replace Conversation Insights pie charts with period share horizontal bar gauges in the cursor-usage Grafana dashboard.

Signed-off-by: Joshua Smith <jbsmith7741@gmail.com>
Rebased commits used incubator-devlake import paths; update cursor plugin
Go files to match this repo's go.mod module path so the plugin builds.

Signed-off-by: Joshua Smith <jbsmith7741@gmail.com>
  * Add commit-detail collect and extract subtasks with range annotation tables for conversation-to-cost attribution.
  * Move enterprise AI code, conversation insights, and repo or PR cost panels to cursor-enterprise.json with cross-dashboard links.

Signed-off-by: Joshua Smith <jbsmith7741@gmail.com>
  * Create range annotation tables when the earlier migration was already recorded.
  * Add PostgreSQL Grafana dashboards for enterprise AI code and BugBot.

Signed-off-by: Joshua Smith <jbsmith7741@gmail.com>
  * Accept conversation ids longer than 64 characters from commit details
  * Keep conversations required and range annotations nullable

Signed-off-by: Joshua Smith <jbsmith7741@gmail.com>
  * Gate BugBot optional collection on Enterprise tier so Team Admin keys show Unavailable for this key.
  * Commits by Source pie uses wide query and fixed IDE, CLI, and Cloud colors on both datasources.

Signed-off-by: Joshua Smith <jbsmith7741@gmail.com>
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.

1 participant