Skip to content

Commit

Permalink
[APM] Services without application metrics display an error (elastic#…
Browse files Browse the repository at this point in the history
  • Loading branch information
cauemarcondes authored and Esteban Beltran committed May 4, 2022
1 parent e68a420 commit 587f9b3
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 587f9b3

Please sign in to comment.