Skip to main content
The newrelic reporter pushes run results to the New Relic Event API. Each test run is sent as a MomenticRun custom event and each run group as a MomenticRunGroup summary event, which can be queried with NRQL.

1. Configure the reporter

Add a reporting.newrelic block to momentic.config.yaml:
momentic.config.yaml
name: my-project

reporting:
  newrelic:
    region: US # or EU, selects the ingest endpoint
    accountId: "1234567"
    licenseKey: ${NEW_RELIC_LICENSE_KEY}
    attributes: # optional static tags added to every event
      service: checkout
      team: payments
  • region defaults to US. Use EU for accounts in New Relic’s EU data center.
  • licenseKey is optional. If omitted, the reporter reads the NEW_RELIC_LICENSE_KEY environment variable. Use an ingest license key.
  • attributes adds static tags (e.g. service, team) to every event, useful when multiple projects report into the same account.
  • accountId, licenseKey, and attributes values all support ${ENV_VAR} interpolation.

2. Run with the New Relic reporter

Pass --reporter newrelic to momentic run:
npx momentic run --reporter newrelic
Pass --reporter multiple times to combine reporters:
npx momentic run --reporter newrelic --reporter junit --reporter-dir reports

3. Event reference

MomenticRun is sent once per executed test:
AttributeDescription
runId, runGroupIdMomentic run and run group identifiers
testId, testName, filePathTest identity
statusPASSED, FAILED, or CANCELLED
startedAt, finishedAt, durationMsTiming
attempts, quarantined, recoveredRetry and quarantine state
labelsComma-separated test labels
environment, baseUrlEnvironment the test ran against
failureReason, failureMessageFailure details (failed runs only)
classificationCategoryAI failure classification category
classificationReasoningAI failure classification explanation
runUrlLink to the run in the Momentic dashboard
gitBranch, gitCommit, gitRepositoryGit metadata
ciRunUrlCI build link (GitHub Actions, GitLab, Buildkite, CircleCI)
MomenticRunGroup is sent once per run as a summary:
AttributeDescription
runGroupId, runGroupUrlRun group identity and link
total, executed, skipped, passed, failed, cancelled, quarantined, recoveredResult counts
passRatepassed / executed
startedAt, finishedAt, durationMsTiming
environment, suiteName, git and CI attributesShared context
Custom attributes from the config are added to both event types.

4. Query in New Relic

Pass rate per test over the last day:
SELECT
  percentage (
    count(*),
    WHERE
      status = 'PASSED'
  )
FROM
  MomenticRun FACET testName SINCE 1 day ago
Alert on run group pass rate:
SELECT
  latest (passRate)
FROM
  MomenticRunGroup
WHERE
  environment = 'production'