Skip to main content

New Relic

CatalogDiscoveryScorecards

New Relic is a performance tracking and analytics tool that helps engineers gain visibility into their software. By integrating New Relic with Cortex, you'll be able to drive deeper insights into:

  • Apdex
  • Dependencies
  • Embedded dashboards
  • Error rates
  • Live entities in your environment
  • OpenTelemetry
  • SLOs
  • Throughput

Setup and configuration

Getting started

In order to connect Cortex to your New Relic instance, you’ll need to create a New Relic user key. New Relic user keys are linked to the account they were created from, so if this account is ever deleted, the integration with Cortex will stop working.

Configuration

Once you've created the user key, you can set up the integration in New Relic settings in Cortex. Click Add New Relic configuration and enter the following information in the modal:

  • Account alias: Name Cortex will associate with a given configuration.
  • Personal key: User key generated in New Relic.
  • Account ID: ID for the account that the user key was generated with.
  • Use EU Region (optional): Enables the EU region of New Relic when toggled on.
caution

If you do not see the settings page you're looking for, you likely don't have the proper permissions and need to contact your admin.

Once you save your configuration, you'll see it listed on the integration's settings page in Cortex. If you’ve set everything up correctly, you’ll see the option to Remove Integration in Settings.

You can also use the Test all configurations button to confirm that the configuration was successful. If your configuration is valid, you’ll see a banner that says “Configuration is valid. If you see issues, please see documentation or reach out to Cortex support.”

Multi-account support

The New Relic integration has multi-account support. You can add a configuration for each additional by repeating the process above.

Each configuration requires an alias, which Cortex uses to correlate the designated with registrations for various entities. Registrations can also use a default configuration without a listed alias. You can edit aliases and default configurations from the New Relic page in your Cortex settings. Select the edit icon next to a given configuration and toggle Set as default on. If you only have one configuration, it will automatically be set as the default.

How to connect Cortex entities to New Relic

Cortex automatically maps dependencies between your services and resources by scanning for resources with specific New Relic tagKeys. By default, a service will have dependencies on any resource with New Relic tag key = "service" and tag value = the service's Cortex tag.

You can customize the tag key names on the New Relic settings page in Cortex.

The mappings to New Relic entities can also be defined by application IDs in the entity descriptor YAML (for APM applications).

Editing the entity descriptor

If you need to override automatic discovery, you can define one of the following blocks in your Cortex entity descriptor.

APM services

New Relic application metrics can be fetched for each entity using application IDs or tags.

x-cortex-apm:
newrelic:
applications:
- applicationId: 1234567
alias: Default-App
- applicationId: 8904321
alias: Another-App
FieldDescriptionRequired
applicationsSpecifies that the APM service should be found by application ID
applicationIDID for the application that the service belongs to
aliasAlias for the configuration in Cortex (only needed if you have opted into multi-account support)
x-cortex-apm:
newrelic:
tags:
- tag: tagKey
value: tagValue
alias: Default-App
FieldDescriptionRequired
tagsSpecifies that the APM service should be found by tag
tagTag key for the APM service(s)
valueTag value for the APM service(s)
aliasAlias for the configuration in Cortex (only needed if you have opted into multi-account support)

Instructions to find your Application ID can be found in the New Relic docs. You can also find the Application ID in the URL in New Relic.

You can also find information on finding and managing entity tags in the New Relic docs.

OpenTelemetry

OpenTelemetry services can be associated with the entity only using tags. For this type of service New Relic doesn't generate application ID.

x-cortex-apm:
newrelic:
tags:
- tag: tagKey
value: tagValue
alias: Default-App
FieldDescriptionRequired
tagsSpecifies that the OpenTelemetry service should be found by tag
tagTag key for the APM service(s)
valueTag value for the APM service(s)
aliasAlias for the configuration in Cortex (only needed if you have opted into multi-account support)

Embeds

Cortex can also embed dashboards from New Relic.

x-cortex-dashboards:
embeds:
- type: newrelic
url: https://chart-embed.service.newrelic.com/example/1a234bc5-d6e7-890f-g123-456h7ij8901
FieldDescriptionRequired
typeSpecifies the source of the embed; in this case, should be newrelic
urlURL for the dashboard

SLOs

SLO can be fetched for each entity using New Relic entity GUID for respective SLO or associated service. Detailed instructions how to obtain entity GUID can be found in New Relic docs.

Fetched SLO information can be found in the Operations and Integrations sections of an entity page.

x-cortex-slos:
newrelic:
- id: MjU5ODYxOXxFWFR8U0VSVklDRV9MRVZFTHiw0TI5ODQ
alias: my-default-alias
- id: MjU5ODYxOXxFWFR8U0VSVklDRV9MRVZFTHiw0TI76QB
alias: my-other-alias
- id: MjU5ODYxOXxFWFRAB6VSVklDRV9MRVZFTHiw0TI76QD
FieldDescriptionRequired
idNew Relic entity guid for the SLO or the associated service; if you use the GUID for a parent service, all SLOs associated with it will be imported into Cortextrue
aliasAlias for the configuration in Cortex (only needed if you have opted into multi-account support)

If the alias is not specified, like with the third ID above, Cortex will use the default configuration.

tip

If you use the GUID for a parent service to define the SLOs for a given entity, Cortex will import all SLOs associated with that service.

Dependencies

Cortex automatically syncs dependencies from New Relic into Cortex. By default, we map entries found in New Relic's entity map using the entity identifier (x-cortex-tag).

