[Monitoring] Do not use the normalized derivative value (#27416)
* Use the non normalized value * Update keys used in tests
This commit is contained in:
parent
9a31e00921
commit
81511dd8ff
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue