Skip to content

Commit

Permalink
[APM] Filter throughput on transaction name (#110645)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
dgieselaar and kibanamachine authored Sep 1, 2021
1 parent 31057f7 commit 0d4fb4f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ export function ServiceOverviewThroughputChart({
height,
environment,
kuery,
transactionName,
}: {
height?: number;
environment: string;
kuery: string;
transactionName?: string;
}) {
const theme = useTheme();

Expand Down Expand Up @@ -80,6 +82,7 @@ export function ServiceOverviewThroughputChart({
transactionType,
comparisonStart,
comparisonEnd,
transactionName,
},
},
});
Expand All @@ -94,6 +97,7 @@ export function ServiceOverviewThroughputChart({
transactionType,
comparisonStart,
comparisonEnd,
transactionName,
]
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export function TransactionDetails() {
environment={query.environment}
start={start}
end={end}
transactionName={transactionName}
/>
</ChartPointerEventContextProvider>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ export function TransactionCharts({
environment,
start,
end,
transactionName,
}: {
kuery: string;
environment: string;
start: string;
end: string;
transactionName?: string;
}) {
return (
<>
Expand All @@ -44,6 +46,7 @@ export function TransactionCharts({
<ServiceOverviewThroughputChart
environment={environment}
kuery={kuery}
transactionName={transactionName}
/>
</EuiFlexItem>
</EuiFlexGrid>
Expand Down
11 changes: 11 additions & 0 deletions x-pack/plugins/apm/server/lib/services/get_throughput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { ESFilter } from '../../../../../../src/core/types/elasticsearch';
import {
SERVICE_NAME,
TRANSACTION_NAME,
TRANSACTION_TYPE,
} from '../../../common/elasticsearch_fieldnames';
import { kqlQuery, rangeQuery } from '../../../../observability/server';
Expand All @@ -25,6 +26,7 @@ interface Options {
serviceName: string;
setup: Setup;
transactionType: string;
transactionName?: string;
start: number;
end: number;
intervalString: string;
Expand All @@ -38,6 +40,7 @@ export async function getThroughput({
serviceName,
setup,
transactionType,
transactionName,
start,
end,
intervalString,
Expand All @@ -56,6 +59,14 @@ export async function getThroughput({
...kqlQuery(kuery),
];

if (transactionName) {
filter.push({
term: {
[TRANSACTION_NAME]: transactionName,
},
});
}

const params = {
apm: {
events: [
Expand Down
8 changes: 4 additions & 4 deletions x-pack/plugins/apm/server/routes/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,8 @@ const serviceThroughputRoute = createApmServerRoute({
}),
query: t.intersection([
t.type({ transactionType: t.string }),
environmentRt,
kueryRt,
rangeRt,
comparisonRangeRt,
t.partial({ transactionName: t.string }),
t.intersection([environmentRt, kueryRt, rangeRt, comparisonRangeRt]),
]),
}),
options: { tags: ['access:apm'] },
Expand All @@ -466,6 +464,7 @@ const serviceThroughputRoute = createApmServerRoute({
environment,
kuery,
transactionType,
transactionName,
comparisonStart,
comparisonEnd,
} = params.query;
Expand Down Expand Up @@ -493,6 +492,7 @@ const serviceThroughputRoute = createApmServerRoute({
serviceName,
setup,
transactionType,
transactionName,
throughputUnit,
intervalString,
};
Expand Down

0 comments on commit 0d4fb4f

Please sign in to comment.