[Metrics UI] Use CPU Usage limits for Kubernetes pods when available (#58424)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
2b9dc43158
commit
29fbe395b7
|
@ -7,9 +7,27 @@
|
|||
import { SnapshotModel } from '../../../types';
|
||||
|
||||
export const cpu: SnapshotModel = {
|
||||
cpu: {
|
||||
cpu_with_limit: {
|
||||
avg: {
|
||||
field: 'kubernetes.pod.cpu.usage.limit.pct',
|
||||
},
|
||||
},
|
||||
cpu_without_limit: {
|
||||
avg: {
|
||||
field: 'kubernetes.pod.cpu.usage.node.pct',
|
||||
},
|
||||
},
|
||||
cpu: {
|
||||
bucket_script: {
|
||||
buckets_path: {
|
||||
with_limit: 'cpu_with_limit',
|
||||
without_limit: 'cpu_without_limit',
|
||||
},
|
||||
script: {
|
||||
source: 'params.with_limit > 0.0 ? params.with_limit : params.without_limit',
|
||||
lang: 'painless',
|
||||
},
|
||||
gap_policy: 'skip',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -24,9 +24,23 @@ export const podCpuUsage: TSVBMetricModelCreator = (
|
|||
metrics: [
|
||||
{
|
||||
field: 'kubernetes.pod.cpu.usage.node.pct',
|
||||
id: 'avg-cpu-usage',
|
||||
id: 'avg-cpu-without',
|
||||
type: 'avg',
|
||||
},
|
||||
{
|
||||
field: 'kubernetes.pod.cpu.usage.limit.pct',
|
||||
id: 'avg-cpu-with',
|
||||
type: 'avg',
|
||||
},
|
||||
{
|
||||
id: 'cpu-usage',
|
||||
type: 'calculation',
|
||||
variables: [
|
||||
{ id: 'cpu_with', name: 'with_limit', field: 'avg-cpu-with' },
|
||||
{ id: 'cpu_without', name: 'without_limit', field: 'avg-cpu-without' },
|
||||
],
|
||||
script: 'params.with_limit > 0.0 ? params.with_limit : params.without_limit',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
Loading…
Reference in a new issue