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] Service Map: Not Defined option doesn't work properly #77757

Merged
Merged
Show file tree
Hide file tree
Changes from 16 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

This file was deleted.

23 changes: 15 additions & 8 deletions x-pack/plugins/apm/server/lib/service_map/get_service_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { getServicesProjection } from '../../projections/services';
import { mergeProjection } from '../../projections/util/merge_projection';
import { PromiseReturnType } from '../../../typings/common';
import { Setup, SetupTimeRange } from '../helpers/setup_request';
import { getEnvironmentUiFilterES } from '../helpers/convert_ui_filters/get_environment_ui_filter_es';
import { transformServiceMapResponses } from './transform_service_map_responses';
import { getServiceMapFromTraceIds } from './get_service_map_from_trace_ids';
import { getTraceSampleIds } from './get_trace_sample_ids';
Expand Down Expand Up @@ -85,21 +86,27 @@ async function getServicesData(options: IEnvOptions) {
searchAggregatedTransactions,
});

const { filter } = projection.body.query.bool;
let { filter } = projection.body.query.bool;

if (options.serviceName) {
filter = filter.concat({
term: {
[SERVICE_NAME]: options.serviceName,
},
});
}

if (options.environment) {
filter = filter.concat(getEnvironmentUiFilterES(options.environment));
}
Comment on lines +89 to +101
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@elastic/apm-ui this fixes the issue described here


const params = mergeProjection(projection, {
body: {
size: 0,
query: {
bool: {
...projection.body.query.bool,
filter: options.serviceName
? filter.concat({
term: {
[SERVICE_NAME]: options.serviceName,
},
})
: filter,
filter,
},
},
aggs: {
Expand Down
Loading