Skip to content

Commit

Permalink
[APM] Move impact calculation to Elasticsearch
Browse files Browse the repository at this point in the history
  • Loading branch information
sorenlouv committed Dec 3, 2018
1 parent 97f0dcb commit 4a2cc02
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ Array [
"field": "transaction.duration.us",
},
},
"durationSum": Object {
"sum": Object {
"field": "transaction.duration.us",
},
},
"p95": Object {
"percentiles": Object {
"field": "transaction.duration.us",
Expand Down Expand Up @@ -41,7 +46,7 @@ Array [
"terms": Object {
"field": "transaction.name.keyword",
"order": Object {
"avg": "desc",
"durationSum": "desc",
},
"size": 100,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
exports[`transactionGroupsTransformer should match snapshot 1`] = `
Array [
Object {
"absoluteImpact": 46073935,
"averageResponseTime": 255966.30555555556,
"impact": 4.369340653255684,
"impact": 4.3693406535517445,
"name": "POST /api/orders",
"p95": 320238.5,
"sample": Object {
Expand Down Expand Up @@ -128,6 +129,7 @@ baz",
"transactionsPerMinute": 5684.210526315789,
},
Object {
"absoluteImpact": 1052209442,
"averageResponseTime": 48021.972616494,
"impact": 100,
"name": "GET /api",
Expand Down Expand Up @@ -254,8 +256,9 @@ baz",
"transactionsPerMinute": 691926.3157894736,
},
Object {
"absoluteImpact": 108011563,
"averageResponseTime": 33265.03326147213,
"impact": 10.256357027900046,
"impact": 10.256357027376065,
"name": "GET /api/orders",
"p95": 58827.489999999976,
"sample": Object {
Expand Down Expand Up @@ -375,8 +378,9 @@ baz",
"transactionsPerMinute": 102536.84210526315,
},
Object {
"absoluteImpact": 23030509,
"averageResponseTime": 32900.72714285714,
"impact": 2.179120743402716,
"impact": 2.1791207411745854,
"name": "GET /log-message",
"p95": 40444,
"sample": Object {
Expand Down Expand Up @@ -496,8 +500,9 @@ baz",
"transactionsPerMinute": 22105.263157894737,
},
Object {
"absoluteImpact": 151019688,
"averageResponseTime": 32554.36257814184,
"impact": 14.344171564855404,
"impact": 14.344171563678346,
"name": "GET /api/stats",
"p95": 59356.73611111111,
"sample": Object {
Expand Down Expand Up @@ -623,8 +628,9 @@ baz",
"transactionsPerMinute": 146494.73684210525,
},
Object {
"absoluteImpact": 23837374,
"averageResponseTime": 32387.73641304348,
"impact": 2.2558112391673664,
"impact": 2.2558112380477584,
"name": "GET /log-error",
"p95": 40061.1,
"sample": Object {
Expand Down Expand Up @@ -744,8 +750,9 @@ baz",
"transactionsPerMinute": 23242.105263157893,
},
Object {
"absoluteImpact": 108250312,
"averageResponseTime": 32159.926322043968,
"impact": 10.279049521913821,
"impact": 10.27904952170656,
"name": "GET /api/customers",
"p95": 59845.85714285714,
"sample": Object {
Expand Down Expand Up @@ -871,8 +878,9 @@ baz",
"transactionsPerMinute": 106294.73684210525,
},
Object {
"absoluteImpact": 101647397,
"averageResponseTime": 27516.89144558744,
"impact": 9.651458993728006,
"impact": 9.651458992731666,
"name": "GET /api/products/top",
"p95": 56064.679999999986,
"sample": Object {
Expand Down Expand Up @@ -999,8 +1007,9 @@ baz",
"transactionsPerMinute": 116652.63157894736,
},
Object {
"absoluteImpact": 3135762,
"averageResponseTime": 21331.714285714286,
"impact": 0.28817488008070574,
"impact": 0.28817487960409877,
"name": "POST /api",
"p95": 30938,
"sample": Object {
Expand Down Expand Up @@ -1122,8 +1131,9 @@ baz",
"transactionsPerMinute": 4642.105263157894,
},
Object {
"absoluteImpact": 36131970,
"averageResponseTime": 17189.329210275926,
"impact": 3.424381788267164,
"impact": 3.424381787142002,
"name": "GET /api/products/:id/customers",
"p95": 39284.79999999999,
"sample": Object {
Expand Down Expand Up @@ -1249,8 +1259,9 @@ baz",
"transactionsPerMinute": 66378.94736842105,
},
Object {
"absoluteImpact": 18494584,
"averageResponseTime": 12763.68806073154,
"impact": 1.747992435179465,
"impact": 1.7479924334286208,
"name": "GET /api/types/:id",
"p95": 30576.749999999996,
"sample": Object {
Expand Down Expand Up @@ -1370,8 +1381,9 @@ baz",
"transactionsPerMinute": 45757.8947368421,
},
Object {
"absoluteImpact": 46648776,
"averageResponseTime": 12683.190864600327,
"impact": 4.4239778511514745,
"impact": 4.4239778504968,
"name": "GET /api/products",
"p95": 35009.67999999999,
"sample": Object {
Expand Down Expand Up @@ -1491,8 +1503,9 @@ baz",
"transactionsPerMinute": 116147.36842105263,
},
Object {
"absoluteImpact": 27018619,
"averageResponseTime": 11257.757916666667,
"impact": 2.558180605423081,
"impact": 2.558180605569336,
"name": "GET /api/types",
"p95": 35222.944444444445,
"sample": Object {
Expand Down Expand Up @@ -1612,8 +1625,9 @@ baz",
"transactionsPerMinute": 75789.47368421052,
},
Object {
"absoluteImpact": 13579338,
"averageResponseTime": 10584.05144193297,
"impact": 1.2808106158729446,
"impact": 1.280810614916383,
"name": "GET /api/orders/:id",
"p95": 26555.399999999998,
"sample": Object {
Expand Down Expand Up @@ -1731,8 +1745,9 @@ baz",
"transactionsPerMinute": 40515.789473684206,
},
Object {
"absoluteImpact": 19398174,
"averageResponseTime": 10548.218597063622,
"impact": 1.8338764008269306,
"impact": 1.8338763992340905,
"name": "GET /api/products/:id",
"p95": 28413.383333333328,
"sample": Object {
Expand Down Expand Up @@ -1852,8 +1867,9 @@ baz",
"transactionsPerMinute": 58073.68421052631,
},
Object {
"absoluteImpact": 18749614,
"averageResponseTime": 9868.217894736843,
"impact": 1.7722323979309487,
"impact": 1.7722323960215767,
"name": "GET /api/customers/:id",
"p95": 27486.5,
"sample": Object {
Expand Down Expand Up @@ -1979,6 +1995,7 @@ baz",
"transactionsPerMinute": 59999.99999999999,
},
Object {
"absoluteImpact": 103858,
"averageResponseTime": 5192.9,
"impact": 0,
"name": "POST unknown route",
Expand Down Expand Up @@ -2110,8 +2127,9 @@ baz",
"transactionsPerMinute": 631.578947368421,
},
Object {
"absoluteImpact": 1680454,
"averageResponseTime": 4694.005586592179,
"impact": 0.1498514997591876,
"impact": 0.1498515000753004,
"name": "GET /is-it-coffee-time",
"p95": 11022.99999999992,
"sample": Object {
Expand Down Expand Up @@ -2232,8 +2250,9 @@ baz",
"transactionsPerMinute": 11305.263157894737,
},
Object {
"absoluteImpact": 1528763,
"averageResponseTime": 4549.889880952381,
"impact": 0.1354336505457395,
"impact": 0.13543365054509587,
"name": "GET /throw-error",
"p95": 7719.700000000001,
"sample": Object {
Expand Down Expand Up @@ -2354,8 +2373,9 @@ baz",
"transactionsPerMinute": 10610.526315789473,
},
Object {
"absoluteImpact": 24934595,
"averageResponseTime": 3504.5108924806746,
"impact": 2.36009934580083,
"impact": 2.3600993453143766,
"name": "GET *",
"p95": 11431.738095238095,
"sample": Object {
Expand Down Expand Up @@ -2481,8 +2501,9 @@ baz",
"transactionsPerMinute": 224684.21052631576,
},
Object {
"absoluteImpact": 998256,
"averageResponseTime": 2742.4615384615386,
"impact": 0.08501029113483448,
"impact": 0.08501028923348058,
"name": "OPTIONS unknown route",
"p95": 4370.000000000002,
"sample": Object {
Expand Down Expand Up @@ -2604,8 +2625,9 @@ baz",
"transactionsPerMinute": 11494.736842105262,
},
Object {
"absoluteImpact": 166023502,
"averageResponseTime": 2651.8784461553205,
"impact": 15.770246498769827,
"impact": 15.770246496477105,
"name": "GET static file",
"p95": 6140.579335038363,
"sample": Object {
Expand Down Expand Up @@ -2712,8 +2734,9 @@ baz",
"transactionsPerMinute": 1977031.5789473683,
},
Object {
"absoluteImpact": 10653452,
"averageResponseTime": 1422.926672899693,
"impact": 1.002712481568783,
"impact": 1.0027124806135428,
"name": "GET unknown route",
"p95": 2311.885238095238,
"sample": Object {
Expand Down
8 changes: 7 additions & 1 deletion x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ interface Bucket {
'95.0': number;
};
};
durationSum: {
value: number;
};
sample: {
hits: {
total: number;
Expand Down Expand Up @@ -57,7 +60,7 @@ export function transactionGroupsFetcher(
transactions: {
terms: {
field: `${TRANSACTION_NAME}.keyword`,
order: { avg: 'desc' },
order: { durationSum: 'desc' },
size: 100
},
aggs: {
Expand All @@ -73,6 +76,9 @@ export function transactionGroupsFetcher(
avg: { avg: { field: TRANSACTION_DURATION } },
p95: {
percentiles: { field: TRANSACTION_DURATION, percents: [95] }
},
durationSum: {
sum: { field: 'transaction.duration.us' }
}
}
}
Expand Down
Loading

0 comments on commit 4a2cc02

Please sign in to comment.