For example, if you have two entities "entity-one" and "entity-two" that have a dependency edge in New Relic's entity map, we expect both entities to exist in Cortex with the same entity identifiers.

Expected Results

Entity pages

When entities are tied to New Relic, error rate and Apdex data will appear in the Operations block on their details pages. You'll also be able to see the number of SLOs that are passing and/or failing.

More data is available under the Operations tab in the New Relic Summary block:

  • Throughput
  • Response time
  • Error rate
  • Apdex target
  • Apdex score
  • Host count
  • Instance count
  • Concurrent instance count

And in the Service level objectives block under the Operations tab, you can see the number of SLOs passing and/or failing. Click into either of these to see the target and current SLO score.

If you've defined dashboard(s) in a YAML, you'll be able to view the graphs from an entity's details page. Open the Dashboard page from the Integrations tab in the sidebar. All dashboards defined in the descriptor will be embedded on this page.

info

New Relic dashboards must be defined individually for each entity.

Integrations - New Relic

The same data in the New Relic Summary block will appear on the New Relic page under Integrations in the sidebar. In the SLOs section, you'll be able to see a list of all SLOs tied to that entity, along with the target and current SLO score. The SLO name will display in green when passing and orange when failing.

Scorecards and CQL

With the New Relic integration, you can create Scorecard rules and write CQL queries based on New Relic performance metrics.

See more examples in the CQL Explorer in Cortex.

Application summary

Fetch high-level summary data for a given New Relic application.

This expression enables you to score entities on reliability metrics:

  • Apdex score
  • Apdex target
  • Concurrent stance count
  • Error rate
  • GUID
  • Host count
  • ID
  • Instance count
  • Name
  • Response time
  • Throughput
  • Type

If there is not an application ID set in the entity descriptor, a Scorecard rule based on this expression will fail.

Definition: newrelic.applications()

Example

You can use this expression in a Scorecard rule to make sure entities' Apdex score is at least 0.9:

newrelic.applications().all(application) => application.apdexScore >= 0.9
New Relic application is set

Check if entity has a New Relic application ID set in its entity descriptor.

This can be a good companion to other rules that will fail without a defined application ID, like newrelic.applications().

Definition: newrelic (==/!=) null

Example

You can use this expression in an onboarding Scorecard to make sure that entities have a New Relic application ID set:

newrelic != null
Raw NRQL query

Execute an arbitrary NRQL query and capture the raw JSON back out.

This expression is not inherently tied to a single entity and requires a custom query to pull the specific data what you need. The raw JSON can be parsed using JQ or Open Policy Agent language.

Definition: newrelic.rawNrql(query: Text)

Examples

You can use this expression in a Scorecard measuring performance to make sure that the 95th percentile of latency has been less than 500ms in the last 3 weeks for a given entity:

jq(newrelic.rawNrql("SELECT percentile(duration) FROM PageView WHERE = '" + newrelic.applications().firstOrNull().name + "' SINCE 3 weeks ago COMPARE WITH 1 week AGO TIMESERIES AUTO"), "[.[].\"percentile.duration\".\"95\"] | add / length") < 500

Or you can use this expression in a CQL report to read the timeseries of the process.cpu.usage metric for the last 30 minutes using NRQL and a New Relic service GUID:

newrelic.rawNrql("SELECT latest(`process.cpu.usage`) FROM Metric WHERE `entity.guid` = '"+newrelic.applications().getOrNull(0)?.guid+"' SINCE 30 MINUTES AGO TIMESERIES")
SLOs

SLOs associated with the entity via ID or tags. You can use this data to check whether an entity has SLOs associated with it and if those SLOs are passing.

SLOs

  • History
  • ID
  • Name
  • Operation
  • Remaining budget
  • SLI value
  • SLO target
  • Source
  • Thresholds

SLO datum (timeseries data for the SLI)

  • Datum
  • Ts

Named threshold (SLOs thresholds like "warning" or "error" states)

  • Name

  • Threshold

    Definition: slos

Examples

You can use SLO data from New Relic to evaluate entities in Scorecards. For an onboarding Scorecard, you can make sure that entities have at least 1 SLO defined:

slos().length > 0

For a project standards Scorecard, you can also use this expression to make sure entities are passing all of their SLOs:

slos().all((slo) => slo.passing) == true

OpenTelemetry metrics

OpenTelemetry metrics available in the New Relic Metrics Exlorer can be accessed or manipulated for a given entity by combining CQL and NRQL native query.

Accessing OpenTelemetry data with CQL and NRQL

In Cortex, you can access OpenTelemetry data by incorporating a raw NRQL query into this CQL expression with the associated New Relic GUID.

Definition: newrelic.applications().getOrNull(0)?.guid

Example

You can execute raw NRQL query to collect average http.server.requests in a CQL report:

newrelic.rawNrql("SELECT average(`http.server.requests`) FROM Metric WHERE `entity.guid` = '"+newrelic.applications().getOrNull(0)?.guid+"' SINCE 7 DAYS AGO")

Relationship graphs

Dependencies detected from New Relic will appear in Relationship graphs.

Still need help?

The following are all the ways to get assistance from our customer engineering team. Please use the option that is best for your users:

  • Email: help@cortex.io, or open a support ticket in the in app Resource Center
  • Chat: Available in the Resource Center
  • Slack: Users with a connected Slack channel will have a workflow added to their account. From here, you can either @CortexTechnicalSupport or add a :ticket: reaction to a question in Slack, and the team will respond directly.

Don’t have a Slack channel? Talk with your customer success manager.