Newrelic nerdgraph query to grafana

Hi,
I am planning to pull logs data from newrelic to grafana non enterprise version as non enterprise version do not support newrelic integration to grafana plugin.

I have been able to use a wild graph ql data source and create a newrelic graph ql query to pull data from newrelic. Following looks like my query.

Query:
query ( $accountId: Int!, $query: Nrql!){
** actor {**
** user {**
** name**
** }**
** account(id: $accountId) {**
** nrql(query: $query) {**
** results**
** }**
** }**
** }**
}


Variables:

{
** “accountId”: 39######,**
** “query”: "select * from Log "**
}

Parsing options:
Data Path: actor.account.nrql.results
Time path: timestamp

The thing I am struggling to achieve is to use pass grafana time window variable to my query.

Say I select 5 minute window, I want my query to be “select * from Log since 5 minutes ago”

If I select grafana time window to be from 12th nov 2024 2PM to 13th Nov 2024 2PM, I want my query to be "select * from Log since 5 minutes ago SINCE ‘2024-11-12T14:00Z’ UNTIL ‘2024-11-13T14:00Z’

Any help to find grafana time window as variable to my query will be greatly appreciated.

thanks
SJ
1 Like