New Relic ExecModule
Overview
NewRelicModule runs a synchronous NRQL query against a single New Relic account through NerdGraph. Add it to a workflow to compare latency after a deployment, collect telemetry for an incident, or calculate a recurring operational metric. The query defines the result columns, and the module returns those rows as structured objects for downstream steps.
Usage
- Identify the New Relic account ID and its data region. Create or obtain a New Relic user API key with permission to query that account.
- Set up a
READYNew Relic connection in the Integration Account Console and select it under General > Connection for the New Relic step in Workflow Studio. - Set the module region to match the account. Enter the account ID and a short NRQL query, then test the step with a narrow time window.
- Check
statusbefore using the results. A successful query can return an empty array. If the step fails, use the error code and retryability flag to choose the workflow's next action.
Inputs
| Input | Type | Purpose |
|---|---|---|
accountId | integer | Required New Relic account ID. Accepts a positive 32-bit signed integer. |
query | string | Required NRQL expression beginning with SELECT or FROM. Up to 4,096 characters. |
Outputs
| Output | Type | Meaning |
|---|---|---|
status | string | success or error. |
results | array | New Relic result rows as objects. Fields reflect the selected expressions, aliases, and facets. |
count | integer | Number of returned rows. A row can itself contain a count or another aggregate. |
httpStatus | integer | Provider HTTP status when available. |
attempts | integer | Number of provider request attempts. |
error | object | Sanitized failure with code, message, retryable, and httpStatus when available. |
Use explicit aliases for metrics referenced by downstream mappings. Result rows can contain application telemetry. Select the fields the workflow needs and check which destinations can receive them before forwarding any results.
IntegrationAccount Requirements
Use a saved, READY IntegrationAccount for the new_relic provider. Store a New Relic user API key in its encrypted apiKey field. NerdGraph uses the permissions of that key's user for the selected account. Scope the user's account access to the workflow's purpose. Keep the key in the connection, separate from workflow inputs, NRQL text, and downstream outputs. The workflow must be authorized to use the connection. The connector uses the platform's guarded route for the three regional endpoints.
Configuration
Mapped accountId and query values can be supplied at runtime or saved with the module. Set region in saved module configuration to select a fixed HTTPS endpoint.
| Region | NerdGraph endpoint |
|---|---|
us (default) | https://api.newrelic.com/graphql |
eu | https://api.eu.newrelic.com/graphql |
jp | https://api.jp.newrelic.com/graphql |
Set maxAttempts in saved module configuration to an integer from 1 to 3. The default is 2. Each request attempt has a 20-second timeout.
Operations
The module sends one GraphQL query operation per attempt. It passes the account ID and NRQL expression as variables and selects data.actor.account.nrql.results. The fixed operation supports synchronous NRQL for one account. It has no arbitrary GraphQL input, mutation, cross-account query, asynchronous job, or ingestion operation.
Errors and Failure Modes
Invalid input, a missing or unready connection, and a denied destination stop the step before the provider query. Check the account ID, region, and user's account permissions if the provider rejects a request. Check the query in New Relic's query builder if NerdGraph reports query errors. A GraphQL response can contain errors with HTTP 200. The module reports that as a failure and discards any partial result.
Transient network failures and HTTP 408, 429, 500, 502, 503, and 504 can retry within the attempt budget. If the provider requests a delay above five seconds, use the workflow's retry or scheduling controls. For a response over 5 MiB, reduce the query's time window, narrow the filters, or ask for fewer fields or facets. Errors omit the API key, submitted query text, and raw provider error body.
Example
After a checkout rollout, a workflow queries the prior 15 minutes of transaction telemetry. It can record the result with the rollout and send it to a review step when the observed latency exceeds the team's threshold.
{
"accountId": 1234567,
"query": "SELECT average(duration) AS 'avgDurationSeconds', count(*) AS 'transactions' FROM Transaction WHERE appName = 'checkout' SINCE 15 minutes ago"
}
One successful query might return the following results. New Relic records transaction duration in seconds.
{
"status": "success",
"results": [
{
"avgDurationSeconds": 0.42,
"transactions": 2840
}
],
"count": 1,
"httpStatus": 200,
"attempts": 1
}
Map the returned average and transaction count separately. The transaction count gives reviewers context about the size of the sample during the observation window.
Notes
- Pagination. The operation returns the result of one synchronous query with no continuation cursor. Narrow large queries by time or filter. For repeated comparisons, use explicit time boundaries so each query uses the intended interval.
- Rate limits. New Relic's quotas and account permissions apply. Prefer short windows and targeted filters when several workflow runs can query the same account concurrently.
- API limits. Large historical exports, asynchronous queries, data ingestion, and account administration are outside this module's scope.
- Idempotency and destructive behavior. The query leaves New Relic resources unchanged. Relative time windows, late-arriving events, and retention can change the results of repeated queries.