RedPlanetHQ/core

New Integration: New Relic

開放

#542 建立於 2026年2月24日

 (2 則留言) (0 個反應) (0 位負責人)TypeScript (184 個分叉)auto 404
enhancementgood first issueintegrationnew-featurenew-integration

倉庫指標

星標
 (1,930 顆星)
PR 合併指標
 (平均合併 3小時 2分鐘) (30 天內合併 10 個 PR)

描述

Description

Add New Relic integration to sync observability data, alerts, incidents, deployments, and application performance metrics into CORE.

Reference Implementations

Existing Integrations (use as templates)

  • integrations/github/ - Developer tooling with event tracking
  • integrations/linear/ - Issue/incident management patterns
  • integrations/slack/ - For reference

Required Files Structure

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

New Relic API Integration

OAuth Setup

  • Use API Key authentication (User Key)
  • New Relic provides multiple key types:
    • User API Key: Primary key for NerdGraph and REST API access (header: Api-Key)
    • License Key: For sending telemetry data (ingest only)
    • Browser Key: For browser monitoring
  • Primary API: NerdGraph (GraphQL) - https://api.newrelic.com/graphql
  • Legacy REST API v2: https://api.newrelic.com/v2/ (being deprecated in favor of NerdGraph)
  • EU datacenter: https://api.eu.newrelic.com/graphql
  • Note: REST API Keys are being retired; use User API Keys instead

Key Endpoints

NerdGraph (GraphQL) - Preferred

  • POST /graphql - Single endpoint for all queries and mutations
    • Query actor.account.nrql - Run NRQL queries
    • Query actor.entitySearch - Search monitored entities
    • Query actor.account.alerts.policiesSearch - List alert policies
    • Query actor.account.alerts.nrqlConditionsSearch - List alert conditions
    • Mutation alertsNotificationChannelCreate - Create notification channels
    • Query actor.account.aiIssues.issues - List AI-detected issues
    • Mutation changeTrackingCreateDeployment - Record deployments

REST API v2 (Legacy)

  • GET /v2/applications.json - List applications
  • GET /v2/applications/{id}.json - Get application details
  • GET /v2/applications/{id}/metrics.json - Get application metrics
  • GET /v2/alerts_events.json - List alert events
  • GET /v2/alerts_violations.json - List alert violations
  • GET /v2/deployments.json - List deployments

Events to Track

  1. Alerts & Incidents

    • Alert conditions triggered
    • Incident opened, acknowledged, closed
    • Alert policy changes
    • Notification channel activity
    • AI-powered issue detection
  2. Deployments & Changes

    • Deployment markers recorded
    • Change tracking events
    • Application version updates
    • Configuration changes
  3. Performance & Observability

    • Application error rate spikes
    • Response time anomalies
    • Throughput changes
    • SLA/SLO breaches
    • Infrastructure alerts

Implementation Tasks

  • Set up basic integration structure following integrations/github/src/index.ts pattern
  • Implement User API Key authentication in account-create.ts
  • Create New Relic NerdGraph (GraphQL) utilities in utils.ts
  • Implement sync logic in schedule.ts using NerdGraph queries
  • Convert New Relic events to CORE activity format
  • Add error handling and rate limiting
  • Create integration documentation
  • Add to integrations/README.md

Technical Notes

  • NerdGraph (GraphQL) is the preferred API. The REST API v2 is legacy and being gradually replaced.
  • NerdGraph uses a single endpoint (https://api.newrelic.com/graphql) with GraphQL queries/mutations.
  • Authentication uses the Api-Key header with a User API Key.
  • NRQL (New Relic Query Language) can be executed via NerdGraph for custom metric queries.
  • Rate limits: NerdGraph has a limit of 25 concurrent requests per user. REST API has varying limits per endpoint.
  • New Relic has separate US and EU datacenters; the integration must support both regions.
  • The NerdGraph API Explorer is available at https://api.newrelic.com/graphiql for testing queries.
  • Consider using @newrelic/newrelic-telemetry-sdk for sending custom events.
  • REST API Keys are being retired; ensure the integration uses User API Keys.
  • Data access control can be managed through NerdGraph for teams and roles.

Resources

Labels

enhancement, integration, new-feature

貢獻者指南