[Monitoring] Do not use the normalized derivative value (#27416)

* Use the non normalized value

* Update keys used in tests
This commit is contained in:
Chris Roberson 2018-12-21 10:57:35 -05:00 committed by GitHub
parent 9a31e00921
commit 81511dd8ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View file

@ -49,7 +49,7 @@ describe('Beats CPU Utilization Metric', () => {
expect(myUtilizationMetric.calculation(bucket)).toBe(null);
});
it('should return 0 for 0 deriv normalized_value', () => {
it('should return 0 for 0 deriv value', () => {
const myUtilizationMetric = new BeatsCpuUtilizationMetric({
field: 'beats_cpu_utilization',
label: 'stats.cpu.value',
@ -59,12 +59,12 @@ describe('Beats CPU Utilization Metric', () => {
});
const bucket = {
metric_deriv: { normalized_value: -33 }
metric_deriv: { value: -33 }
};
expect(myUtilizationMetric.calculation(bucket)).toBe(null);
});
it('should return gt 0 for gt 0 deriv normalized_value', () => {
it('should return gt 0 for gt 0 deriv value', () => {
const myUtilizationMetric = new BeatsCpuUtilizationMetric({
field: 'beats_cpu_utilization',
label: 'stats.cpu.value',
@ -74,7 +74,7 @@ describe('Beats CPU Utilization Metric', () => {
});
const bucket = {
metric_deriv: { normalized_value: 33 }
metric_deriv: { value: 33 }
};
expect(myUtilizationMetric.calculation(bucket, null, null, 30)).toBe(0.11);
});

View file

@ -145,14 +145,14 @@ export class BeatsCpuUtilizationMetric extends BeatsMetric {
bucketSizeInSeconds
) => {
if (metricDeriv) {
const { normalized_value: metricDerivNormalizedValue } = metricDeriv;
const { value } = metricDeriv;
const bucketSizeInMillis = bucketSizeInSeconds * 1000;
if (
metricDerivNormalizedValue >= 0 &&
metricDerivNormalizedValue !== null
value >= 0 &&
value !== null
) {
return metricDerivNormalizedValue / bucketSizeInMillis * 100;
return value / bucketSizeInMillis * 100;
}
}
return null;