Skip to content

Commit

Permalink
changing transaction count to transaction rate per second
Browse files Browse the repository at this point in the history
  • Loading branch information
cauemarcondes committed Jun 30, 2020
1 parent 2fe0051 commit d7cb371
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('Observability dashboard data', () => {
transactions: {
type: 'number',
label: 'Transactions',
value: 6,
value: 2,
color: '#6092c0',
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { i18n } from '@kbn/i18n';
import { sum } from 'lodash';
import mean from 'lodash.mean';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { FetchDataParams } from '../../../../observability/public/data_handler';
import { ApmFetchDataResponse } from '../../../../observability/public/typings/fetch_data_response';
Expand Down Expand Up @@ -47,7 +47,8 @@ export const fetchLandingPageData = async (
'xpack.apm.observabilityDashboard.stats.transactions',
{ defaultMessage: 'Transactions' }
),
value: sum(transactionCoordinates.map((coordinates) => coordinates.y)),
value:
mean(transactionCoordinates.map((coordinates) => coordinates.y)) || 0,
color: theme.euiColorVis1,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ export async function getTransactionCoordinates({
},
});

const deltaAsMinutes = (end - start) / 1000 / 60;

return (
aggregations?.distribution.buckets.map((bucket) => ({
x: bucket.key,
y: bucket.doc_count,
y: bucket.doc_count / deltaAsMinutes,
})) || []
);
}

0 comments on commit d7cb371

Please sign in to comment.