Skip to content

Commit

Permalink
[6.5] [APM] Move impact calculation to Elasticsearch (#26443)
Browse files Browse the repository at this point in the history
  • Loading branch information
sorenlouv authored Dec 3, 2018
1 parent 1faf657 commit 1faaca6
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface ITransactionGroupBucket {
'95.0': number;
};
};
sum: { value: number };
sample: {
hits: {
hits: Array<{
Expand All @@ -36,7 +37,7 @@ export const TRANSACTION_GROUP_AGGREGATES = {
transactions: {
terms: {
field: `${TRANSACTION_NAME}.keyword`,
order: { avg: 'desc' },
order: { sum: 'desc' },
size: 100
},
aggs: {
Expand All @@ -47,7 +48,8 @@ export const TRANSACTION_GROUP_AGGREGATES = {
}
},
avg: { avg: { field: TRANSACTION_DURATION } },
p95: { percentiles: { field: TRANSACTION_DURATION, percents: [95] } }
p95: { percentiles: { field: TRANSACTION_DURATION, percents: [95] } },
sum: { sum: { field: TRANSACTION_DURATION } }
}
}
};
Expand Down Expand Up @@ -78,7 +80,7 @@ export function prepareTransactionGroups({
const results = buckets.map((bucket: ITransactionGroupBucket) => {
const averageResponseTime = bucket.avg.value;
const transactionsPerMinute = bucket.doc_count / minutes;
const impact = Math.round(averageResponseTime * transactionsPerMinute);
const impact = bucket.sum.value;
const sample = bucket.sample.hits.hits[0]._source;

return {
Expand Down

0 comments on commit 1faaca6

Please sign in to comment.