-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APM] Add experimental support for Data Streams (#89650)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
9ab5bcb
commit a31cc73
Showing
15 changed files
with
171 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
|
||
import { APMOSSConfig } from 'src/plugins/apm_oss/server'; | ||
import { APMXPackConfig } from '.'; | ||
import { mergeConfigs } from './index'; | ||
|
||
describe('mergeConfigs', () => { | ||
it('merges the configs', () => { | ||
const apmOssConfig = { | ||
transactionIndices: 'apm-*-transaction-*', | ||
spanIndices: 'apm-*-span-*', | ||
errorIndices: 'apm-*-error-*', | ||
metricsIndices: 'apm-*-metric-*', | ||
indexPattern: 'apm-*', | ||
} as APMOSSConfig; | ||
|
||
const apmConfig = { | ||
ui: { enabled: false }, | ||
enabled: true, | ||
metricsInterval: 2000, | ||
} as APMXPackConfig; | ||
|
||
expect(mergeConfigs(apmOssConfig, apmConfig)).toEqual({ | ||
'apm_oss.errorIndices': 'apm-*-error-*', | ||
'apm_oss.indexPattern': 'apm-*', | ||
'apm_oss.metricsIndices': 'apm-*-metric-*', | ||
'apm_oss.spanIndices': 'apm-*-span-*', | ||
'apm_oss.transactionIndices': 'apm-*-transaction-*', | ||
'xpack.apm.metricsInterval': 2000, | ||
'xpack.apm.ui.enabled': false, | ||
}); | ||
}); | ||
|
||
it('adds fleet indices', () => { | ||
const apmOssConfig = { | ||
transactionIndices: 'apm-*-transaction-*', | ||
spanIndices: 'apm-*-span-*', | ||
errorIndices: 'apm-*-error-*', | ||
metricsIndices: 'apm-*-metric-*', | ||
fleetMode: true, | ||
} as APMOSSConfig; | ||
|
||
const apmConfig = { ui: {} } as APMXPackConfig; | ||
|
||
expect(mergeConfigs(apmOssConfig, apmConfig)).toEqual({ | ||
'apm_oss.errorIndices': 'logs-apm*,apm-*-error-*', | ||
'apm_oss.metricsIndices': 'metrics-apm*,apm-*-metric-*', | ||
'apm_oss.spanIndices': 'traces-apm*,apm-*-span-*', | ||
'apm_oss.transactionIndices': 'traces-apm*,apm-*-transaction-*', | ||
}); | ||
}); | ||
|
||
it('does not add fleet indices', () => { | ||
const apmOssConfig = { | ||
transactionIndices: 'apm-*-transaction-*', | ||
spanIndices: 'apm-*-span-*', | ||
errorIndices: 'apm-*-error-*', | ||
metricsIndices: 'apm-*-metric-*', | ||
fleetMode: false, | ||
} as APMOSSConfig; | ||
|
||
const apmConfig = { ui: {} } as APMXPackConfig; | ||
|
||
expect(mergeConfigs(apmOssConfig, apmConfig)).toEqual({ | ||
'apm_oss.errorIndices': 'apm-*-error-*', | ||
'apm_oss.metricsIndices': 'apm-*-metric-*', | ||
'apm_oss.spanIndices': 'apm-*-span-*', | ||
'apm_oss.transactionIndices': 'apm-*-transaction-*', | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...rver/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
import { APMEventESSearchRequest } from '.'; | ||
import { ApmIndicesConfig } from '../../../settings/apm_indices/get_apm_indices'; | ||
import { unpackProcessorEvents } from './unpack_processor_events'; | ||
|
||
describe('unpackProcessorEvents', () => { | ||
let res: ReturnType<typeof unpackProcessorEvents>; | ||
beforeEach(() => { | ||
const request = { | ||
apm: { events: ['transaction', 'error'] }, | ||
body: { query: { bool: { filter: [{ terms: { foo: 'bar' } }] } } }, | ||
} as APMEventESSearchRequest; | ||
|
||
const indices = { | ||
'apm_oss.transactionIndices': 'my-apm-*-transaction-*', | ||
'apm_oss.metricsIndices': 'my-apm-*-metric-*', | ||
'apm_oss.errorIndices': 'my-apm-*-error-*', | ||
'apm_oss.spanIndices': 'my-apm-*-span-*', | ||
'apm_oss.onboardingIndices': 'my-apm-*-onboarding-', | ||
'apm_oss.sourcemapIndices': 'my-apm-*-sourcemap-*', | ||
} as ApmIndicesConfig; | ||
|
||
res = unpackProcessorEvents(request, indices); | ||
}); | ||
|
||
it('adds terms filter for apm events', () => { | ||
expect(res.body.query.bool.filter).toContainEqual({ | ||
terms: { 'processor.event': ['transaction', 'error'] }, | ||
}); | ||
}); | ||
|
||
it('merges queries', () => { | ||
expect(res.body.query.bool.filter).toEqual([ | ||
{ terms: { foo: 'bar' } }, | ||
{ terms: { 'processor.event': ['transaction', 'error'] } }, | ||
]); | ||
}); | ||
|
||
it('searches the specified indices', () => { | ||
expect(res.index).toEqual(['my-apm-*-transaction-*', 'my-apm-*-error-*']); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
x-pack/plugins/apm/server/lib/services/__snapshots__/queries.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.