[APM] Client new platform migration (#64046)

* migrate files from legacy path to new plugin path

* update file paths to reflect migrated files

* move minimal legacy client files back to legacy path in order to run kibana

* Completes the full cutover to the new kibana platform removing all shims and legacy adapters.

* Adds APM to ignored list for casing check.

* - moves public/utils/pickKeys.ts to common/utils/pick_keys.ts
- exposes getTraceUrl as a plugin static export of apm/public and updates import in infra
- fixes FeaturesPluginSetup import in apm/public app
- renames get_apm_index_pattern_titles -> get_apm_index_pattern_title
- getApmIndexPatternTitle is now a synchronous getter function
- removes unused comments and xpack.apm.apmForESDescription i18n translations

* Moves automatic index pattern saved object creation from
plugin start to when the Home screen first renders

* removed unnecessary legacy css imports

* fixed ci issues by:
- moving readOnly badge, and help extension setup to occure only
  when apm app is mounted
- registering saved object types
- also moved createStaticIndexPattern from a react useEffect on the
  APM home screen to when the app is mounted
This commit is contained in:
Oliver Gupte 2020-04-30 13:08:50 -07:00 committed by GitHub
parent 59315bc84d
commit 16ba937bae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
560 changed files with 1748 additions and 1902 deletions

View file

@ -266,8 +266,8 @@ export class ClusterManager {
fromRoot('src/legacy/server/sass/__tmp__'),
fromRoot('x-pack/legacy/plugins/reporting/.chromium'),
fromRoot('x-pack/plugins/siem/cypress'),
fromRoot('x-pack/legacy/plugins/apm/e2e'),
fromRoot('x-pack/legacy/plugins/apm/scripts'),
fromRoot('x-pack/plugins/apm/e2e'),
fromRoot('x-pack/plugins/apm/scripts'),
fromRoot('x-pack/legacy/plugins/canvas/canvas_plugin_src'), // prevents server from restarting twice for Canvas plugin changes,
'plugins/java_languageserver',
];

View file

@ -35,7 +35,6 @@ export const IGNORE_FILE_GLOBS = [
'**/Gruntfile.js',
'tasks/config/**/*',
'**/{Dockerfile,docker-compose.yml}',
'x-pack/legacy/plugins/apm/**/*',
'x-pack/legacy/plugins/canvas/tasks/**/*',
'x-pack/legacy/plugins/canvas/canvas_plugin_src/**/*',
'x-pack/plugins/monitoring/public/lib/jquery_flot/**/*',
@ -59,6 +58,11 @@ export const IGNORE_FILE_GLOBS = [
// filename required by api-extractor
'api-documenter.json',
// TODO fix file names in APM to remove these
'x-pack/plugins/apm/public/**/*',
'x-pack/plugins/apm/scripts/**/*',
'x-pack/plugins/apm/e2e/**/*',
];
/**

View file

@ -35,9 +35,9 @@ const IGNORE_FILE_GLOBS = [
// fixtures aren't used in production, ignore them
'**/*fixtures*/**/*',
// cypress isn't used in production, ignore it
'x-pack/legacy/plugins/apm/e2e/*',
'x-pack/plugins/apm/e2e/*',
// apm scripts aren't used in production, ignore them
'x-pack/legacy/plugins/apm/scripts/*',
'x-pack/plugins/apm/scripts/*',
];
run(async ({ log }) => {

View file

@ -18,7 +18,7 @@
*/
export const storybookAliases = {
apm: 'x-pack/legacy/plugins/apm/scripts/storybook.js',
apm: 'x-pack/plugins/apm/scripts/storybook.js',
canvas: 'x-pack/legacy/plugins/canvas/scripts/storybook_new.js',
codeeditor: 'src/plugins/kibana_react/public/code_editor/scripts/storybook.ts',
drilldowns: 'x-pack/plugins/drilldowns/scripts/storybook.js',

View file

@ -30,7 +30,7 @@ export const PROJECTS = [
new Project(resolve(REPO_ROOT, 'x-pack/plugins/siem/cypress/tsconfig.json'), {
name: 'siem/cypress',
}),
new Project(resolve(REPO_ROOT, 'x-pack/legacy/plugins/apm/e2e/tsconfig.json'), {
new Project(resolve(REPO_ROOT, 'x-pack/plugins/apm/e2e/tsconfig.json'), {
name: 'apm/cypress',
disableTypeCheck: true,
}),

View file

@ -10,7 +10,6 @@ import { reporting } from './legacy/plugins/reporting';
import { security } from './legacy/plugins/security';
import { dashboardMode } from './legacy/plugins/dashboard_mode';
import { beats } from './legacy/plugins/beats_management';
import { apm } from './legacy/plugins/apm';
import { maps } from './legacy/plugins/maps';
import { spaces } from './legacy/plugins/spaces';
import { canvas } from './legacy/plugins/canvas';
@ -28,7 +27,6 @@ module.exports = function(kibana) {
security(kibana),
dashboardMode(kibana),
beats(kibana),
apm(kibana),
maps(kibana),
canvas(kibana),
infra(kibana),

View file

@ -1,4 +0,0 @@
{
"singleQuote": true,
"semi": true
}

View file

@ -1,10 +0,0 @@
module.exports = {
"APM": {
"Transaction duration charts": {
"1": "500 ms",
"2": "250 ms",
"3": "0 ms"
}
},
"__version": "4.2.0"
}

View file

@ -1,166 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { i18n } from '@kbn/i18n';
import { Server } from 'hapi';
import { resolve } from 'path';
import { APMPluginContract } from '../../../plugins/apm/server';
import { LegacyPluginInitializer } from '../../../../src/legacy/types';
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils';
import mappings from './mappings.json';
export const apm: LegacyPluginInitializer = kibana => {
return new kibana.Plugin({
require: [
'kibana',
'elasticsearch',
'xpack_main',
'apm_oss',
'task_manager'
],
id: 'apm',
configPrefix: 'xpack.apm',
publicDir: resolve(__dirname, 'public'),
uiExports: {
app: {
title: 'APM',
description: i18n.translate('xpack.apm.apmForESDescription', {
defaultMessage: 'APM for the Elastic Stack'
}),
main: 'plugins/apm/index',
icon: 'plugins/apm/icon.svg',
euiIconType: 'apmApp',
order: 8100,
category: DEFAULT_APP_CATEGORIES.observability
},
styleSheetPaths: resolve(__dirname, 'public/index.scss'),
home: ['plugins/apm/legacy_register_feature'],
// TODO: get proper types
injectDefaultVars(server: Server) {
const config = server.config();
return {
apmUiEnabled: config.get('xpack.apm.ui.enabled'),
// TODO: rename to apm_oss.indexPatternTitle in 7.0 (breaking change)
apmIndexPatternTitle: config.get('apm_oss.indexPattern'),
apmServiceMapEnabled: config.get('xpack.apm.serviceMapEnabled')
};
},
savedObjectSchemas: {
'apm-services-telemetry': {
isNamespaceAgnostic: true
},
'apm-indices': {
isNamespaceAgnostic: true
}
},
mappings
},
// TODO: get proper types
config(Joi: any) {
return Joi.object({
// display menu item
ui: Joi.object({
enabled: Joi.boolean().default(true),
transactionGroupBucketSize: Joi.number().default(100),
maxTraceItems: Joi.number().default(1000)
}).default(),
// enable plugin
enabled: Joi.boolean().default(true),
// index patterns
autocreateApmIndexPattern: Joi.boolean().default(true),
// service map
serviceMapEnabled: Joi.boolean().default(true),
serviceMapFingerprintBucketSize: Joi.number().default(100),
serviceMapTraceIdBucketSize: Joi.number().default(65),
serviceMapFingerprintGlobalBucketSize: Joi.number().default(1000),
serviceMapTraceIdGlobalBucketSize: Joi.number().default(6),
serviceMapMaxTracesPerRequest: Joi.number().default(50),
// telemetry
telemetryCollectionEnabled: Joi.boolean().default(true)
}).default();
},
// TODO: get proper types
init(server: Server) {
server.plugins.xpack_main.registerFeature({
id: 'apm',
name: i18n.translate('xpack.apm.featureRegistry.apmFeatureName', {
defaultMessage: 'APM'
}),
order: 900,
icon: 'apmApp',
navLinkId: 'apm',
app: ['apm', 'kibana'],
catalogue: ['apm'],
// see x-pack/plugins/features/common/feature_kibana_privileges.ts
privileges: {
all: {
app: ['apm', 'kibana'],
api: [
'apm',
'apm_write',
'actions-read',
'actions-all',
'alerting-read',
'alerting-all'
],
catalogue: ['apm'],
savedObject: {
all: ['alert', 'action', 'action_task_params'],
read: []
},
ui: [
'show',
'save',
'alerting:show',
'actions:show',
'alerting:save',
'actions:save',
'alerting:delete',
'actions:delete'
]
},
read: {
app: ['apm', 'kibana'],
api: [
'apm',
'actions-read',
'actions-all',
'alerting-read',
'alerting-all'
],
catalogue: ['apm'],
savedObject: {
all: ['alert', 'action', 'action_task_params'],
read: []
},
ui: [
'show',
'alerting:show',
'actions:show',
'alerting:save',
'actions:save',
'alerting:delete',
'actions:delete'
]
}
}
});
const apmPlugin = server.newPlatform.setup.plugins
.apm as APMPluginContract;
apmPlugin.registerLegacyAPI({
server
});
}
});
};

View file

@ -1,933 +0,0 @@
{
"apm-telemetry": {
"properties": {
"agents": {
"properties": {
"dotnet": {
"properties": {
"agent": {
"properties": {
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"service": {
"properties": {
"framework": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"language": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"runtime": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
}
}
}
}
},
"go": {
"properties": {
"agent": {
"properties": {
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"service": {
"properties": {
"framework": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"language": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"runtime": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
}
}
}
}
},
"java": {
"properties": {
"agent": {
"properties": {
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"service": {
"properties": {
"framework": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"language": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"runtime": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
}
}
}
}
},
"js-base": {
"properties": {
"agent": {
"properties": {
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"service": {
"properties": {
"framework": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"language": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"runtime": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
}
}
}
}
},
"nodejs": {
"properties": {
"agent": {
"properties": {
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"service": {
"properties": {
"framework": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"language": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"runtime": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
}
}
}
}
},
"python": {
"properties": {
"agent": {
"properties": {
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"service": {
"properties": {
"framework": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"language": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"runtime": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
}
}
}
}
},
"ruby": {
"properties": {
"agent": {
"properties": {
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"service": {
"properties": {
"framework": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"language": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"runtime": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
}
}
}
}
},
"rum-js": {
"properties": {
"agent": {
"properties": {
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"service": {
"properties": {
"framework": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"language": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"runtime": {
"properties": {
"composite": {
"type": "keyword",
"ignore_above": 1024
},
"name": {
"type": "keyword",
"ignore_above": 1024
},
"version": {
"type": "keyword",
"ignore_above": 1024
}
}
}
}
}
}
}
}
},
"counts": {
"properties": {
"agent_configuration": {
"properties": {
"all": {
"type": "long"
}
}
},
"error": {
"properties": {
"1d": {
"type": "long"
},
"all": {
"type": "long"
}
}
},
"max_error_groups_per_service": {
"properties": {
"1d": {
"type": "long"
}
}
},
"max_transaction_groups_per_service": {
"properties": {
"1d": {
"type": "long"
}
}
},
"metric": {
"properties": {
"1d": {
"type": "long"
},
"all": {
"type": "long"
}
}
},
"onboarding": {
"properties": {
"1d": {
"type": "long"
},
"all": {
"type": "long"
}
}
},
"services": {
"properties": {
"1d": {
"type": "long"
}
}
},
"sourcemap": {
"properties": {
"1d": {
"type": "long"
},
"all": {
"type": "long"
}
}
},
"span": {
"properties": {
"1d": {
"type": "long"
},
"all": {
"type": "long"
}
}
},
"traces": {
"properties": {
"1d": {
"type": "long"
}
}
},
"transaction": {
"properties": {
"1d": {
"type": "long"
},
"all": {
"type": "long"
}
}
}
}
},
"cardinality": {
"properties": {
"user_agent": {
"properties": {
"original": {
"properties": {
"all_agents": {
"properties": {
"1d": {
"type": "long"
}
}
},
"rum": {
"properties": {
"1d": {
"type": "long"
}
}
}
}
}
}
},
"transaction": {
"properties": {
"name": {
"properties": {
"all_agents": {
"properties": {
"1d": {
"type": "long"
}
}
},
"rum": {
"properties": {
"1d": {
"type": "long"
}
}
}
}
}
}
}
}
},
"has_any_services": {
"type": "boolean"
},
"indices": {
"properties": {
"all": {
"properties": {
"total": {
"properties": {
"docs": {
"properties": {
"count": {
"type": "long"
}
}
},
"store": {
"properties": {
"size_in_bytes": {
"type": "long"
}
}
}
}
}
}
},
"shards": {
"properties": {
"total": {
"type": "long"
}
}
}
}
},
"integrations": {
"properties": {
"ml": {
"properties": {
"all_jobs_count": {
"type": "long"
}
}
}
}
},
"retainment": {
"properties": {
"error": {
"properties": {
"ms": {
"type": "long"
}
}
},
"metric": {
"properties": {
"ms": {
"type": "long"
}
}
},
"onboarding": {
"properties": {
"ms": {
"type": "long"
}
}
},
"span": {
"properties": {
"ms": {
"type": "long"
}
}
},
"transaction": {
"properties": {
"ms": {
"type": "long"
}
}
}
}
},
"services_per_agent": {
"properties": {
"dotnet": {
"type": "long",
"null_value": 0
},
"go": {
"type": "long",
"null_value": 0
},
"java": {
"type": "long",
"null_value": 0
},
"js-base": {
"type": "long",
"null_value": 0
},
"nodejs": {
"type": "long",
"null_value": 0
},
"python": {
"type": "long",
"null_value": 0
},
"ruby": {
"type": "long",
"null_value": 0
},
"rum-js": {
"type": "long",
"null_value": 0
}
}
},
"tasks": {
"properties": {
"agent_configuration": {
"properties": {
"took": {
"properties": {
"ms": {
"type": "long"
}
}
}
}
},
"agents": {
"properties": {
"took": {
"properties": {
"ms": {
"type": "long"
}
}
}
}
},
"cardinality": {
"properties": {
"took": {
"properties": {
"ms": {
"type": "long"
}
}
}
}
},
"groupings": {
"properties": {
"took": {
"properties": {
"ms": {
"type": "long"
}
}
}
}
},
"indices_stats": {
"properties": {
"took": {
"properties": {
"ms": {
"type": "long"
}
}
}
}
},
"integrations": {
"properties": {
"took": {
"properties": {
"ms": {
"type": "long"
}
}
}
}
},
"processor_events": {
"properties": {
"took": {
"properties": {
"ms": {
"type": "long"
}
}
}
}
},
"services": {
"properties": {
"took": {
"properties": {
"ms": {
"type": "long"
}
}
}
}
},
"versions": {
"properties": {
"took": {
"properties": {
"ms": {
"type": "long"
}
}
}
}
}
}
},
"version": {
"properties": {
"apm_server": {
"properties": {
"major": {
"type": "long"
},
"minor": {
"type": "long"
},
"patch": {
"type": "long"
}
}
}
}
}
}
},
"apm-indices": {
"properties": {
"apm_oss.sourcemapIndices": {
"type": "keyword"
},
"apm_oss.errorIndices": {
"type": "keyword"
},
"apm_oss.onboardingIndices": {
"type": "keyword"
},
"apm_oss.spanIndices": {
"type": "keyword"
},
"apm_oss.transactionIndices": {
"type": "keyword"
},
"apm_oss.metricsIndices": {
"type": "keyword"
}
}
}
}

View file

@ -1,16 +0,0 @@
// Import the EUI global scope so we can use EUI constants
@import 'src/legacy/ui/public/styles/_styling_constants';
/* APM plugin styles */
// Prefix all styles with "apm" to avoid conflicts.
// Examples
// apmChart
// apmChart__legend
// apmChart__legend--small
// apmChart__legend-isLoading
.apmReactRoot {
overflow-x: auto;
height: 100%;
}

View file

@ -1,36 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { npSetup, npStart } from 'ui/new_platform';
import 'react-vis/dist/style.css';
import { PluginInitializerContext } from 'kibana/public';
import 'ui/autoload/all';
import chrome from 'ui/chrome';
import { plugin } from './new-platform';
import { REACT_APP_ROOT_ID } from './new-platform/plugin';
import './style/global_overrides.css';
import template from './templates/index.html';
// This will be moved to core.application.register when the new platform
// migration is complete.
// @ts-ignore
chrome.setRootTemplate(template);
const checkForRoot = () => {
return new Promise(resolve => {
const ready = !!document.getElementById(REACT_APP_ROOT_ID);
if (ready) {
resolve();
} else {
setTimeout(() => resolve(checkForRoot()), 10);
}
});
};
checkForRoot().then(() => {
const pluginInstance = plugin({} as PluginInitializerContext);
pluginInstance.setup(npSetup.core, npSetup.plugins);
pluginInstance.start(npStart.core, npStart.plugins);
});

View file

@ -1,24 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { npSetup } from 'ui/new_platform';
import { featureCatalogueEntry } from './new-platform/featureCatalogueEntry';
const {
core,
plugins: { home }
} = npSetup;
const apmUiEnabled = core.injectedMetadata.getInjectedVar(
'apmUiEnabled'
) as boolean;
if (apmUiEnabled) {
home.featureCatalogue.register(featureCatalogueEntry);
}
home.environment.update({
apmUi: apmUiEnabled
});

View file

@ -1,24 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { npStart } from 'ui/new_platform';
import { ConfigSchema } from './plugin';
const { core } = npStart;
export function getConfigFromInjectedMetadata(): ConfigSchema {
const {
apmIndexPatternTitle,
apmServiceMapEnabled,
apmUiEnabled
} = core.injectedMetadata.getInjectedVars();
return {
indexPatternTitle: `${apmIndexPatternTitle}`,
serviceMapEnabled: !!apmServiceMapEnabled,
ui: { enabled: !!apmUiEnabled }
};
}

View file

@ -1,13 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { PluginInitializer } from '../../../../../../src/core/public';
import { ApmPlugin, ApmPluginSetup, ApmPluginStart } from './plugin';
export const plugin: PluginInitializer<
ApmPluginSetup,
ApmPluginStart
> = pluginInitializerContext => new ApmPlugin(pluginInitializerContext);

View file

@ -1,203 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { ApmRoute } from '@elastic/apm-rum-react';
import { i18n } from '@kbn/i18n';
import React from 'react';
import ReactDOM from 'react-dom';
import { Route, Router, Switch } from 'react-router-dom';
import styled from 'styled-components';
import {
CoreSetup,
CoreStart,
Plugin,
PluginInitializerContext
} from '../../../../../../src/core/public';
import { DataPublicPluginSetup } from '../../../../../../src/plugins/data/public';
import { HomePublicPluginSetup } from '../../../../../../src/plugins/home/public';
import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public';
import { PluginSetupContract as AlertingPluginPublicSetup } from '../../../../../plugins/alerting/public';
import { AlertType } from '../../../../../plugins/apm/common/alert_types';
import { LicensingPluginSetup } from '../../../../../plugins/licensing/public';
import {
AlertsContextProvider,
TriggersAndActionsUIPublicPluginSetup
} from '../../../../../plugins/triggers_actions_ui/public';
import { APMIndicesPermission } from '../components/app/APMIndicesPermission';
import { routes } from '../components/app/Main/route_config';
import { ScrollToTopOnPathChange } from '../components/app/Main/ScrollToTopOnPathChange';
import { UpdateBreadcrumbs } from '../components/app/Main/UpdateBreadcrumbs';
import { ErrorRateAlertTrigger } from '../components/shared/ErrorRateAlertTrigger';
import { TransactionDurationAlertTrigger } from '../components/shared/TransactionDurationAlertTrigger';
import { ApmPluginContext } from '../context/ApmPluginContext';
import { LicenseProvider } from '../context/LicenseContext';
import { LoadingIndicatorProvider } from '../context/LoadingIndicatorContext';
import { LocationProvider } from '../context/LocationContext';
import { MatchedRouteProvider } from '../context/MatchedRouteContext';
import { UrlParamsProvider } from '../context/UrlParamsContext';
import { createCallApmApi } from '../services/rest/createCallApmApi';
import { createStaticIndexPattern } from '../services/rest/index_pattern';
import { px, unit, units } from '../style/variables';
import { history } from '../utils/history';
import { featureCatalogueEntry } from './featureCatalogueEntry';
import { getConfigFromInjectedMetadata } from './getConfigFromInjectedMetadata';
import { setHelpExtension } from './setHelpExtension';
import { toggleAppLinkInNav } from './toggleAppLinkInNav';
import { setReadonlyBadge } from './updateBadge';
export const REACT_APP_ROOT_ID = 'react-apm-root';
const MainContainer = styled.div`
min-width: ${px(unit * 50)};
padding: ${px(units.plus)};
height: 100%;
`;
const App = () => {
return (
<MainContainer data-test-subj="apmMainContainer" role="main">
<UpdateBreadcrumbs routes={routes} />
<Route component={ScrollToTopOnPathChange} />
<APMIndicesPermission>
<Switch>
{routes.map((route, i) => (
<ApmRoute key={i} {...route} />
))}
</Switch>
</APMIndicesPermission>
</MainContainer>
);
};
export type ApmPluginSetup = void;
export type ApmPluginStart = void;
export interface ApmPluginSetupDeps {
alerting?: AlertingPluginPublicSetup;
data: DataPublicPluginSetup;
home: HomePublicPluginSetup;
licensing: LicensingPluginSetup;
triggers_actions_ui: TriggersAndActionsUIPublicPluginSetup;
}
export interface ConfigSchema {
indexPatternTitle: string;
serviceMapEnabled: boolean;
ui: {
enabled: boolean;
};
}
export class ApmPlugin
implements Plugin<ApmPluginSetup, ApmPluginStart, ApmPluginSetupDeps, {}> {
// When we switch over from the old platform to new platform the plugins will
// be coming from setup instead of start, since that's where we do
// `core.application.register`. During the transitions we put plugins on an
// instance property so we can use it in start.
setupPlugins: ApmPluginSetupDeps = {} as ApmPluginSetupDeps;
constructor(
// @ts-ignore Not using initializerContext now, but will be once NP
// migration is complete.
private readonly initializerContext: PluginInitializerContext<ConfigSchema>
) {}
// Take the DOM element as the constructor, so we can mount the app.
public setup(_core: CoreSetup, plugins: ApmPluginSetupDeps) {
plugins.home.featureCatalogue.register(featureCatalogueEntry);
this.setupPlugins = plugins;
}
public start(core: CoreStart) {
const i18nCore = core.i18n;
const plugins = this.setupPlugins;
createCallApmApi(core.http);
// Once we're actually an NP plugin we'll get the config from the
// initializerContext like:
//
// const config = this.initializerContext.config.get<ConfigSchema>();
//
// Until then we use a shim to get it from legacy injectedMetadata:
const config = getConfigFromInjectedMetadata();
// render APM feedback link in global help menu
setHelpExtension(core);
setReadonlyBadge(core);
toggleAppLinkInNav(core, config);
const apmPluginContextValue = {
config,
core,
plugins
};
plugins.triggers_actions_ui.alertTypeRegistry.register({
id: AlertType.ErrorRate,
name: i18n.translate('xpack.apm.alertTypes.errorRate', {
defaultMessage: 'Error rate'
}),
iconClass: 'bell',
alertParamsExpression: ErrorRateAlertTrigger,
validate: () => ({
errors: []
})
});
plugins.triggers_actions_ui.alertTypeRegistry.register({
id: AlertType.TransactionDuration,
name: i18n.translate('xpack.apm.alertTypes.transactionDuration', {
defaultMessage: 'Transaction duration'
}),
iconClass: 'bell',
alertParamsExpression: TransactionDurationAlertTrigger,
validate: () => ({
errors: []
})
});
ReactDOM.render(
<ApmPluginContext.Provider value={apmPluginContextValue}>
<AlertsContextProvider
value={{
http: core.http,
docLinks: core.docLinks,
toastNotifications: core.notifications.toasts,
actionTypeRegistry: plugins.triggers_actions_ui.actionTypeRegistry,
alertTypeRegistry: plugins.triggers_actions_ui.alertTypeRegistry
}}
>
<KibanaContextProvider services={{ ...core, ...plugins }}>
<i18nCore.Context>
<Router history={history}>
<LocationProvider>
<MatchedRouteProvider routes={routes}>
<UrlParamsProvider>
<LoadingIndicatorProvider>
<LicenseProvider>
<App />
</LicenseProvider>
</LoadingIndicatorProvider>
</UrlParamsProvider>
</MatchedRouteProvider>
</LocationProvider>
</Router>
</i18nCore.Context>
</KibanaContextProvider>
</AlertsContextProvider>
</ApmPluginContext.Provider>,
document.getElementById(REACT_APP_ROOT_ID)
);
// create static index pattern and store as saved object. Not needed by APM UI but for legacy reasons in Discover, Dashboard etc.
createStaticIndexPattern().catch(e => {
// eslint-disable-next-line no-console
console.log('Error fetching static index pattern', e);
});
}
public stop() {}
}

View file

@ -1,34 +0,0 @@
/*
Hide unused secondary Kibana navigation
*/
.kuiLocalNav {
min-height: initial;
}
.kuiLocalNavRow.kuiLocalNavRow--secondary {
display: none;
}
/*
Remove unnecessary space below the navigation dropdown
*/
.kuiLocalDropdown {
margin-bottom: 0;
border-bottom: none;
}
/*
Hide the "0-10 of 100" text in KUIPager component for all KUIControlledTable
*/
.kuiControlledTable .kuiPagerText {
display: none;
}
/*
Hide default dashed gridlines in EUI chart component for all APM graphs
*/
.rv-xy-plot__grid-lines__line {
stroke-opacity: 1;
stroke-dasharray: 1;
}

View file

@ -1 +0,0 @@
<div id="react-apm-root" class="apmReactRoot"></div>

View file

@ -5,7 +5,7 @@
*/
// the types have to match the names of the saved object mappings
// in /x-pack/legacy/plugins/apm/mappings.json
// in /x-pack/plugins/apm/mappings.json
// APM indices
export const APM_INDICES_SAVED_OBJECT_TYPE = 'apm-indices';

View file

@ -4,8 +4,8 @@ Kibana and X-Pack are very large TypeScript projects, and it comes at a cost. Ed
To run the optimization:
`$ node x-pack/legacy/plugins/apm/scripts/optimize-tsconfig`
`$ node x-pack/plugins/apm/scripts/optimize-tsconfig`
To undo the optimization:
`$ node x-pack/legacy/plugins/apm/scripts/unoptimize-tsconfig`
`$ node x-pack/plugins/apm/scripts/unoptimize-tsconfig`

View file

@ -1,6 +1,6 @@
### Visual Studio Code
When using [Visual Studio Code](https://code.visualstudio.com/) with APM it's best to set up a [multi-root workspace](https://code.visualstudio.com/docs/editor/multi-root-workspaces) and add the `x-pack/legacy/plugins/apm` directory, the `x-pack` directory, and the root of the Kibana repository to the workspace. This makes it so you can navigate and search within APM and use the wider workspace roots when you need to widen your search.
When using [Visual Studio Code](https://code.visualstudio.com/) with APM it's best to set up a [multi-root workspace](https://code.visualstudio.com/docs/editor/multi-root-workspaces) and add the `x-pack/plugins/apm` directory, the `x-pack` directory, and the root of the Kibana repository to the workspace. This makes it so you can navigate and search within APM and use the wider workspace roots when you need to widen your search.
#### Using the Jest extension
@ -25,7 +25,7 @@ If you have a workspace configured as described above you should have:
in your Workspace settings, and:
```json
"jest.pathToJest": "node scripts/jest.js --testPathPattern=legacy/plugins/apm",
"jest.pathToJest": "node scripts/jest.js --testPathPattern=plugins/apm",
"jest.rootPath": "../../.."
```
@ -40,7 +40,7 @@ To make the [VSCode debugger](https://vscode.readthedocs.io/en/latest/editor/deb
"type": "node",
"name": "APM Jest",
"request": "launch",
"args": ["--runInBand", "--testPathPattern=legacy/plugins/apm"],
"args": ["--runInBand", "--testPathPattern=plugins/apm"],
"cwd": "${workspaceFolder}/../../..",
"console": "internalConsole",
"internalConsoleOptions": "openOnSessionStart",

View file

@ -3,7 +3,7 @@
**Run E2E tests**
```sh
x-pack/legacy/plugins/apm/e2e/run-e2e.sh
x-pack/plugins/apm/e2e/run-e2e.sh
```
_Starts Kibana, APM Server, Elasticsearch (with sample data) and runs the tests_
@ -16,9 +16,9 @@ The Jenkins CI uses a shell script to prepare Kibana:
```shell
# Prepare and run Kibana locally
$ x-pack/legacy/plugins/apm/e2e/ci/prepare-kibana.sh
$ x-pack/plugins/apm/e2e/ci/prepare-kibana.sh
# Build Docker image for Kibana
$ docker build --tag cypress --build-arg NODE_VERSION=$(cat .node-version) x-pack/legacy/plugins/apm/e2e/ci
$ docker build --tag cypress --build-arg NODE_VERSION=$(cat .node-version) x-pack/plugins/apm/e2e/ci
# Run Docker image
$ docker run --rm -t --user "$(id -u):$(id -g)" \
-v `pwd`:/app --network="host" \

View file

@ -21,9 +21,9 @@ npm config set cache ${HOME}
# --exclude=packages/ \
# --exclude=built_assets --exclude=target \
# --exclude=data /app ${HOME}/
#cd ${HOME}/app/x-pack/legacy/plugins/apm/e2e/cypress
#cd ${HOME}/app/x-pack/plugins/apm/e2e/cypress
cd /app/x-pack/legacy/plugins/apm/e2e
cd /app/x-pack/plugins/apm/e2e
## Install dependencies for cypress
CI=true npm install
yarn install

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -e
E2E_DIR="x-pack/legacy/plugins/apm/e2e"
E2E_DIR="x-pack/plugins/apm/e2e"
echo "1/3 Install dependencies ..."
# shellcheck disable=SC1091

View file

@ -0,0 +1,16 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
module.exports = {
APM: {
'Transaction duration charts': {
'1': '500 ms',
'2': '250 ms',
'3': '0 ms'
}
},
__version: '4.2.0'
};

View file

@ -27,7 +27,7 @@ cd ${E2E_DIR}
# Ask user to start Kibana
##################################################
echo "\n${bold}To start Kibana please run the following command:${normal}
node ./scripts/kibana --no-base-path --dev --no-dev-config --config x-pack/legacy/plugins/apm/e2e/ci/kibana.e2e.yml"
node ./scripts/kibana --no-base-path --dev --no-dev-config --config x-pack/plugins/apm/e2e/ci/kibana.e2e.yml"
#
# Create tmp folder

View file

@ -1,13 +1,23 @@
{
"id": "apm",
"server": true,
"version": "8.0.0",
"kibanaVersion": "kibana",
"configPath": [
"xpack",
"apm"
"requiredPlugins": [
"features",
"apm_oss",
"data",
"home",
"licensing",
"triggers_actions_ui"
],
"ui": false,
"requiredPlugins": ["apm_oss", "data", "home", "licensing"],
"optionalPlugins": ["cloud", "usageCollection", "taskManager","actions", "alerting"]
"optionalPlugins": [
"cloud",
"usageCollection",
"taskManager",
"actions",
"alerting"
],
"server": true,
"ui": true,
"configPath": ["xpack", "apm"]
}

View file

@ -0,0 +1,123 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { ApmRoute } from '@elastic/apm-rum-react';
import React from 'react';
import ReactDOM from 'react-dom';
import { Route, Router, Switch } from 'react-router-dom';
import styled from 'styled-components';
import { CoreStart, AppMountParameters } from '../../../../../src/core/public';
import { ApmPluginSetupDeps } from '../plugin';
import { ApmPluginContext } from '../context/ApmPluginContext';
import { LicenseProvider } from '../context/LicenseContext';
import { LoadingIndicatorProvider } from '../context/LoadingIndicatorContext';
import { LocationProvider } from '../context/LocationContext';
import { MatchedRouteProvider } from '../context/MatchedRouteContext';
import { UrlParamsProvider } from '../context/UrlParamsContext';
import { AlertsContextProvider } from '../../../triggers_actions_ui/public';
import { KibanaContextProvider } from '../../../../../src/plugins/kibana_react/public';
import { px, unit, units } from '../style/variables';
import { UpdateBreadcrumbs } from '../components/app/Main/UpdateBreadcrumbs';
import { APMIndicesPermission } from '../components/app/APMIndicesPermission';
import { ScrollToTopOnPathChange } from '../components/app/Main/ScrollToTopOnPathChange';
import { routes } from '../components/app/Main/route_config';
import { history } from '../utils/history';
import { ConfigSchema } from '..';
import 'react-vis/dist/style.css';
const MainContainer = styled.div`
min-width: ${px(unit * 50)};
padding: ${px(units.plus)};
height: 100%;
`;
const App = () => {
return (
<MainContainer data-test-subj="apmMainContainer" role="main">
<UpdateBreadcrumbs routes={routes} />
<Route component={ScrollToTopOnPathChange} />
<APMIndicesPermission>
<Switch>
{routes.map((route, i) => (
<ApmRoute key={i} {...route} />
))}
</Switch>
</APMIndicesPermission>
</MainContainer>
);
};
const ApmAppRoot = ({
core,
deps,
routerHistory,
config
}: {
core: CoreStart;
deps: ApmPluginSetupDeps;
routerHistory: typeof history;
config: ConfigSchema;
}) => {
const i18nCore = core.i18n;
const plugins = deps;
const apmPluginContextValue = {
config,
core,
plugins
};
return (
<ApmPluginContext.Provider value={apmPluginContextValue}>
<AlertsContextProvider
value={{
http: core.http,
docLinks: core.docLinks,
toastNotifications: core.notifications.toasts,
actionTypeRegistry: plugins.triggers_actions_ui.actionTypeRegistry,
alertTypeRegistry: plugins.triggers_actions_ui.alertTypeRegistry
}}
>
<KibanaContextProvider services={{ ...core, ...plugins }}>
<i18nCore.Context>
<Router history={routerHistory}>
<LocationProvider>
<MatchedRouteProvider routes={routes}>
<UrlParamsProvider>
<LoadingIndicatorProvider>
<LicenseProvider>
<App />
</LicenseProvider>
</LoadingIndicatorProvider>
</UrlParamsProvider>
</MatchedRouteProvider>
</LocationProvider>
</Router>
</i18nCore.Context>
</KibanaContextProvider>
</AlertsContextProvider>
</ApmPluginContext.Provider>
);
};
/**
* This module is rendered asynchronously in the Kibana platform.
*/
export const renderApp = (
core: CoreStart,
deps: ApmPluginSetupDeps,
{ element }: AppMountParameters,
config: ConfigSchema
) => {
ReactDOM.render(
<ApmAppRoot
core={core}
deps={deps}
routerHistory={history}
config={config}
/>,
element
);
return () => ReactDOM.unmountComponentAtNode(element);
};

View file

@ -6,7 +6,7 @@
import { i18n } from '@kbn/i18n';
import { isEmpty } from 'lodash';
import { APMError } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/apm_error';
import { APMError } from '../../../../../typings/es_schemas/ui/apm_error';
export interface ErrorTab {
key: 'log_stacktrace' | 'exception_stacktrace' | 'metadata';

View file

@ -6,7 +6,7 @@
import React from 'react';
import { EuiTitle } from '@elastic/eui';
import { Exception } from '../../../../../../../../plugins/apm/typings/es_schemas/raw/error_raw';
import { Exception } from '../../../../../typings/es_schemas/raw/error_raw';
import { Stacktrace } from '../../../shared/Stacktrace';
import { CauseStacktrace } from '../../../shared/Stacktrace/CauseStacktrace';

View file

@ -20,8 +20,8 @@ import React from 'react';
import styled from 'styled-components';
import { first } from 'lodash';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { ErrorGroupAPIResponse } from '../../../../../../../../plugins/apm/server/lib/errors/get_error_group';
import { APMError } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/apm_error';
import { ErrorGroupAPIResponse } from '../../../../../server/lib/errors/get_error_group';
import { APMError } from '../../../../../typings/es_schemas/ui/apm_error';
import { IUrlParams } from '../../../../context/UrlParamsContext/types';
import { px, unit, units } from '../../../../style/variables';
import { DiscoverErrorLink } from '../../../shared/Links/DiscoverLinks/DiscoverErrorLink';

View file

@ -17,7 +17,7 @@ import theme from '@elastic/eui/dist/eui_theme_light.json';
import { i18n } from '@kbn/i18n';
import React, { Fragment } from 'react';
import styled from 'styled-components';
import { NOT_AVAILABLE_LABEL } from '../../../../../../../plugins/apm/common/i18n';
import { NOT_AVAILABLE_LABEL } from '../../../../common/i18n';
import { useFetcher } from '../../../hooks/useFetcher';
import { fontFamilyCode, fontSizes, px, units } from '../../../style/variables';
import { ApmHeader } from '../../shared/ApmHeader';
@ -25,7 +25,7 @@ import { DetailView } from './DetailView';
import { ErrorDistribution } from './Distribution';
import { useLocation } from '../../../hooks/useLocation';
import { useUrlParams } from '../../../hooks/useUrlParams';
import { useTrackPageview } from '../../../../../../../plugins/observability/public';
import { useTrackPageview } from '../../../../../observability/public';
const Titles = styled.div`
margin-bottom: ${px(units.plus)};

View file

@ -9,9 +9,9 @@ import numeral from '@elastic/numeral';
import { i18n } from '@kbn/i18n';
import React, { useMemo } from 'react';
import styled from 'styled-components';
import { NOT_AVAILABLE_LABEL } from '../../../../../../../../plugins/apm/common/i18n';
import { NOT_AVAILABLE_LABEL } from '../../../../../common/i18n';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { ErrorGroupListAPIResponse } from '../../../../../../../../plugins/apm/server/lib/errors/get_error_groups';
import { ErrorGroupListAPIResponse } from '../../../../../server/lib/errors/get_error_groups';
import {
fontFamilyCode,
fontSizes,

View file

@ -17,8 +17,8 @@ import { useFetcher } from '../../../hooks/useFetcher';
import { ErrorDistribution } from '../ErrorGroupDetails/Distribution';
import { ErrorGroupList } from './List';
import { useUrlParams } from '../../../hooks/useUrlParams';
import { useTrackPageview } from '../../../../../../../plugins/observability/public';
import { PROJECTION } from '../../../../../../../plugins/apm/common/projections/typings';
import { useTrackPageview } from '../../../../../observability/public';
import { PROJECTION } from '../../../../common/projections/typings';
import { LocalUIFilters } from '../../shared/LocalUIFilters';
const ErrorGroupOverview: React.FC = () => {

View file

@ -5,7 +5,6 @@ exports[`Home component should render services 1`] = `
value={
Object {
"config": Object {
"indexPatternTitle": "apm-*",
"serviceMapEnabled": true,
"ui": Object {
"enabled": false,
@ -46,7 +45,6 @@ exports[`Home component should render traces 1`] = `
value={
Object {
"config": Object {
"indexPatternTitle": "apm-*",
"serviceMapEnabled": true,
"ui": Object {
"enabled": false,

View file

@ -7,7 +7,7 @@
import { i18n } from '@kbn/i18n';
import React from 'react';
import { Redirect, RouteComponentProps } from 'react-router-dom';
import { SERVICE_NODE_NAME_MISSING } from '../../../../../../../../plugins/apm/common/service_nodes';
import { SERVICE_NODE_NAME_MISSING } from '../../../../../common/service_nodes';
import { ErrorGroupDetails } from '../../ErrorGroupDetails';
import { ServiceDetails } from '../../ServiceDetails';
import { TransactionDetails } from '../../TransactionDetails';
@ -20,7 +20,7 @@ import { ApmIndices } from '../../Settings/ApmIndices';
import { toQuery } from '../../../shared/Links/url_helpers';
import { ServiceNodeMetrics } from '../../ServiceNodeMetrics';
import { resolveUrlParams } from '../../../../context/UrlParamsContext/resolveUrlParams';
import { UNIDENTIFIED_SERVICE_NODES_LABEL } from '../../../../../../../../plugins/apm/common/i18n';
import { UNIDENTIFIED_SERVICE_NODES_LABEL } from '../../../../../common/i18n';
import { TraceLink } from '../../TraceLink';
import { CustomizeUI } from '../../Settings/CustomizeUI';
import {

View file

@ -4,8 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
import React from 'react';
import { AlertType } from '../../../../../../../../../plugins/apm/common/alert_types';
import { AlertAdd } from '../../../../../../../../../plugins/triggers_actions_ui/public';
import { AlertType } from '../../../../../../common/alert_types';
import { AlertAdd } from '../../../../../../../triggers_actions_ui/public';
type AlertAddProps = React.ComponentProps<typeof AlertAdd>;

View file

@ -12,7 +12,7 @@ import {
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React, { useState } from 'react';
import { AlertType } from '../../../../../../../../plugins/apm/common/alert_types';
import { AlertType } from '../../../../../common/alert_types';
import { AlertingFlyout } from './AlertingFlyout';
import { useApmPluginContext } from '../../../../hooks/useApmPluginContext';

View file

@ -7,10 +7,7 @@
import { EuiTabs } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';
import {
isJavaAgentName,
isRumAgentName
} from '../../../../../../../plugins/apm/common/agent_name';
import { isJavaAgentName, isRumAgentName } from '../../../../common/agent_name';
import { useAgentName } from '../../../hooks/useAgentName';
import { useApmPluginContext } from '../../../hooks/useApmPluginContext';
import { useUrlParams } from '../../../hooks/useUrlParams';

View file

@ -6,7 +6,7 @@
import { i18n } from '@kbn/i18n';
import React, { Component } from 'react';
import { toMountPoint } from '../../../../../../../../../../src/plugins/kibana_react/public';
import { toMountPoint } from '../../../../../../../../../src/plugins/kibana_react/public';
import { startMLJob } from '../../../../../services/rest/ml';
import { IUrlParams } from '../../../../../context/UrlParamsContext/types';
import { MLJobLink } from '../../../../shared/Links/MachineLearningLinks/MLJobLink';

View file

@ -30,12 +30,13 @@ import { padLeft, range } from 'lodash';
import moment from 'moment-timezone';
import React, { Component } from 'react';
import styled from 'styled-components';
import { toMountPoint } from '../../../../../../../../../src/plugins/kibana_react/public';
import { toMountPoint } from '../../../../../../../../src/plugins/kibana_react/public';
import { IUrlParams } from '../../../../context/UrlParamsContext/types';
import { KibanaLink } from '../../../shared/Links/KibanaLink';
import { createErrorGroupWatch, Schedule } from './createErrorGroupWatch';
import { ElasticDocsLink } from '../../../shared/Links/ElasticDocsLink';
import { ApmPluginContext } from '../../../../context/ApmPluginContext';
import { getApmIndexPatternTitle } from '../../../../services/rest/index_pattern';
type ScheduleKey = keyof Schedule;
@ -149,11 +150,7 @@ export class WatcherFlyout extends Component<
this.setState({ slackUrl: event.target.value });
};
public createWatch = ({
indexPatternTitle
}: {
indexPatternTitle: string;
}) => () => {
public createWatch = () => {
const { serviceName } = this.props.urlParams;
const { core } = this.context;
@ -190,19 +187,21 @@ export class WatcherFlyout extends Component<
unit: 'h'
};
return createErrorGroupWatch({
http: core.http,
emails,
schedule,
serviceName,
slackUrl,
threshold: this.state.threshold,
timeRange,
apmIndexPatternTitle: indexPatternTitle
})
.then((id: string) => {
this.props.onClose();
this.addSuccessToast(id);
return getApmIndexPatternTitle()
.then(indexPatternTitle => {
return createErrorGroupWatch({
http: core.http,
emails,
schedule,
serviceName,
slackUrl,
threshold: this.state.threshold,
timeRange,
apmIndexPatternTitle: indexPatternTitle
}).then((id: string) => {
this.props.onClose();
this.addSuccessToast(id);
});
})
.catch(e => {
// eslint-disable-next-line
@ -613,26 +612,20 @@ export class WatcherFlyout extends Component<
<EuiFlyoutFooter>
<EuiFlexGroup justifyContent="flexEnd">
<EuiFlexItem grow={false}>
<ApmPluginContext.Consumer>
{({ config }) => {
return (
<EuiButton
onClick={this.createWatch(config)}
fill
disabled={
!this.state.actions.email && !this.state.actions.slack
}
>
{i18n.translate(
'xpack.apm.serviceDetails.enableErrorReportsPanel.createWatchButtonLabel',
{
defaultMessage: 'Create watch'
}
)}
</EuiButton>
);
}}
</ApmPluginContext.Consumer>
<EuiButton
onClick={() => this.createWatch()}
fill
disabled={
!this.state.actions.email && !this.state.actions.slack
}
>
{i18n.translate(
'xpack.apm.serviceDetails.enableErrorReportsPanel.createWatchButtonLabel',
{
defaultMessage: 'Create watch'
}
)}
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlyoutFooter>

View file

@ -17,7 +17,7 @@ import {
ERROR_LOG_MESSAGE,
PROCESSOR_EVENT,
SERVICE_NAME
} from '../../../../../../../../plugins/apm/common/elasticsearch_fieldnames';
} from '../../../../../common/elasticsearch_fieldnames';
import { createWatch } from '../../../../services/rest/watcher';
function getSlackPathUrl(slackUrl?: string) {

View file

@ -19,7 +19,7 @@ import {
cytoscapeOptions,
nodeHeight
} from './cytoscapeOptions';
import { useUiTracker } from '../../../../../../../plugins/observability/public';
import { useUiTracker } from '../../../../../observability/public';
export const CytoscapeContext = createContext<cytoscape.Core | undefined>(
undefined

View file

@ -12,7 +12,7 @@ import {
} from '@elastic/eui';
import cytoscape from 'cytoscape';
import React from 'react';
import { SERVICE_FRAMEWORK_NAME } from '../../../../../../../../plugins/apm/common/elasticsearch_fieldnames';
import { SERVICE_FRAMEWORK_NAME } from '../../../../../common/elasticsearch_fieldnames';
import { Buttons } from './Buttons';
import { Info } from './Info';
import { ServiceMetricFetcher } from './ServiceMetricFetcher';

View file

@ -12,7 +12,7 @@ import styled from 'styled-components';
import {
SPAN_SUBTYPE,
SPAN_TYPE
} from '../../../../../../../../plugins/apm/common/elasticsearch_fieldnames';
} from '../../../../../common/elasticsearch_fieldnames';
const ItemRow = styled.div`
line-height: 2;

View file

@ -5,7 +5,7 @@
*/
import React from 'react';
import { ServiceNodeMetrics } from '../../../../../../../../plugins/apm/common/service_map';
import { ServiceNodeMetrics } from '../../../../../common/service_map';
import { useFetcher } from '../../../../hooks/useFetcher';
import { useUrlParams } from '../../../../hooks/useUrlParams';
import { ServiceMetricList } from './ServiceMetricList';

Some files were not shown because too many files have changed in this diff Show more