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
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ import {
SERVICE_ENVIRONMENT,
SERVICE_NAME,
} from '../../../common/elasticsearch_fieldnames';
import {
Connection,
ConnectionNode,
ServiceConnectionNode,
} from '../../../common/service_map';
import { Connection, ConnectionNode } from '../../../common/service_map';
import { Setup } from '../helpers/setup_request';
import { fetchServicePathsFromTraceIds } from './fetch_service_paths_from_trace_ids';

Expand All @@ -29,21 +25,19 @@ export function getConnections(
if (serviceName || environment) {
paths = paths.filter((path) => {
return path.some((node) => {
cauemarcondes marked this conversation as resolved.
Show resolved Hide resolved
let matches = true;
if (serviceName) {
matches =
matches &&
SERVICE_NAME in node &&
(node as ServiceConnectionNode)[SERVICE_NAME] === serviceName;
if (serviceName && node[SERVICE_NAME] !== serviceName) {
return false;
}
if (environment && environment !== ENVIRONMENT_NOT_DEFINED.value) {
matches =
matches &&
SERVICE_ENVIRONMENT in node &&
(node as ServiceConnectionNode)[SERVICE_ENVIRONMENT] ===
environment;

if (!environment) {
return true;
}
return matches;

if (environment === ENVIRONMENT_NOT_DEFINED.value) {
return !node[SERVICE_ENVIRONMENT];
}

return node[SERVICE_ENVIRONMENT] === environment;
});
});
}
Expand Down