Skip to content

Commit

Permalink
addressing PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cauemarcondes committed Apr 2, 2021
1 parent dd8c466 commit 31ee141
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { getProcessorEventForAggregatedTransactions } from '../helpers/aggregate
import { calculateThroughput } from '../helpers/calculate_throughput';
import { withApmSpan } from '../../utils/with_apm_span';

export function getTransactionPerMinute({
export function getTransactionsPerMinute({
setup,
bucketSize,
searchAggregatedTransactions,
Expand All @@ -26,7 +26,7 @@ export function getTransactionPerMinute({
searchAggregatedTransactions: boolean;
}) {
return withApmSpan(
'observability_overview_get_transaction_distribution',
'observability_overview_get_transactions_per_minute',
async () => {
const { apmEventClient, start, end } = setup;

Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/apm/server/routes/observability_overview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import * as t from 'io-ts';
import { setupRequest } from '../lib/helpers/setup_request';
import { getServiceCount } from '../lib/observability_overview/get_service_count';
import { getTransactionPerMinute } from '../lib/observability_overview/get_transaction_per_minute';
import { getTransactionsPerMinute } from '../lib/observability_overview/get_transactions_per_minute';
import { getHasData } from '../lib/observability_overview/has_data';
import { createRoute } from './create_route';
import { rangeRt } from './default_api_types';
Expand Down Expand Up @@ -44,7 +44,7 @@ export const observabilityOverviewRoute = createRoute({
setup,
searchAggregatedTransactions,
}),
getTransactionPerMinute({
getTransactionsPerMinute({
setup,
bucketSize,
searchAggregatedTransactions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
expect(response.status).to.be(200);

expect(response.body.serviceCount).to.be(0);
expect(response.body.transactionCoordinates.length).to.be(0);
expect(response.body.transactionPerMinute.timeseries.length).to.be(0);
});
});
}
Expand All @@ -50,14 +50,15 @@ export default function ApiTest({ getService }: FtrProviderContext) {
expect(response.status).to.be(200);

expect(response.body.serviceCount).to.be.greaterThan(0);
expect(response.body.transactionCoordinates.length).to.be.greaterThan(0);
expect(response.body.transactionPerMinute.timeseries.length).to.be.greaterThan(0);

expectSnapshot(response.body.serviceCount).toMatchInline(`9`);

expectSnapshot(response.body.transactionCoordinates.length).toMatchInline(`31`);
expectSnapshot(response.body.transactionPerMinute.value).toMatchInline(`64.8`);
expectSnapshot(response.body.transactionPerMinute.timeseries.length).toMatchInline(`31`);

expectSnapshot(
response.body.transactionCoordinates
response.body.transactionPerMinute.timeseries
.slice(0, 5)
.map(({ x, y }: { x: number; y: number }) => ({
x: new Date(x).toISOString(),
Expand All @@ -67,23 +68,23 @@ export default function ApiTest({ getService }: FtrProviderContext) {
Array [
Object {
"x": "2020-12-08T13:57:00.000Z",
"y": 0.166666666666667,
"y": 2,
},
Object {
"x": "2020-12-08T13:58:00.000Z",
"y": 5.23333333333333,
"y": 61,
},
Object {
"x": "2020-12-08T13:59:00.000Z",
"y": 4.4,
"y": 36,
},
Object {
"x": "2020-12-08T14:00:00.000Z",
"y": 5.73333333333333,
"y": 75,
},
Object {
"x": "2020-12-08T14:01:00.000Z",
"y": 4.33333333333333,
"y": 36,
},
]
`);
Expand Down

0 comments on commit 31ee141

Please sign in to comment.