Store NrqlQuery Component Results

Attempting to use the NrqlQuery.Query component to bring in some stats from various queries, store the results (in raw JSON) as some variable in the state, and use these JSON fields when rendering to contextualize other data.

Is it possible to use the general structure outlined in Is it possible to query the Insights API from a Nerdpack? - #4 by RyanVeitch ?

I attempted to loosely follow the componentDidMount structure (would be ideal for current query) and can’t seem to get any response from NrqlQuery.Query. Account ID and query in question have been validated and other queries on the same dashboard receive data through said account ID, however those are queries populated during rendering.

In my case, formatted as below, resp would not be populated, so the variable in the render method tied to the state remains undeclared, and the page fails when it attempts to render the portion referencing that const. Only note I see in the console that immediately stuck out was ‘queries is deprecated, use nrqlQueries instead’ (Maybe a name change?, but I was unsuccessful in finding any other documentation referencing that).

componentDidMount() {
const resp = NrqlQuery.query({accountId: , query: “XXXXX” });

Any of your valuable expertise would be greatly appreciated!


1 Like

@ARatzell Thank you for your patience in getting a response. Since this category is not monitored by support it seems like maybe your question has stumped our community members. Were you able to find a solution?