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
Show file tree
Hide file tree
Changes from 5 commits
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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions x-pack/plugins/apm/common/elasticsearch_fieldnames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export const TRANSACTION_SAMPLED = 'transaction.sampled';
export const TRANSACTION_BREAKDOWN_COUNT = 'transaction.breakdown.count';
export const TRANSACTION_PAGE_URL = 'transaction.page.url';

export const EVENT_OUTCOME = 'event.outcome';

export const TRACE_ID = 'trace.id';

export const SPAN_DURATION = 'span.duration.us';
Expand Down
11 changes: 11 additions & 0 deletions x-pack/plugins/apm/common/event_outcome.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export enum EventOutcome {
success = 'success',
failure = 'failure',
unknown = 'unknown',
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { mean } from 'lodash';
import { EventOutcome } from '../../../common/event_outcome';
import {
HTTP_RESPONSE_STATUS_CODE,
TRANSACTION_NAME,
TRANSACTION_TYPE,
SERVICE_NAME,
EVENT_OUTCOME,
} from '../../../common/elasticsearch_fieldnames';
import { ProcessorEvent } from '../../../common/processor_event';
import { rangeFilter } from '../../../common/utils/range_filter';
Expand Down Expand Up @@ -42,7 +43,9 @@ export async function getErrorRate({
const filter = [
{ term: { [SERVICE_NAME]: serviceName } },
{ range: rangeFilter(start, end) },
{ exists: { field: HTTP_RESPONSE_STATUS_CODE } },
{
terms: { [EVENT_OUTCOME]: [EventOutcome.failure, EventOutcome.success] },
},
...transactionNamefilter,
...transactionTypefilter,
...uiFiltersES,
Expand All @@ -60,7 +63,7 @@ export async function getErrorRate({
date_histogram: getMetricsDateHistogramParams(start, end),
aggs: {
erroneous_transactions: {
filter: { range: { [HTTP_RESPONSE_STATUS_CODE]: { gte: 400 } } },
filter: { term: { [EVENT_OUTCOME]: EventOutcome.failure } },
},
},
},
Expand Down