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

[7.14] [APM] Fixes support for APM index pattern with data streams (#105360) #105535

Merged
merged 1 commit into from
Jul 14, 2021
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -54,7 +54,7 @@ describe('createLayerDescriptor', () => {
applyGlobalTime: true,
id: '12345',
indexPatternId: 'apm_static_index_pattern_id',
indexPatternTitle: 'apm-*',
indexPatternTitle: 'traces-apm*,logs-apm*,metrics-apm*,apm-*',
metrics: [
{
field: 'transaction.duration.us',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { getDefaultDynamicProperties } from '../../../styles/vector/vector_style

// redefining APM constant to avoid making maps app depend on APM plugin
export const APM_INDEX_PATTERN_ID = 'apm_static_index_pattern_id';
export const APM_INDEX_PATTERN_TITLE = 'apm-*';
export const APM_INDEX_PATTERN_TITLE = 'traces-apm*,logs-apm*,metrics-apm*,apm-*';

const defaultDynamicProperties = getDefaultDynamicProperties();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -706,4 +706,343 @@ describe('createLayerDescriptor', () => {
},
]);
});

test('apm data stream', () => {
expect(createSecurityLayerDescriptors('id', 'traces-apm-opbean-node')).toEqual([
{
__dataRequests: [],
alpha: 0.75,
id: '12345',
includeInFitToBounds: true,
joins: [],
label: 'traces-apm-opbean-node | Source Point',
maxZoom: 24,
minZoom: 0,
sourceDescriptor: {
applyGlobalQuery: true,
applyGlobalTime: true,
filterByMapBounds: true,
geoField: 'client.geo.location',
id: '12345',
indexPatternId: 'id',
scalingType: 'TOP_HITS',
sortField: '',
sortOrder: 'desc',
tooltipProperties: [
'host.name',
'client.ip',
'client.domain',
'client.geo.country_iso_code',
'client.as.organization.name',
],
topHitsSize: 1,
topHitsSplitField: 'client.ip',
type: 'ES_SEARCH',
},
style: {
isTimeAware: true,
properties: {
fillColor: {
options: {
color: '#6092C0',
},
type: 'STATIC',
},
icon: {
options: {
value: 'home',
},
type: 'STATIC',
},
iconOrientation: {
options: {
orientation: 0,
},
type: 'STATIC',
},
iconSize: {
options: {
size: 8,
},
type: 'STATIC',
},
labelBorderColor: {
options: {
color: '#FFFFFF',
},
type: 'STATIC',
},
labelBorderSize: {
options: {
size: 'SMALL',
},
},
labelColor: {
options: {
color: '#000000',
},
type: 'STATIC',
},
labelSize: {
options: {
size: 14,
},
type: 'STATIC',
},
labelText: {
options: {
value: '',
},
type: 'STATIC',
},
lineColor: {
options: {
color: '#FFFFFF',
},
type: 'STATIC',
},
lineWidth: {
options: {
size: 2,
},
type: 'STATIC',
},
symbolizeAs: {
options: {
value: 'icon',
},
},
},
type: 'VECTOR',
},
type: 'VECTOR',
visible: true,
},
{
__dataRequests: [],
alpha: 0.75,
id: '12345',
includeInFitToBounds: true,
joins: [],
label: 'traces-apm-opbean-node | Destination point',
maxZoom: 24,
minZoom: 0,
sourceDescriptor: {
applyGlobalQuery: true,
applyGlobalTime: true,
filterByMapBounds: true,
geoField: 'server.geo.location',
id: '12345',
indexPatternId: 'id',
scalingType: 'TOP_HITS',
sortField: '',
sortOrder: 'desc',
tooltipProperties: [
'host.name',
'server.ip',
'server.domain',
'server.geo.country_iso_code',
'server.as.organization.name',
],
topHitsSize: 1,
topHitsSplitField: 'server.ip',
type: 'ES_SEARCH',
},
style: {
isTimeAware: true,
properties: {
fillColor: {
options: {
color: '#D36086',
},
type: 'STATIC',
},
icon: {
options: {
value: 'marker',
},
type: 'STATIC',
},
iconOrientation: {
options: {
orientation: 0,
},
type: 'STATIC',
},
iconSize: {
options: {
size: 8,
},
type: 'STATIC',
},
labelBorderColor: {
options: {
color: '#FFFFFF',
},
type: 'STATIC',
},
labelBorderSize: {
options: {
size: 'SMALL',
},
},
labelColor: {
options: {
color: '#000000',
},
type: 'STATIC',
},
labelSize: {
options: {
size: 14,
},
type: 'STATIC',
},
labelText: {
options: {
value: '',
},
type: 'STATIC',
},
lineColor: {
options: {
color: '#FFFFFF',
},
type: 'STATIC',
},
lineWidth: {
options: {
size: 2,
},
type: 'STATIC',
},
symbolizeAs: {
options: {
value: 'icon',
},
},
},
type: 'VECTOR',
},
type: 'VECTOR',
visible: true,
},
{
__dataRequests: [],
alpha: 0.75,
id: '12345',
includeInFitToBounds: true,
joins: [],
label: 'traces-apm-opbean-node | Line',
maxZoom: 24,
minZoom: 0,
sourceDescriptor: {
applyGlobalQuery: true,
applyGlobalTime: true,
destGeoField: 'server.geo.location',
id: '12345',
indexPatternId: 'id',
metrics: [
{
field: 'client.bytes',
type: 'sum',
},
{
field: 'server.bytes',
type: 'sum',
},
],
sourceGeoField: 'client.geo.location',
type: 'ES_PEW_PEW',
},
style: {
isTimeAware: true,
properties: {
fillColor: {
options: {
color: '#54B399',
},
type: 'STATIC',
},
icon: {
options: {
value: 'marker',
},
type: 'STATIC',
},
iconOrientation: {
options: {
orientation: 0,
},
type: 'STATIC',
},
iconSize: {
options: {
size: 6,
},
type: 'STATIC',
},
labelBorderColor: {
options: {
color: '#FFFFFF',
},
type: 'STATIC',
},
labelBorderSize: {
options: {
size: 'SMALL',
},
},
labelColor: {
options: {
color: '#000000',
},
type: 'STATIC',
},
labelSize: {
options: {
size: 14,
},
type: 'STATIC',
},
labelText: {
options: {
value: '',
},
type: 'STATIC',
},
lineColor: {
options: {
color: '#6092C0',
},
type: 'STATIC',
},
lineWidth: {
options: {
field: {
name: 'doc_count',
origin: 'source',
},
fieldMetaOptions: {
isEnabled: true,
sigma: 3,
},
maxSize: 8,
minSize: 1,
},
type: 'DYNAMIC',
},
symbolizeAs: {
options: {
value: 'circle',
},
},
},
type: 'VECTOR',
},
type: 'VECTOR',
visible: true,
},
]);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ const defaultDynamicProperties = getDefaultDynamicProperties();
const euiVisColorPalette = euiPaletteColorBlind();

function isApmIndex(indexPatternTitle: string) {
return minimatch(indexPatternTitle, APM_INDEX_PATTERN_TITLE);
return APM_INDEX_PATTERN_TITLE.split(',')
.map((pattern) => {
return minimatch(indexPatternTitle, pattern);
})
.some(Boolean);
}

function getSourceField(indexPatternTitle: string) {
Expand Down