RedPlanetHQ/core

New Integration: Sentry

开放

#497 创建于 2026年2月24日

 (0 条评论) (0 个反应) (1 位负责人)TypeScript (184 个派生)auto 404
enhancementgood first issueintegrationnew-featurenew-integration

仓库指标

星标
 (1,930 个星标)
PR 合并指标
 (平均合并 3小时 2分钟) (30 天内合并 10 个 PR)

描述

Description

Add Sentry integration to sync error events, issues, releases, and performance data into CORE.

Reference Implementations

Existing Integrations (use as templates)

  • integrations/github/ - Similar developer tool with event tracking
  • integrations/linear/ - Issue tracking integration
  • integrations/slack/ - For reference

Required Files Structure

integrations/sentry/
├── src/
│   ├── index.ts          # Main entry, OAuth spec
│   ├── schedule.ts       # Sync logic
│   ├── utils.ts          # Sentry API utilities
│   ├── account-create.ts # OAuth setup
│   └── create-activity.ts # Activity formatting
├── package.json
├── tsup.config.ts
└── README.md

Sentry API Integration

OAuth Setup

  • Use OAuth 2.0 (Authorization Code Grant)
  • API Prefix: /api/0/
  • Authorization URL: https://sentry.io/oauth/authorize/
  • Token URL: https://sentry.io/oauth/token/
  • Required scopes:
    • event:read - Read access to events and issues
    • project:read - Read access to projects
    • org:read - Read access to organization data
    • team:read - Read access to teams
    • member:read - Read access to organization members
    • release:read - Read access to releases
    • alerts:read - Read access to alerts and notification rules
  • Access tokens expire after 30 days; use refresh tokens for renewal

Key Endpoints

  • GET /api/0/organizations/ - List organizations
  • GET /api/0/organizations/{org_slug}/projects/ - List projects
  • GET /api/0/projects/{org_slug}/{project_slug}/issues/ - List project issues
  • GET /api/0/organizations/{org_slug}/issues/ - List organization issues
  • GET /api/0/issues/{issue_id}/events/ - List events for an issue
  • GET /api/0/organizations/{org_slug}/events/ - List organization events
  • GET /api/0/organizations/{org_slug}/releases/ - List releases
  • GET /api/0/projects/{org_slug}/{project_slug}/stats/ - Project stats
  • GET /api/0/organizations/{org_slug}/stats_v2/ - Organization stats

Events to Track

  1. Errors & Issues

    • New issues created
    • Issue status changes (resolved, ignored, unresolved)
    • Issue assignments
    • Error frequency spikes
    • First seen / last seen updates
  2. Releases

    • New release deployments
    • Release health changes
    • Commit associations
    • Deploy notifications
  3. Performance

    • Transaction duration anomalies
    • Performance issue detection
    • Alert rule triggers

Implementation Tasks

  • Set up basic integration structure following integrations/github/src/index.ts pattern
  • Implement OAuth 2.0 flow in account-create.ts
  • Create Sentry API utilities in utils.ts
  • Implement sync logic in schedule.ts using issues and events endpoints
  • Convert Sentry events to CORE activity format
  • Add error handling and rate limiting
  • Create integration documentation
  • Add to integrations/README.md

Technical Notes

  • All API requests go to the /api/0/ prefix and return JSON.
  • Rate limiting: Sentry uses response headers X-Sentry-Rate-Limit-Remaining and X-Sentry-Rate-Limit-Reset.
  • Pagination uses cursor-based pagination with Link headers.
  • For self-hosted Sentry instances, the base URL will differ from sentry.io.
  • Webhooks (via Sentry Integration Platform) can provide real-time event delivery.
  • Access tokens expire after 30 days. Implement automatic refresh token rotation.

Resources

Labels

enhancement, integration, new-feature

贡献者指南