mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 10:40:07 -04:00
[APM] Ensure APM data view is available across all spaces (#167704)
This commit is contained in:
parent
df3d0a60e9
commit
b0ef90dad1
1 changed files with 22 additions and 0 deletions
|
@ -11,6 +11,7 @@ import {
|
|||
Logger,
|
||||
Plugin,
|
||||
PluginInitializerContext,
|
||||
SavedObjectsClient,
|
||||
} from '@kbn/core/server';
|
||||
import { isEmpty, mapValues } from 'lodash';
|
||||
import { Dataset } from '@kbn/rule-registry-plugin/server';
|
||||
|
@ -48,6 +49,7 @@ import { scheduleSourceMapMigration } from './routes/source_maps/schedule_source
|
|||
import { createApmSourceMapIndexTemplate } from './routes/source_maps/create_apm_source_map_index_template';
|
||||
import { addApiKeysToEveryPackagePolicyIfMissing } from './routes/fleet/api_keys/add_api_keys_to_policies_if_missing';
|
||||
import { apmTutorialCustomIntegration } from '../common/tutorial/tutorials';
|
||||
import { APM_STATIC_DATA_VIEW_ID } from '../common/data_view_constants';
|
||||
|
||||
export class APMPlugin
|
||||
implements
|
||||
|
@ -119,6 +121,26 @@ export class APMPlugin
|
|||
],
|
||||
});
|
||||
|
||||
// ensure that the APM data view is globally available
|
||||
getCoreStart()
|
||||
.then(async (coreStart) => {
|
||||
const soClient = new SavedObjectsClient(
|
||||
coreStart.savedObjects.createInternalRepository()
|
||||
);
|
||||
|
||||
await soClient.updateObjectsSpaces(
|
||||
[{ id: APM_STATIC_DATA_VIEW_ID, type: 'index-pattern' }],
|
||||
['*'],
|
||||
[]
|
||||
);
|
||||
})
|
||||
.catch((e) => {
|
||||
this.logger?.error(
|
||||
'Failed to make APM data view available globally',
|
||||
e
|
||||
);
|
||||
});
|
||||
|
||||
const resourcePlugins = mapValues(plugins, (value, key) => {
|
||||
return {
|
||||
setup: value,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue