What type of API does New Relic provide?
New Relic offers multiple types of APIs, with the primary ones being:
- GraphQL API (NerdGraph)
NerdGraph is New Relic's main GraphQL API that is recommended for querying data and configuring features. It provides a single API interface for accessing data from various New Relic services.
Key points:
- Uses GraphQL query language
- Single endpoint: https://api.newrelic.com/graphql
- Allows querying exactly the data needed in a single request
- Provides a GraphiQL explorer tool for testing queries
- REST APIs
New Relic also offers several REST APIs for specific purposes:
- Insights API
- Synthetics API
- Other REST APIs for certain features
- Telemetry APIs
These APIs allow sending telemetry data to New Relic:
- Metric API
- Event API
- Log API
- Trace API
Best practices:
- Use NerdGraph (GraphQL) as the primary API when possible
- REST APIs are still used for some functionality not yet in NerdGraph
- Choose the appropriate Telemetry API based on the type of data being sent
In summary, while New Relic offers multiple API types, their main and recommended API is the GraphQL-based NerdGraph, with REST and Telemetry APIs available for specific use cases.
Does the New Relic API have webhooks?
Yes, the official New Relic API does support webhooks. Here are the key points about New Relic webhooks:
Webhook Support
- New Relic offers webhook functionality as part of their Alerts product.
- Webhooks allow you to send data from New Relic to external platforms without requiring a custom SDK or integration.
Types of Events
You can subscribe to the following types of events via New Relic webhooks:
- Alerts - Webhooks can be triggered when alert thresholds are crossed.
- Deployments - Notifications can be sent when deployments occur in your applications.
Webhook Payload
- The webhook payload is sent as a JSON document via HTTP POST.
- For alerts, the payload includes information like description of the event, link back to New Relic, application name, and alert threshold details.
- For deployments, a separate JSON payload is sent with deployment details.
Setting Up Webhooks
- Webhooks can be configured in the New Relic UI under Account Settings > Alert integrations > Webhook tab.
- You need to provide an endpoint URL where New Relic will send the webhook POST requests.
- The payload can be customized to include specific New Relic information.
Best Practices
- Test the endpoint and payload separately before combining them.
- Use a JSON linter to validate payload syntax.
- Consider using Basic Authentication and Custom Headers for additional security and information.
In summary, New Relic's webhook support allows you to receive real-time notifications for alerts and deployments, enabling integration with external systems and custom workflows.
Rate Limits and other limitations
Here are the key points about the API Rate Limits for the New Relic API:
General Limits
-
The Metric API has rate limits that apply at the individual account level.
-
Default limits for data points per minute (DPM) and cardinality range from 3 million for free accounts up to 10.2 million for some paying accounts.
-
DPM and cardinality can be increased to 15 million on request for paying organizations.
-
The maximum number of payloads per minute is 100,000 by default, but can be adjusted higher on a case-by-case basis.
Specific Rate Limits
- Max data points per minute (DPM): 3-15 million
- Max unique time series (cardinality) per account per day: 1-15 million
- Max unique time series (cardinality) per metric name per day: 100,000
- Max payloads per minute: 100,000
- Max attributes per metric: 100
Rate Limit Behavior
- If the DPM limit is exceeded, the API returns a 429 response for the remainder of the minute with a Retry-After header.
- If the cardinality limit is exceeded in a 24 hour period, raw data is still stored but aggregate rollups are not created for the rest of the day.
- If more than 100,000 POST requests are made to the Metric API within a minute, it returns 429 responses for the rest of that minute.
Other API Limits
- NerdGraph API has a limit of 25 concurrent requests per user.
- NRQL queries via API are limited to 3,000 queries per account per minute.
- Query duration limits range from 1-10 minutes depending on the data plan.
Best Practices
- Monitor your usage using the Limits UI and provided NRQL queries.
- Consider creating larger payloads to reduce the number of API requests if hitting limits.
- Contact New Relic support to request limit increases if needed.
By understanding and adhering to these rate limits, you can ensure smooth operation when using the New Relic API. It's important to monitor your usage and optimize your API calls to stay within the limits.
Latest API Version
Based on the search results provided, here are the key points regarding the most recent version of the New Relic API:
-
The most recent and recommended API for querying New Relic data is NerdGraph, which is a GraphQL API.
-
NerdGraph is New Relic's newest API and is their attempt to bring together functionality from some of their older APIs in one place.
-
While NerdGraph is the recommended API, there is still some functionality that can only be done with the REST APIs, which is why some organizations still use them.
-
For querying data and configuring various New Relic features, NerdGraph is the recommended API to use.
-
The search results do not provide a specific version number for the NerdGraph API.
-
For the New Relic Agent API, which is a different component, the most recent version mentioned in the search results is 10.28.0.
Key points to consider:
- New Relic has multiple APIs for different purposes, with NerdGraph being the newest and recommended for most use cases.
- The REST APIs are still in use for certain functionalities not yet available in NerdGraph.
- The version numbers for different New Relic components (like the Agent API) may not directly correspond to the version of the main API (NerdGraph).
It's important to note that the search results don't provide a specific version number for the NerdGraph API itself. To get the most up-to-date information on the latest version of the New Relic API, it would be best to check the official New Relic documentation or developer resources directly.
How to get a New Relic developer account and API Keys?
Sign up for a New Relic account
-
Go to the New Relic website (newrelic.com) and sign up for a free account.
-
Complete the registration process to create your New Relic organization and account.
Generate API keys
-
Log in to your New Relic account.
-
Go to the API keys page: From the user menu, click "API keys".
-
Click "Create a key" to generate a new API key.
-
Select the appropriate key type:
- User key: Recommended for most API integrations, including NerdGraph
- Ingest - License key: For reporting data to New Relic
- Browser key: For browser monitoring
-
Give your key a name and description.
-
Copy and securely store the generated API key.
Key points to consider
- New Relic offers multiple API types, including NerdGraph (GraphQL API) and REST APIs.
- NerdGraph is recommended for most new integrations.
- Different keys are used for different purposes - ingest, querying, configuration, etc.
- Rotate API keys periodically as a security best practice.
- EU accounts may have some differences in API endpoints and key formats.
Best practices
- Use different keys for different applications/data sources.
- Assign appropriate user permissions to restrict API key access.
- Review the API documentation for the specific integration you want to build.
- Start with the free tier to experiment before upgrading to a paid plan if needed.
By following these steps, you can set up a New Relic developer account and obtain the necessary API keys to create integrations. Be sure to refer to New Relic's documentation for detailed guidance on using specific APIs and building integrations.
What can you do with the New Relic API?
Based on the search results provided, here is a list of data models you can interact with using the New Relic API, along with what is possible for each:
Metrics
- Send dimensional metrics to New Relic from any source using the Metric API
- Query metric data using NRQL, e.g.
SELECT * FROM Metric
- Metrics are increasingly aggregated into larger time buckets as time passes
- Can query APM metric timeslice data and some infrastructure data as dimensional metrics
Events
- Send custom event data to New Relic using the Event API
- Query event data using NRQL, e.g.
SELECT * FROM Transaction
- Events have multiple attributes (key-value pairs) attached
- Can turn events into metrics to increase data availability
- Event sampling may occur for systems generating large numbers of events
Logs
- Send log data to New Relic using the Log API
- Query log data using NRQL, e.g.
SELECT * FROM Log
- Log data is reported with multiple attributes attached
- Can view logs alongside APM data
Traces
- Send distributed tracing data (Span data) to New Relic using the Trace API
- Query trace data using NRQL, e.g.
SELECT * FROM Span
- Trace data is reported as Span objects with multiple attributes attached
- Provides a dedicated UI for understanding and analyzing traces
Additional Capabilities
- Use NerdGraph (GraphQL API) to query data and configure various New Relic features
- Use REST API for some functionality not yet available in NerdGraph
- Access APM-specific data and configurations using NerdGraph APM docs
- Use agent-specific APIs to customize agent behavior and report custom data
- Retrieve data from and push data to New Relic tools using the REST API
- Configure features and perform delete operations via the REST API
Key Points
- New Relic ingests billions of telemetry data points every minute
- The underlying database (NRDB) provides power, speed, and scalability for monitoring performance across entire landscapes
- API Explorer shows only the API functions available for your particular New Relic account
- Insights product has a separate API for retrieving New Relic data in different ways
- Webhooks feature can be used for integrating with alerts generated by New Relic