> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/harness-platform/use-harness-platform/connectors/monitoring-and-logging-systems/add-a-new-relic-connector.md).

# Add a New Relic connector

Add a New Relic connector so Harness can fetch metrics through the NerdGraph or Insights Query API for verification.

New Relic is a cloud-based observability platform that collects and analyzes telemetry from applications and infrastructure, including metrics, events, logs, and traces, which you can query using NRQL (New Relic Query Language). Add a New Relic connector in Harness to let your pipelines query your New Relic data. Harness can then use that data in Continuous Verification to compare application behavior before and after a deployment, helping you confirm a release is healthy or trigger a rollback.

Go to [Overview](https://developer.harness.io/harness-platform/use-harness-platform/connectors/monitoring-and-logging-systems/monitoring-and-logging-systems-connectors-overview.md) for information about all monitoring and logging connectors, such as scopes and delegate selection.

***

## What you will learn from this topic

* How to [add a New Relic connector](#add-a-new-relic-connector) to a Harness project.
* How to configure the [URL, account ID, and API key](#credentials) that Harness uses to authenticate with New Relic.
* How to choose the API key for the NerdGraph or Insights Query API.
* How to choose the [delegates](#delegates-setup) that connect to New Relic and verify the connection.

***

## Before you begin

* **New Relic account**: A New Relic account ID and an API key. Your account's subscription level must be Pro or higher to use New Relic's API. Go to [Introduction to New Relic's REST API Explorer](https://docs.newrelic.com/docs/apis/rest-api-v2/api-explorer-v2/introduction-new-relics-rest-api-explorer) in the New Relic documentation for details.
* **Harness permissions**: Permission to create connectors and secrets in Harness.

***

## Add a New Relic connector

You can add a New Relic connector at the project, org, or account scope. This procedure covers the project scope, and the process is the same for org and account scope.

1. Open your Harness project.
2. In **Project Settings**, select **Connectors**.
3. Click **New Connector**, then select **New Relic** under **Monitoring and Logging Systems**. The New Relic connector settings appear.

### Overview

Configure the identity fields for the connector.

1. In **Name**, enter a name for the connector. Harness generates the **Id** from the name.
2. Optionally, add a **Description** and **Tags**.
3. Click **Continue**.

![New Relic connector overview settings](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-cd1185f70e6ca10edac37c0a2c81ddfe2c1ac6f4%2Fnew-relic-connector-overview.png?alt=media)

### Credentials

Configure the following settings:

1. In **New Relic URL**, select the URL of your New Relic API. The dropdown lists the following URLs:
   * `https://insights-api.newrelic.com/`
   * `https://insights-api.eu.newrelic.com/`
   * `https://api.newrelic.com/v2/`
   * `https://api.eu.newrelic.com/v2/`
2. In **New Relic Account Id**, enter your account ID. To find it, copy the number after `/accounts/` in the URL of the New Relic dashboard.
3. In **Encrypted API Key**, select or create a [Harness encrypted text secret](https://developer.harness.io/harness-platform/use-harness-platform/secrets/add-use-text-secrets.md) that stores the API key for the server.
4. Click **Continue**.

![New Relic connector credentials with the URL, account ID, and API key fields](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-3a8f3a69bd558294497406ed5c0178eac772e6b9%2Fnew-relic-connector-credentials.png?alt=media)

{% hint style="info" %}
**New Relic API support**

New Relic supports multiple APIs. The Harness connector uses the NerdGraph API, or the deprecated New Relic Insights API, which supports NRQL.
{% endhint %}

If you have trouble connecting to the API, use the guidance for the API you selected.

<details>

<summary>NerdGraph API</summary>

* Go to [NerdGraph API](https://docs.newrelic.com/docs/apis/nerdgraph/get-started/introduction-new-relic-nerdgraph/) in the New Relic documentation for the connection steps.
* To access this API, use the `user key` of a specific account.

</details>

<details>

<summary>Insights Query API (deprecated)</summary>

* Go to [Insights query API](https://docs.newrelic.com/docs/apis/insights-apis/query-insights-event-data-api/) in the New Relic documentation to generate the API key.
* If you cannot find the step to generate the **Insights query key**, look for the API key types help in the New Relic help panel.

![New Relic API key types help panel](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-09d5177d9f6d3a27240c6e5670fce5ede86a288e%2Fconnect-to-monitoring-and-logging-systems-17.png?alt=media)

</details>

### Delegates Setup

Select one of the following options:

* **Use any available Delegate**: Harness selects an available delegate at runtime.
* **Only use Delegates with all of the following tags**: Enter the tags of the delegates Harness must use with this connector.

The **Test Delegate Connectivity** list shows the delegates that match your selection. To add a delegate, click **Install new Delegate**.

Click **Save and Continue**.

![New Relic connector delegates setup with the delegate connectivity list](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-4ee15ce5e4521027cd5566d19be981b7e72ef325%2Fnew-relic-connector-delegates-setup.png?alt=media)

### Verify Connection

Click **Finish** after the connection test succeeds. The connector is listed in **Connectors** page.

The usage scope of the connector is inherited from the secrets you use in the settings.

***

## Sample YAML

The following example shows a YAML for the New Relic connector created in this topic.

<details>

<summary>YAML - New Relic connector</summary>

```yaml
connector:
  name: your-newrelic-connector # Replace with a name for your connector
  identifier: yournewrelicconnector # Replace with a unique identifier
  accountIdentifier: youraccountidentifier # Replace with your Harness account identifier
  orgIdentifier: default # Replace with your organization identifier, or remove for account scope
  projectIdentifier: yourprojectidentifier # Replace with your project identifier, or remove for org/account scope
  type: NewRelic
  spec:
    newRelicAccountId: your-newrelic-account-id # Replace with your New Relic account ID
    url: https://insights-api.newrelic.com/ # Replace with the URL of your New Relic API
    apiKeyRef: your-api-key-secret # Replace with a reference to the Harness secret storing your New Relic API key
    ignoreTestConnection: false # Set to true only to skip connector preflight checks
```

</details>

For the full connector YAML schema, including how to skip connector preflight checks, go to [Create a connector using YAML](https://developer.harness.io/harness-platform/use-harness-platform/connectors/create-a-connector-using-yaml.md).

***

## Next steps

* [Use delegate selectors](https://developer.harness.io/harness-platform/use-harness-platform/delegates/delegate/manage-delegates/select-delegates-with-selectors.md): Control which delegates can connect to this connector.
* [Add a text secret](https://developer.harness.io/harness-platform/use-harness-platform/secrets/add-use-text-secrets.md): Store the API key as a Harness secret.
