Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[APM] Use the outcome field to calculate the transaction error rate chart #75528

Merged
merged 16 commits into from
Sep 7, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import expect from '@kbn/expect';
import { first, last } from 'lodash';
import { FtrProviderContext } from '../../../common/ftr_provider_context';

export default function ApiTest({ getService }: FtrProviderContext) {
Expand Down Expand Up @@ -33,79 +34,32 @@ export default function ApiTest({ getService }: FtrProviderContext) {
before(() => esArchiver.load('8.0.0'));
after(() => esArchiver.unload('8.0.0'));

it('returns the transaction error rate', async () => {
const response = await supertest.get(
`/api/apm/services/opbeans-java/transaction_groups/error_rate?start=${start}&end=${end}&uiFilters=${uiFilters}`
);
describe('returns the transaction error rate', () => {
let errorRateResponse: {
erroneousTransactionsRate: Array<{ x: number; y: number | null }>;
average: number;
};
before(async () => {
const response = await supertest.get(
`/api/apm/services/opbeans-java/transaction_groups/error_rate?start=${start}&end=${end}&uiFilters=${uiFilters}`
);
errorRateResponse = response.body;
});

expect(response.status).to.be(200);
it('has the correct start date', async () => {
expect(first(errorRateResponse.erroneousTransactionsRate)?.x).to.be(1598439600000);
});

expect(response.body).to.eql({
noHits: false,
erroneousTransactionsRate: [
{ x: 1598439600000, y: 0.5 },
{ x: 1598439630000, y: null },
{ x: 1598439660000, y: 0 },
{ x: 1598439690000, y: null },
{ x: 1598439720000, y: 0.14285714285714285 },
{ x: 1598439750000, y: 0 },
{ x: 1598439780000, y: 0 },
{ x: 1598439810000, y: null },
{ x: 1598439840000, y: 0 },
{ x: 1598439870000, y: 0 },
{ x: 1598439900000, y: 0 },
{ x: 1598439930000, y: null },
{ x: 1598439960000, y: 0 },
{ x: 1598439990000, y: 0 },
{ x: 1598440020000, y: 1 },
{ x: 1598440050000, y: null },
{ x: 1598440080000, y: null },
{ x: 1598440110000, y: null },
{ x: 1598440140000, y: 0.6666666666666666 },
{ x: 1598440170000, y: null },
{ x: 1598440200000, y: 0 },
{ x: 1598440230000, y: 0 },
{ x: 1598440260000, y: 0 },
{ x: 1598440290000, y: null },
{ x: 1598440320000, y: 0 },
{ x: 1598440350000, y: 0 },
{ x: 1598440380000, y: 0 },
{ x: 1598440410000, y: null },
{ x: 1598440440000, y: 0 },
{ x: 1598440470000, y: 0 },
{ x: 1598440500000, y: 1 },
{ x: 1598440530000, y: null },
{ x: 1598440560000, y: 0.25 },
{ x: 1598440590000, y: 0 },
{ x: 1598440620000, y: null },
{ x: 1598440650000, y: null },
{ x: 1598440680000, y: 0 },
{ x: 1598440710000, y: 0 },
{ x: 1598440740000, y: null },
{ x: 1598440770000, y: 0 },
{ x: 1598440800000, y: 0 },
{ x: 1598440830000, y: 0 },
{ x: 1598440860000, y: null },
{ x: 1598440890000, y: null },
{ x: 1598440920000, y: 0.3333333333333333 },
{ x: 1598440950000, y: 0.6666666666666666 },
{ x: 1598440980000, y: 0.5 },
{ x: 1598441010000, y: null },
{ x: 1598441040000, y: 0.14285714285714285 },
{ x: 1598441070000, y: 0.6666666666666666 },
{ x: 1598441100000, y: 0 },
{ x: 1598441130000, y: null },
{ x: 1598441160000, y: 0.5 },
{ x: 1598441190000, y: 0 },
{ x: 1598441220000, y: null },
{ x: 1598441250000, y: null },
{ x: 1598441280000, y: 0 },
{ x: 1598441310000, y: 0 },
{ x: 1598441340000, y: null },
{ x: 1598441370000, y: 1 },
{ x: 1598441400000, y: null },
],
average: 0.18894993894993897,
it('has the correct end date', async () => {
expect(last(errorRateResponse.erroneousTransactionsRate)?.x).to.be(1598441400000);
});

it('has the correct number of buckets', async () => {
expect(errorRateResponse.erroneousTransactionsRate.length).to.be(61);
});
Copy link
Member

@sorenlouv sorenlouv Sep 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It think the way we calculated the average was somewhat useful in verifying the error rate values. Without that we should at least verify the first error rate value:

        it('has the correct error rate', async () => {
          expect(first(errorRateResponse.erroneousTransactionsRate)?.y).to.be(...);
        });


it('has the correct calculation for average', async () => {
expect(errorRateResponse.average).to.be(0.25732600732600736);
});
});
});
Expand Down