showing service maps when filte by environment not defined (#77483)
This commit is contained in:
parent
c4eb47a46b
commit
89af7e676d
|
@ -4,6 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
import { find, uniqBy } from 'lodash';
|
||||
import { ENVIRONMENT_NOT_DEFINED } from '../../../common/environment_filter_values';
|
||||
import {
|
||||
SERVICE_ENVIRONMENT,
|
||||
SERVICE_NAME,
|
||||
|
@ -35,7 +36,7 @@ export function getConnections(
|
|||
SERVICE_NAME in node &&
|
||||
(node as ServiceConnectionNode)[SERVICE_NAME] === serviceName;
|
||||
}
|
||||
if (environment) {
|
||||
if (environment && environment !== ENVIRONMENT_NOT_DEFINED.value) {
|
||||
matches =
|
||||
matches &&
|
||||
SERVICE_ENVIRONMENT in node &&
|
||||
|
|
|
@ -14,6 +14,7 @@ import {
|
|||
TRACE_ID,
|
||||
SPAN_DESTINATION_SERVICE_RESOURCE,
|
||||
} from '../../../common/elasticsearch_fieldnames';
|
||||
import { getEnvironmentUiFilterES } from '../helpers/convert_ui_filters/get_environment_ui_filter_es';
|
||||
|
||||
const MAX_TRACES_TO_INSPECT = 1000;
|
||||
|
||||
|
@ -47,9 +48,7 @@ export async function getTraceSampleIds({
|
|||
query.bool.filter.push({ term: { [SERVICE_NAME]: serviceName } });
|
||||
}
|
||||
|
||||
if (environment) {
|
||||
query.bool.filter.push({ term: { [SERVICE_ENVIRONMENT]: environment } });
|
||||
}
|
||||
query.bool.filter.push(...getEnvironmentUiFilterES(environment));
|
||||
|
||||
const fingerprintBucketSize = serviceName
|
||||
? config['xpack.apm.serviceMapFingerprintBucketSize']
|
||||
|
|
|
@ -84,6 +84,162 @@ export default function serviceMapsApiTests({ getService }: FtrProviderContext)
|
|||
|
||||
expectSnapshot(elements).toMatch();
|
||||
});
|
||||
|
||||
it('returns service map elements filtering by environment not defined', async () => {
|
||||
const start = encodeURIComponent('2020-06-28T10:24:46.055Z');
|
||||
const end = encodeURIComponent('2020-06-29T10:24:46.055Z');
|
||||
const environment = 'ENVIRONMENT_NOT_DEFINED';
|
||||
const response = await supertest.get(
|
||||
`/api/apm/service-map?start=${start}&end=${end}&environment=${environment}`
|
||||
);
|
||||
expect(response.status).to.be(200);
|
||||
expectSnapshot(response.body).toMatchInline(`
|
||||
Object {
|
||||
"elements": Array [
|
||||
Object {
|
||||
"data": Object {
|
||||
"id": "client~opbeans-node",
|
||||
"source": "client",
|
||||
"sourceData": Object {
|
||||
"agent.name": "rum-js",
|
||||
"id": "client",
|
||||
"service.environment": "ENVIRONMENT_NOT_DEFINED",
|
||||
"service.name": "client",
|
||||
},
|
||||
"target": "opbeans-node",
|
||||
"targetData": Object {
|
||||
"agent.name": "nodejs",
|
||||
"id": "opbeans-node",
|
||||
"service.environment": "ENVIRONMENT_NOT_DEFINED",
|
||||
"service.name": "opbeans-node",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"id": "opbeans-java~>postgresql",
|
||||
"source": "opbeans-java",
|
||||
"sourceData": Object {
|
||||
"agent.name": "java",
|
||||
"id": "opbeans-java",
|
||||
"service.environment": "ENVIRONMENT_NOT_DEFINED",
|
||||
"service.name": "opbeans-java",
|
||||
},
|
||||
"target": ">postgresql",
|
||||
"targetData": Object {
|
||||
"id": ">postgresql",
|
||||
"label": "postgresql",
|
||||
"span.destination.service.resource": "postgresql",
|
||||
"span.subtype": "postgresql",
|
||||
"span.type": "db",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"id": "opbeans-node~>postgresql",
|
||||
"source": "opbeans-node",
|
||||
"sourceData": Object {
|
||||
"agent.name": "nodejs",
|
||||
"id": "opbeans-node",
|
||||
"service.environment": "ENVIRONMENT_NOT_DEFINED",
|
||||
"service.name": "opbeans-node",
|
||||
},
|
||||
"target": ">postgresql",
|
||||
"targetData": Object {
|
||||
"id": ">postgresql",
|
||||
"label": "postgresql",
|
||||
"span.destination.service.resource": "postgresql",
|
||||
"span.subtype": "postgresql",
|
||||
"span.type": "db",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"id": "opbeans-node~>redis",
|
||||
"source": "opbeans-node",
|
||||
"sourceData": Object {
|
||||
"agent.name": "nodejs",
|
||||
"id": "opbeans-node",
|
||||
"service.environment": "ENVIRONMENT_NOT_DEFINED",
|
||||
"service.name": "opbeans-node",
|
||||
},
|
||||
"target": ">redis",
|
||||
"targetData": Object {
|
||||
"id": ">redis",
|
||||
"label": "redis",
|
||||
"span.destination.service.resource": "redis",
|
||||
"span.subtype": "redis",
|
||||
"span.type": "cache",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"id": "opbeans-node~opbeans-java",
|
||||
"source": "opbeans-node",
|
||||
"sourceData": Object {
|
||||
"agent.name": "nodejs",
|
||||
"id": "opbeans-node",
|
||||
"service.environment": "ENVIRONMENT_NOT_DEFINED",
|
||||
"service.name": "opbeans-node",
|
||||
},
|
||||
"target": "opbeans-java",
|
||||
"targetData": Object {
|
||||
"agent.name": "java",
|
||||
"id": "opbeans-java",
|
||||
"service.environment": "ENVIRONMENT_NOT_DEFINED",
|
||||
"service.name": "opbeans-java",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"agent.name": "rum-js",
|
||||
"id": "client",
|
||||
"service.environment": "ENVIRONMENT_NOT_DEFINED",
|
||||
"service.name": "client",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"agent.name": "nodejs",
|
||||
"id": "opbeans-node",
|
||||
"service.environment": "ENVIRONMENT_NOT_DEFINED",
|
||||
"service.name": "opbeans-node",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"id": ">redis",
|
||||
"label": "redis",
|
||||
"span.destination.service.resource": "redis",
|
||||
"span.subtype": "redis",
|
||||
"span.type": "cache",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"agent.name": "java",
|
||||
"id": "opbeans-java",
|
||||
"service.environment": "ENVIRONMENT_NOT_DEFINED",
|
||||
"service.name": "opbeans-java",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"id": ">postgresql",
|
||||
"label": "postgresql",
|
||||
"span.destination.service.resource": "postgresql",
|
||||
"span.subtype": "postgresql",
|
||||
"span.type": "db",
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue