Skip to content

Commit ba4015a

Browse files
Merge pull request #55 from newrelic/joe/node-upgrade
Node Upgrade
2 parents fa59b01 + a42ad6c commit ba4015a

File tree

8 files changed

+4146
-34
lines changed

8 files changed

+4146
-34
lines changed

.github/workflows/pr.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup node
2020
uses: actions/setup-node@v1
2121
with:
22-
node-version: 10.x
22+
node-version: 16
2323

2424
- name: Cache node_modules
2525
id: cache-node-modules
@@ -53,7 +53,7 @@ jobs:
5353
- name: Setup node
5454
uses: actions/setup-node@v1
5555
with:
56-
node-version: 10.x
56+
node-version: 16
5757

5858
- name: Cache node_modules
5959
id: cache-node-modules
@@ -99,7 +99,7 @@ jobs:
9999
- name: Setup node
100100
uses: actions/setup-node@v1
101101
with:
102-
node-version: 10.x
102+
node-version: 16
103103

104104
- name: Cache node_modules
105105
id: cache-node-modules

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Setup Node.js
2222
uses: actions/setup-node@v1
2323
with:
24-
node-version: 10.x
24+
node-version: 16
2525

2626
- name: Cache node_modules
2727
id: cache-node-modules
@@ -59,7 +59,7 @@ jobs:
5959
- name: Setup Node.js
6060
uses: actions/setup-node@v1
6161
with:
62-
node-version: 10.x
62+
node-version: 16
6363

6464
- name: Download Cached Deps
6565
id: cache-node-modules
@@ -170,7 +170,7 @@ jobs:
170170
- name: Setup Node.js
171171
uses: actions/setup-node@v1
172172
with:
173-
node-version: 14
173+
node-version: 16
174174

175175
- name: Install dependencies
176176
run: npm ci

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
16

nerdlets/e2m-gui-nerdlet/account-details.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export default class AccountDetails extends React.Component {
116116

117117
AccountDetails.propTypes = {
118118
filteredMetrics: PropTypes.array,
119-
accountIdFilter: PropTypes.string,
119+
accountIdFilter: PropTypes.number,
120120
cardinalities: PropTypes.array,
121121
cardinalityTotals: PropTypes.object,
122122
timerangeArray: PropTypes.array,

nerdlets/e2m-gui-nerdlet/detail-components/rule-history.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const RuleHistory = ({ ruleId, accountId }) => {
3535
<div className="RuleHistoryWrapper">
3636
<div className="Label">Rule Audit Log</div>
3737
<NrqlQuery
38-
accountId={accountId}
38+
accountIds={[accountId]}
3939
query={`FROM NrAuditEvent SELECT \`actorId\`, \`actionIdentifier\`, timestamp since 36 months ago WHERE actionIdentifier like 'e2m_rule%' and \`targetId\` = '${ruleId}'`}
4040
>
4141
{({ data, error, loading }) => {

nerdlets/e2m-gui-nerdlet/metric-details.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ export default class MetricDetails extends React.Component {
4040
const {
4141
eventRate,
4242
metricRate,
43-
errors
43+
error
4444
} = await calculateVolumeReductionForMetric(this.props.metric);
4545

46-
if (errors) {
47-
console.log(errors); // eslint-disable-line no-console
46+
if (error) {
47+
console.log(error); // eslint-disable-line no-console
4848
Toast.showToast({
4949
title: 'Error',
5050
description:

nerdlets/util/async.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@ export async function calculateVolumeReductionForMetric(metric) {
2828
wheres,
2929
metricName
3030
);
31-
let { data, errors } = await NerdGraphQuery.query(query);
31+
let { data, error } = await NerdGraphQuery.query(query);
3232
let eventRate = null;
3333
let metricRate = null;
34-
if (!errors) {
34+
if (!error) {
3535
try {
3636
eventRate = data.actor.EventRate.nrql.results[0].eventrate;
3737
metricRate = data.actor.MetricRate.nrql.results[0].metricrate;
3838
} catch (err) {
39-
errors = err;
39+
error = err;
4040
}
4141
}
42-
return { eventRate, metricRate, errors };
42+
return { eventRate, metricRate, error };
4343
}
4444

4545
export function createNewRuleGraphQuery(
@@ -172,11 +172,11 @@ export async function getE2MRulesForAccountObj(accounts) {
172172
let e2mRules = [];
173173

174174
for (let i = 0; i < accountBatchArray.length; i++) {
175-
const { data, errors } = await NerdGraphQuery.query(
175+
const { data, error } = await NerdGraphQuery.query(
176176
buildRulesQuery(accountBatchArray[i])
177177
);
178-
if (errors) {
179-
throw errors;
178+
if (error) {
179+
throw error;
180180
}
181181
const rulesForBatch = parseE2MMetricRuleListFromResponse(data);
182182
e2mRules = e2mRules.concat(rulesForBatch);
@@ -187,9 +187,9 @@ export async function getE2MRulesForAccountObj(accounts) {
187187
// NOTE: There seems to be a bug in the SDK for AccountsQuery. I error when I try to
188188
// use it imperatively.
189189
export async function getAccountsForUser() {
190-
const { data, errors } = await AccountsQuery.query();
191-
if (errors) {
192-
throw errors;
190+
const { data, error } = await AccountsQuery.query();
191+
if (error) {
192+
throw error;
193193
}
194194
// Convert accounts array to object for easier processing
195195
return data;
@@ -232,19 +232,19 @@ async function processBatchOfCardinalities(
232232
) {
233233
let failedBatch = false;
234234
try {
235-
const { data, errors } = await calculateCardinalityForRuleBatch(
235+
const { data, error } = await calculateCardinalityForRuleBatch(
236236
batchOfRules,
237237
accountId
238238
);
239-
if (errors) {
240-
const errorStr = JSON.stringify(errors);
239+
if (error) {
240+
const errorStr = JSON.stringify(error.graphQLErrors);
241241
const isDbLimitError = errorStr.includes('limit exceeded');
242242
/* eslint-disable no-console */
243243
console.log('Error loading cardinality with batch: ', errorStr);
244244
/* eslint-enable */
245245
errorCount = errorCount + 1;
246246
if (!isDbLimitError && errorCount < maxVisibileErrors) {
247-
onError(JSON.stringify(errors));
247+
onError(JSON.stringify(error));
248248
}
249249
failedBatch = true;
250250
} else if (data) {

0 commit comments

Comments
 (0)