NerdGraph is our GraphQL-format API that lets you query New Relic data and configure some New Relic features. After you sign up for a free New Relic account and install any of our monitoring services, you can get started with NerdGraph.
What is NerdGraph?
NerdGraph is one of several New Relic APIs. NerdGraph is the API we recommend for querying New Relic data and for performing some specific configurations (learn more about features). NerdGraph provides a single API interface for returning data from New Relic's various APIs and microservices. Over time, other configuration capabilities will be added to NerdGraph.
重要
NerdGraph isn't used for data ingest. For that, you'd use our data ingest APIs.
NerdGraph is built using GraphQL, which is an open source API format that allows you to request exactly the data needed, with no over-fetching or under-fetching.
Requirements
Before you get started:
- You need a New Relic account, and with that account, you can access your API that you need to include with queries and mutations.
- User type and assigned roles can affect your NerdGraph permissions. For more details, see Factors affecting access.
Endpoints
The API endpoint you use depends on your data center region:
- Main endpoint:
https://api.newrelic.com/graphql
- Endpoint for accounts using EU data center:
https://api.eu.newrelic.com/graphql
To access the endpoint, you could make calls from your code, use the NerdGraph API explorer, or make a curl
command similar to this:
$curl -X POST https://api.newrelic.com/graphql \> -H 'Content-Type: application/json' \> -H 'API-Key: YOUR_NEW_RELIC_USER_KEY' \> -d '{ "query": "{ requestContext { userId apiKey } }" }'
Use the NerdGraph API explorer
An easy way to experiment with the NerdGraph API is to use the NerdGraph API explorer. For help getting started with this tool, see NerdGraph API explorer tutorial.
NerdGraph functionality
NerdGraph functionality can be broken down into two main categories:
- Querying data. You can fetch data for a variety of purposes, including using it in a programmatic workflow, or building a New Relic app for custom data visualizations.
- Configuring features. There are a variety of configurations available and more will be added over time. You can do things like add tags, configure workloads, or customize "golden metrics."
You can use NerdGraph to return and configure a wide range of data. One way to see what NerdGraph can do is to start building queries and exploring the schema using the NerdGraph explorer.
These are some of the most commonly used NerdGraph features:
- Get data about your monitored entities
- Query your data using NRQL (our query language)
- Create dashboards
Here are all our available NerdGraph docs:
Topic | Tutorials |
---|---|
Account management |
|
Alerts |
|
agents | |
Change tracking | |
Dashboards | |
Cloud integrations (AWS, Azure, GCP) | |
Data management | |
Distributed tracing | |
Entities |
|
Log management | |
Mobile monitoring | |
New Relic apps | |
Querying and charts | |
Service levels | |
Synthetic monitoring | |
Tags | |
Workloads |
NerdGraph terminology
The following are terms that originate with GraphQL, the API format NerdGraph uses.
Term | Definition |
---|---|
Queries and mutations | There are two classes of GraphQL operations:
|
Type | Data in GraphQL is organized into types. Types can be scalars (like strings, numbers, or booleans) or object types. An object type is a custom type made up of a collection of fields. For example, an object type called |
Field | A field represents a piece of information on an object type that can be queried. Fields can be scalars, lists, or objects. For example, a |
Interface | An interface is an abstract type that represents a collection of common fields that other object types can |