Skip to content

Commit

Permalink
Merge pull request #1 from newrelic-experimental/fix-awol-settings
Browse files Browse the repository at this point in the history
Breaking change: nrqlQueries config setting renamed due to platform changes
  • Loading branch information
jsbnr authored Nov 14, 2023
2 parents 800c9c2 + 3899e7c commit 68bb98b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions visualizations/aligned-timeseries/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ const defaultColors=['#e6194b', '#3cb44b', '#ffe119', '#4363d8', '#f58231', '#91


function AlignedTimeseries(props) {
const {nrqlQueries, alignment, colorMap} = props;
const {customNrqlQueries, nrqlQueries, alignment, colorMap} = props;
const [queryResults, setQueryResults] = useState(null);

//cinfug option used to be called "nrqlQueries" but this hit a bug with a pltaform release. To be deployable without immediately breaking charts we support the old config, but you will need to upgrade.
let NRQLqueries = (customNrqlQueries !== null && customNrqlQueries !== undefined) ? customNrqlQueries : (nrqlQueries !== null && nrqlQueries!==undefined) ? nrqlQueries : [];

let colors = colorMap ? colorMap.split(',') : defaultColors


useEffect(async () => {
let promises=nrqlQueries.map((q)=>{return NrqlQuery.query({accountIds: [q.accountId], query: q.query,formatTypeenum: NrqlQuery.FORMAT_TYPE.CHART})})
let promises=NRQLqueries.map((q)=>{return NrqlQuery.query({accountIds: [q.accountId], query: q.query,formatTypeenum: NrqlQuery.FORMAT_TYPE.CHART})})
let data = await Promise.all(promises)
setQueryResults(data)
},[props]);
Expand Down Expand Up @@ -58,7 +61,7 @@ function AlignedTimeseries(props) {
row.x= row.x + offset
})
}
r.data[0].metadata.color=nrqlQueries[idx].color ? nrqlQueries[idx].color : colors[idx % colors.length]
r.data[0].metadata.color=NRQLqueries[idx].color ? NRQLqueries[idx].color : colors[idx % colors.length]
}
})

Expand Down
2 changes: 1 addition & 1 deletion visualizations/aligned-timeseries/nr1.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"type": "string"
},
{
"name": "nrqlQueries",
"name": "customNrqlQueries",
"title": "NRQL Queries",
"type": "collection",
"items": [
Expand Down

0 comments on commit 68bb98b

Please sign in to comment.