[APM] Services without application metrics display an error (#131347)

This commit is contained in:
Cauê Marcondes 2022-05-03 12:44:30 -04:00 committed by GitHub
parent 687aad0355
commit ec152a6e9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -44,8 +44,16 @@ const chartBase: ChartBase = {
};
export const percentSystemMemoryUsedScript = {
lang: 'expression',
source: `1 - doc['${METRIC_SYSTEM_FREE_MEMORY}'] / doc['${METRIC_SYSTEM_TOTAL_MEMORY}']`,
lang: 'painless',
source: `
if(doc.containsKey('${METRIC_SYSTEM_FREE_MEMORY}') && doc.containsKey('${METRIC_SYSTEM_TOTAL_MEMORY}')){
double freeMemoryValue = doc['${METRIC_SYSTEM_FREE_MEMORY}'].value;
double totalMemoryValue = doc['${METRIC_SYSTEM_TOTAL_MEMORY}'].value;
return 1 - freeMemoryValue / totalMemoryValue
}
return null;
`,
} as const;
export const percentCgroupMemoryUsedScript = {