@rawdash/connector-new-relic
v0.29.2
Published
Rawdash connector for New Relic — NRQL alert conditions, incidents, and user-declared NRQL metric queries via NerdGraph.
Readme
@rawdash/connector-new-relic
Sync NRQL alert conditions, AI incidents, and user-declared NRQL metric queries from a New Relic account via NerdGraph.
Install
npm install @rawdash/connector-new-relicAuthentication
A New Relic User API key plus the numeric account ID are required. The key is stored as a secret and used to authenticate every NerdGraph GraphQL request.
- Open New Relic -> API keys and create a
Userkey. Ingest-keys are not accepted by NerdGraph. - Find the numeric account ID under New Relic -> Administration -> Access management. The User key must have access to that account.
- Store the User key as a secret and reference it from the connector config as
apiKey: secret("NEWRELIC_USER_KEY"). - Set
accountIdto the numeric account ID, and optionallyregion: "EU"if the data lives on the EU host (api.eu.newrelic.com); defaults toUS(api.newrelic.com).
Configuration
| Field | Type | Required | Description |
| ------------------------ | ------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| apiKey | secret | Yes | New Relic User API key. Create at New Relic -> API keys (User key type, ingest-keys do not work for NerdGraph). |
| accountId | number | Yes | New Relic account ID the User API key has access to. Find it under New Relic -> Administration -> Access management. |
| region | US | EU | No | New Relic data region. Defaults to US (api.newrelic.com); set to EU to use api.eu.newrelic.com. |
| nrqlQueries | array | No | User-declared NRQL queries. Each entry produces newrelic_nrql_metric samples named <name> from the NerdGraph NRQL API. |
| resources | array | No | Which New Relic resources to sync. Omit to sync all of them. |
| incidentsLookbackHours | number | No | Window of NrAiIncident rows to pull on each sync, in hours. Defaults to 168 (7 days). Ignored when since is set by the host. |
| metricsLookbackHours | number | No | Window of NRQL metric samples to pull on each sync, in hours. Defaults to 24. Each user query gets SINCE <lookback> hours ago appended unless the query already declares its own SINCE clause. |
Resources
newrelic_alert_condition(entity) - NRQL alert conditions with name, enabled state, policy id, type, and the underlying NRQL query string.- Endpoint:
GraphQL query: actor.account.alerts.nrqlConditionsSearch { nrqlConditions { ... } }
- Endpoint:
newrelic_alert_violation(event) - AI alert violation events. Each row from the NrAiIncident event type becomes one event with openedAt / closedAt and the underlying condition / policy metadata.- Endpoint:
GraphQL nrql() against SELECT ... FROM NrAiIncident WHERE openedAt > ... - Append-only across syncs; the connector filters NrAiIncident by
openedAtagainstoptions.since(or the configured lookback) to avoid re-emitting old incidents.
- Endpoint:
newrelic_nrql_metric(metric) - User-declared NRQL metric samples, stored asnewrelic_nrql_metric.<query name>. Each NRQL result row is mapped to a single sample using the first numeric, non-timestamp/facet field as the value.- Endpoint:
GraphQL nrql() against the user-declared NRQL query - Dimensions:
queryName,query,facets
- Endpoint:
Example
import {
defineConfig,
defineDashboard,
defineMetric,
secret,
} from '@rawdash/core';
const newRelic = {
name: 'newrelic',
connectorId: 'new-relic',
config: {
apiKey: secret('NEWRELIC_USER_KEY'),
accountId: 1234567,
region: 'US' as const,
nrqlQueries: [
{
name: 'error_rate',
query:
'SELECT percentage(count(*), WHERE error IS true) FROM Transaction TIMESERIES 5 minutes',
},
],
},
};
export default defineConfig({
connectors: [newRelic],
dashboards: {
observability: defineDashboard({
widgets: {
open_violations: {
kind: 'stat',
title: 'Open Alert Violations',
metric: defineMetric({
connector: newRelic,
shape: 'event',
name: 'newrelic_alert_violation',
fn: 'count',
filter: [{ field: 'state', op: 'eq', value: 'CREATED' }],
}),
},
},
}),
},
});Rate limits
NerdGraph enforces per-account NRQL quotas; this connector retries on 429s through the standard HTTP retry policy.
Limitations
- APM-trace deep inspection is out of scope (not dashboard-shaped).
- NRQL queries are single-shot per sync (NRQL does not support cursor pagination); large queries should narrow their
SINCEwindow or useLIMIT MAX. - Incidents are pulled via NRQL on the NrAiIncident event type, which depends on Applied Intelligence being enabled on the account.
- Only NRQL-based alert conditions are synced; legacy V1 condition types are not exposed.
Links
License
Apache-2.0
