forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Monitoring] Migrate server to NP (elastic#56675)
* First pass * First pass * Add new routes * Getting closer * Remove legacy server code, and other fixes * Register the plugin with xpack * Pass a legacy client to telemetry * Suport callWithInternalUser * Remove this * More NP work * Fix some tests * Fix broken test * Move over new telemetry changes, and fix other issues * Fix TODO item * Reuse the same schema as elasticsearch module * Use a singular config definition here * Disable this for now * Use the right method * Use custom config again * Tweak the config to make this optional * Remove these * Remove these unnecessary files * Fix jest test * Fix some linting issues * Fix type issue * Fix localization issues * Use the elasticsearch config * Remove todos * Fix this check * Move kibana alerting over * PR feedback * Use new metrics core service * Change config for xpack_api_polling_frequency_millis * Make sure this is disabled for now * Disable both * Update this to the new function * Tighten up legacy api needs * Check for existence * Fix jest tests * Cleaning up the plugin definition * Create custom type in our plugin * Revert this change * Fix CI issues * Add these tests back * Just use a different collector type * Handle errors better * Use custom type * PR feedback * Fix type issues * PR feedback
- Loading branch information
1 parent
da2ec4b
commit 3a39602
Showing
387 changed files
with
2,234 additions
and
2,134 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,59 @@ | ||
/* | ||
* 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 { get } from 'lodash'; | ||
import { resolve } from 'path'; | ||
import { config } from './config'; | ||
import { getUiExports } from './ui_exports'; | ||
import { KIBANA_ALERTING_ENABLED } from './common/constants'; | ||
import { telemetryCollectionManager } from '../../../../src/legacy/core_plugins/telemetry/server'; | ||
|
||
/** | ||
* Invokes plugin modules to instantiate the Monitoring plugin for Kibana | ||
* @param kibana {Object} Kibana plugin instance | ||
* @return {Object} Monitoring UI Kibana plugin object | ||
*/ | ||
const deps = ['kibana', 'elasticsearch', 'xpack_main']; | ||
if (KIBANA_ALERTING_ENABLED) { | ||
deps.push(...['alerting', 'actions']); | ||
} | ||
export const monitoring = kibana => { | ||
return new kibana.Plugin({ | ||
require: deps, | ||
id: 'monitoring', | ||
configPrefix: 'monitoring', | ||
publicDir: resolve(__dirname, 'public'), | ||
init(server) { | ||
const serverConfig = server.config(); | ||
const npMonitoring = server.newPlatform.setup.plugins.monitoring; | ||
if (npMonitoring) { | ||
const kbnServerStatus = this.kbnServer.status; | ||
npMonitoring.registerLegacyAPI({ | ||
telemetryCollectionManager, | ||
getServerStatus: () => { | ||
const status = kbnServerStatus.toJSON(); | ||
return get(status, 'overall.state'); | ||
}, | ||
}); | ||
} | ||
|
||
server.injectUiAppVars('monitoring', () => { | ||
return { | ||
maxBucketSize: serverConfig.get('monitoring.ui.max_bucket_size'), | ||
minIntervalSeconds: serverConfig.get('monitoring.ui.min_interval_seconds'), | ||
kbnIndex: serverConfig.get('kibana.index'), | ||
showLicenseExpiration: serverConfig.get('monitoring.ui.show_license_expiration'), | ||
showCgroupMetricsElasticsearch: serverConfig.get( | ||
'monitoring.ui.container.elasticsearch.enabled' | ||
), | ||
showCgroupMetricsLogstash: serverConfig.get('monitoring.ui.container.logstash.enabled'), // Note, not currently used, but see https://github.com/elastic/x-pack-kibana/issues/1559 part 2 | ||
}; | ||
}); | ||
}, | ||
config, | ||
uiExports: getUiExports(), | ||
}); | ||
}; |
This file was deleted.
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
87 changes: 0 additions & 87 deletions
87
x-pack/legacy/plugins/monitoring/server/__tests__/check_license.js
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
x-pack/legacy/plugins/monitoring/server/es_client/__tests__/fixture_read_file.txt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.