Skip to content

Commit 0917a1f

Browse files
authored
Merge pull request #61 from newrelic/fix_update_account_limit
Fix - Update account cardinality limit ti 10M and move to separate file.
2 parents 2a6732d + a5eb3c0 commit 0917a1f

File tree

9 files changed

+13824
-3200
lines changed

9 files changed

+13824
-3200
lines changed

.DS_Store

6 KB
Binary file not shown.

launchers/.DS_Store

6 KB
Binary file not shown.

nerdlets/.DS_Store

6 KB
Binary file not shown.

nerdlets/e2m-gui-nerdlet/rule-table.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ import PropTypes from 'prop-types';
33

44
import { getCardinalityForRule } from '../util/cardinality-helper';
55
import { toggleMetric } from '../util/async';
6+
import { CARDINALITY_LIMIT_PER_RULE } from '../util/limits';
67

78
import EnableSwitch from './table-components/enable-switch';
89
import CardinalityPercent from './table-components/cardinality-percent';
910

10-
const CARDINALITY_LIMIT = 100000;
11-
1211
export default class TableWrapper extends React.Component {
1312
render() {
1413
const {
@@ -50,7 +49,7 @@ export default class TableWrapper extends React.Component {
5049
m.accountId,
5150
m.id
5251
);
53-
const violation = cardinality > CARDINALITY_LIMIT;
52+
const violation = cardinality > CARDINALITY_LIMIT_PER_RULE;
5453
const selected =
5554
metricSelection &&
5655
metricSelection.id === m.id &&
@@ -82,7 +81,7 @@ export default class TableWrapper extends React.Component {
8281
</td>
8382
<CardinalityPercent
8483
cardinality={cardinality}
85-
limit={CARDINALITY_LIMIT}
84+
limit={CARDINALITY_LIMIT_PER_RULE}
8685
enabled={m.enabled}
8786
/>
8887
<EnableSwitch

nerdlets/util/async.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import {
99
import { parseCardinalityBatchResponse } from './cardinality-helper';
1010

1111
import { parseNRQL, chunk, parseE2MMetricRuleListFromResponse } from './misc';
12+
import {
13+
CARDINALITY_LIMIT_PER_ACCOUNT,
14+
CARDINALITY_LIMIT_PER_RULE
15+
} from './limits';
1216

1317
import {
1418
buildCardinalityTimeseriesQueryForBatch,
@@ -380,9 +384,6 @@ export async function loadCardinalityForAllEnabledRules(
380384
return cardinalitiesForAccount;
381385
}
382386

383-
const CARDINALITY_LIMIT_PER_RULE = 100000;
384-
const CARDINALITY_LIMIT_PER_ACCOUNT = 5000000;
385-
386387
function determineRuleCardinalityViolation(results) {
387388
const cardinalityArray = results.map(i => i.cardinality);
388389
const timeseriesMax = Math.max(...cardinalityArray);

nerdlets/util/chart-helper.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1+
import {
2+
CARDINALITY_LIMIT_PER_ACCOUNT,
3+
CARDINALITY_LIMIT_PER_RULE
4+
} from './limits';
5+
16
export function getTimeRangeFromCardinality(cardinality) {
27
return cardinality.beginTimeSeconds;
38
}
49

510
function getColorForAccountTotal(chartdata) {
611
let violation = false;
712
for (let i = 0; i < chartdata.length; i++) {
8-
if (chartdata[i].y > 5000000) {
13+
if (chartdata[i].y > CARDINALITY_LIMIT_PER_ACCOUNT) {
914
violation = true;
1015
break;
1116
}
@@ -16,7 +21,7 @@ function getColorForAccountTotal(chartdata) {
1621
function getColorForRule(chartdata) {
1722
let violation = false;
1823
for (let i = 0; i < chartdata.length; i++) {
19-
if (chartdata[i].y > 100000) {
24+
if (chartdata[i].y > CARDINALITY_LIMIT_PER_RULE) {
2025
violation = true;
2126
break;
2227
}
@@ -54,11 +59,11 @@ export function buildCardinalityChartData(
5459
data: nrqlStoreDataFormat
5560
? timerangeArray.map(x => ({
5661
x,
57-
y: 100000 /* This is the per rule max */
62+
y: CARDINALITY_LIMIT_PER_RULE /* This is the per rule max */
5863
}))
5964
: cardinalities[0].map(cardinality => ({
6065
x: cardinality.beginTimeSeconds,
61-
y: 100000
66+
y: CARDINALITY_LIMIT_PER_RULE
6267
}))
6368
}
6469
];
@@ -146,7 +151,7 @@ export function buildCardinalityTotalsChartData(
146151
},
147152
data: timerangeArray.map(x => ({
148153
x,
149-
y: 5000000 /* This is the max total amount */
154+
y: CARDINALITY_LIMIT_PER_ACCOUNT /* This is the max total amount */
150155
}))
151156
}
152157
];

nerdlets/util/limits.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const CARDINALITY_LIMIT_PER_ACCOUNT = 10000000;
2+
export const CARDINALITY_LIMIT_PER_RULE = 100000;

0 commit comments

Comments
 (0)