Skip to content

Latest commit

 

History

History

time-range-to-nrql

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

timeRangeToNrql

The timeRangeToNrql utility converts the timeRange provided by the New Relic platform into a NRQL compliant time clause.

For instance, a timeRange structured like this:

{
    "timeRange": {
        "begin_time": null,
        "duration": 1800000,
        "end_time": null
    }
}

will return a NRQL clause of SINCE 30 MINUTES AGO

example

import React, { useContext } from 'react';
import { PlatformStateContext } from 'nr1';
import { timeRangeToNrql } from '@newrelic/nr-labs-components';

const myNerdlet = () => {
  const platformState = useContext(PlatformStateContext)
  return (<pre>timeRangeToNrql(platformState)</pre>)
}
export default myNerdlet