Skip to content

Commit f29c8e7

Browse files
kibanamachinermyz
andauthored
[9.2] [APM] Hide non-trace services in Service Inventory (#241080) (#241307)
# Backport This will backport the following commits from `main` to `9.2`: - [[APM] Hide non-trace services in Service Inventory (#241080)](#241080) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Sergi Romeu","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-10-30T14:57:21Z","message":"[APM] Hide non-trace services in Service Inventory (#241080)","sha":"f9c400044e589946a2874c36ab4535533215a139","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","apm:service-inventory","ci:project-deploy-observability","Team:obs-ux-infra_services","backport:version","v9.3.0","v8.19.7","v9.1.7","v9.2.1"],"title":"[APM] Hide non-trace services in Service Inventory","number":241080,"url":"https://github.com/elastic/kibana/pull/241080","mergeCommit":{"message":"[APM] Hide non-trace services in Service Inventory (#241080)","sha":"f9c400044e589946a2874c36ab4535533215a139"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.1","9.2"],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/241080","number":241080,"mergeCommit":{"message":"[APM] Hide non-trace services in Service Inventory (#241080)","sha":"f9c400044e589946a2874c36ab4535533215a139"}},{"branch":"8.19","label":"v8.19.7","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.7","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.2","label":"v9.2.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Sergi Romeu <[email protected]>
1 parent fe645be commit f29c8e7

File tree

7 files changed

+30
-320
lines changed

7 files changed

+30
-320
lines changed

x-pack/solutions/observability/plugins/apm/server/routes/services/get_services/get_service_transaction_stats.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export interface ServiceTransactionStatsResponse {
6161
transactionErrorRate?: number;
6262
throughput?: number;
6363
}>;
64+
maxCountExceeded: boolean;
6465
serviceOverflowCount: number;
6566
}
6667

@@ -164,6 +165,8 @@ export async function getServiceTransactionStats({
164165
},
165166
});
166167

168+
const maxCountExceeded = (response.aggregations?.sample.services.sum_other_doc_count ?? 0) > 0;
169+
167170
return {
168171
serviceStats:
169172
response.aggregations?.sample.services.buckets.map((bucket) => {
@@ -198,6 +201,7 @@ export async function getServiceTransactionStats({
198201
: undefined,
199202
};
200203
}) ?? [],
204+
maxCountExceeded,
201205
serviceOverflowCount: response.aggregations?.sample?.overflowCount?.value || 0,
202206
};
203207
}

x-pack/solutions/observability/plugins/apm/server/routes/services/get_services/get_services_items.ts

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import type { MlClient } from '../../../lib/helpers/get_ml_client';
1515
import type { RandomSampler } from '../../../lib/helpers/get_random_sampler';
1616
import { withApmSpan } from '../../../utils/with_apm_span';
1717
import { getHealthStatuses } from './get_health_statuses';
18-
import { getServicesWithoutTransactions } from './get_services_without_transactions';
1918
import { getServicesAlerts } from './get_service_alerts';
2019
import { getServiceTransactionStats } from './get_service_transaction_stats';
2120
import type { MergedServiceStat } from './merge_service_stats';
@@ -75,35 +74,26 @@ export async function getServicesItems({
7574
searchQuery,
7675
};
7776

78-
const [
79-
{ serviceStats, serviceOverflowCount },
80-
{ services: servicesWithoutTransactions, maxCountExceeded },
81-
healthStatuses,
82-
alertCounts,
83-
] = await Promise.all([
84-
getServiceTransactionStats({
85-
...commonParams,
86-
apmEventClient,
87-
}),
88-
getServicesWithoutTransactions({
89-
...commonParams,
90-
apmEventClient,
91-
}),
92-
getHealthStatuses({ ...commonParams, mlClient }).catch((err) => {
93-
logger.debug(err);
94-
return [];
95-
}),
96-
getServicesAlerts({ ...commonParams, apmAlertsClient }).catch((err) => {
97-
logger.debug(err);
98-
return [];
99-
}),
100-
]);
77+
const [{ serviceStats, serviceOverflowCount, maxCountExceeded }, healthStatuses, alertCounts] =
78+
await Promise.all([
79+
getServiceTransactionStats({
80+
...commonParams,
81+
apmEventClient,
82+
}),
83+
getHealthStatuses({ ...commonParams, mlClient }).catch((err) => {
84+
logger.debug(err);
85+
return [];
86+
}),
87+
getServicesAlerts({ ...commonParams, apmAlertsClient }).catch((err) => {
88+
logger.debug(err);
89+
return [];
90+
}),
91+
]);
10192

10293
return {
10394
items:
10495
mergeServiceStats({
10596
serviceStats,
106-
servicesWithoutTransactions,
10797
healthStatuses,
10898
alertCounts,
10999
}) ?? [],

x-pack/solutions/observability/plugins/apm/server/routes/services/get_services/get_services_without_transactions.ts

Lines changed: 0 additions & 149 deletions
This file was deleted.

0 commit comments

Comments
 (0)