Skip to content

feat(cursor): add team usage and cost plugin - #9017

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

feat(cursor): add team usage and cost plugin#9017
jbsmith7741 wants to merge 9 commits into
apache:mainfrom
jbsmith7741:feat-cursor

Conversation

@jbsmith7741

Copy link
Copy Markdown
Contributor

Quality check

  • Documentation included — backend/plugins/cursor/README.md, Grafana dashboard notes, cost_reconciliation.sql
  • Test coverage — unit tests (collector_utils, usage_events_extractor, connection_test), E2E extractor fixtures under backend/plugins/cursor/e2e/

Summary

Adds a new Cursor DevLake plugin that ingests Cursor Team Admin API data (members, filtered usage events, billing-cycle spend, and daily usage) into _tool_cursor_* tables, plus Config UI registration and Grafana dashboards for usage and AI cost views.

Backend (backend/plugins/cursor/)

  • Collectors and extractors for /teams/members, /teams/filtered-usage-events, /teams/spend, and /teams/daily-usage-data
  • Stateful/incremental collection patterns, rate-limit handling, and migration scripts for tool-layer schema
  • Fixes: members collector infinite loop; extractor raw params and fractional requestsCosts
  • cost_reconciliation.sql for comparing spend rollups vs usage events after a full billing-cycle backfill

Config UI

  • Plugin registration, connection form (Team Admin API token), icon

Grafana

  • New grafana/dashboards/mysql/cursor-usage.json
  • Cursor panels in ai-cost-efficiency.json and multi-ai-comparison.json

Build

  • Cap concurrent CGO plugin builds (default max 4, override via DEVLAKE_PLUGIN_PARALLELISM) to reduce OOM on small hosts / Docker Desktop

How to verify

  1. make dep && make build (or make godev)
  2. cd backend && go test ./plugins/cursor/...
  3. make e2e-test (or targeted cursor e2e if documented in README)
  4. Config UI: add Cursor connection with Team Admin API key; create blueprint and run pipeline
  5. Grafana: import or refresh cursor-usage dashboard; confirm _tool_cursor_* panels return data

Does this close any open issues?

No

Screenshots

cursor_status cursor_setup cursor_usage

Other Information

  • Tool-layer only; no domain-layer converter (dashboards query _tool_cursor_* directly).
  • Requires Cursor Team/Business plan and Team Admin API key (not user integration keys).

Signed-off-by: Joshua Smith <jbsmith7741@gmail.com>
  * Set collectMembers PageSize to zero so teams/members is fetched once instead of re-inserting the full roster forever.
  * Extend connection test to probe members, spend, and usage events Admin API permissions before pipelines run.
…sCosts

Signed-off-by: Joshua Smith <jbsmith7741@gmail.com>
Signed-off-by: Joshua Smith <jbsmith7741@gmail.com>
  * Add daily usage collector, extractor, and table for per-user adoption metrics.
  * Reorganize Cursor Usage overview panels and update related Grafana dashboards.

Signed-off-by: Joshua Smith <jbsmith7741@gmail.com>
  * Store accepted, total line, and apply counts from daily usage API with migration.
  * Add Grafana panels and fix spend reconciliation to include included spend.

Signed-off-by: Joshua Smith <jbsmith7741@gmail.com>
  * Switch usage events and daily usage extractors to StatefulApiExtractor with versioned one-time full re-extract.
  * Chunk filtered-usage-events into 30-day ranges and add plugin README.

Signed-off-by: Joshua Smith <jbsmith7741@gmail.com>
  * Align cost panels with currencyUSD and stacked daily on-demand versus included spend.
  * Document Enterprise AI Code Tracking gaps in the cursor plugin README.

Signed-off-by: Joshua Smith <jbsmith7741@gmail.com>
  * Limit default parallelism to four with DEVLAKE_PLUGIN_PARALLELISM override to reduce OOM on small hosts.
  * Add Cursor cost_reconciliation.sql queries and remove obsolete README rak_tools reference.

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