Our Data Plus option addresses the maturing observability needs of engineering teams with simple and affordable per-GB pricing by combining our existing data capabilities with industry-leading security, scale, and performance. Included are improvements and new capabilities such as extended data indexing retention, logs obfuscation, FedRAMP, and more for up to 56% in bundled savings at $0.50 per gigabyte.
You’ll also get longer query durations as part of Data Plus. Currently, the original data option allows a query duration of just one minute. Data Plus increases the maximum query duration time for queries using New Relic Query Language (NRQL) and NerdGraph. Specifically, Data Plus customers:
- Can run NRQL queries through NerdGraph for up to 10 minutes
- Can run regular NRQL queries for a maximum of two minutes.
Why should you use NRQL?
As business systems become more complex, you'll sometimes need to search through large datasets to find the information you need. With NRQL (used in the NRQL Query builder or NerdGraph API), you can effectively observe data across your entire tech stack, build custom dashboards and alerts, and investigate your data for answers to business problems. And, with Data Plus' new query duration limits, you can query a larger dataset without your request timing out.
To start utilizing these extended query limits from Data Plus, you can:
- Start with the NRQL query builder for standard NRQL queries.
- For more configurable and longer-running queries, dive into the NerdGraph API.
Watch the next video or continue reading to see how to use NerdGraph to run queries on your larger databases.
Understanding query duration in NerdGraph
With Data Plus, you'll avoid the problems that accompany limited querying time, like increased mean time to detection (MTTD) and lower visibility due to failed queries.
Before getting started, we recommend looking at the NerdGraph explorer tutorial and retrieving your New Relic API key. Once you have it, you will need to retrieve your ID. Here's the NRQL query to do that:
{
actor {
user {
name
id
}
nrql(timeout: 120)
}
}
A synchronous NRQL query duration is suitable for smaller queries like this and most others that don't involve querying millions of data points. However, for larger more complex data volumes, one minute may not provide enough time for the query to retrieve results. In the following example, let's use a NRQL query in NerdGraph to look at transactions from two months ago.
{
actor {
account(id: YOUR_ACCOUNT_ID) {
nrql(query: "SELECT count(*) FROM Transaction since 2 months ago") {
results
}
}
}
}
However, let's say the previous query was unable to pull data from two months ago. If that is the case, you'll see the message NRDB query duration exceeded the set timeout.
So, we'll need to instead query through NerdGraph to obtain our results.
How to use long-running queries with Data Plus
To take advantage of queries that can run for up to ten minutes, you can run NRQL queries via NerdGraph, our GraphQL API. These longer queries are suitable for New Relic instances that process millions of events daily.
{
actor {
account(id: 1) {
nrql(timeout: 120 query: "SELECT count(*) FROM Transaction since 2 months ago, async: true) {
results
queryProgress {
queryId
resultExpiration
retryAfter
retryDeadline
}
}
}
}
}
By utilizing async: true,
this query will run and return results in the background without risk of interruption. When this query completes, you can then retrieve the query search results through this command. We recommend copying and pasting your queryId
to a secure location so you can remember it when running a NerdGraph query and retrieve the results when the query is completed.
{
actor {
nrqlQueryProgress(accounts: YOUR_ACCOUNT_ID, queryID: “YOUR_QUERY_ID”
results
}
}
}
Utilizing NerdGraph queries can also reduce query interruption risk from browser timeouts or HTTP connection failures. You can also allow retrieval of your query results at a later time and queries can be repeated verbatim until it returns results or an error.
Next steps
- Get started by upgrading to the Data Plus pricing model ($0.50 per GB of data ingested).
- See more NerdGraph examples or get started querying your data using NRQL.
- If you’re not already using New Relic, start an account for free. You'll get 100 GB/month of free data ingest, one free full-access user, and unlimited free basic users.
The views expressed on this blog are those of the author and do not necessarily reflect the views of New Relic. Any solutions offered by the author are environment-specific and not part of the commercial solutions or support offered by New Relic. Please join us exclusively at the Explorers Hub (discuss.newrelic.com) for questions and support related to this blog post. This blog may contain links to content on third-party sites. By providing such links, New Relic does not adopt, guarantee, approve or endorse the information, views or products available on such sites.