Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
9ed5142
First pass
chrisronline Feb 3, 2020
dd0db06
First pass
chrisronline Feb 3, 2020
82f1982
Add new routes
chrisronline Feb 4, 2020
1e2f1ae
Getting closer
chrisronline Feb 4, 2020
9bce109
Remove legacy server code, and other fixes
chrisronline Feb 5, 2020
75c76e1
Register the plugin with xpack
chrisronline Feb 5, 2020
f03b070
Pass a legacy client to telemetry
chrisronline Feb 6, 2020
d3983b2
Suport callWithInternalUser
chrisronline Feb 6, 2020
6493cd7
Remove this
chrisronline Feb 7, 2020
3cd3c1e
Merge in master
chrisronline Feb 11, 2020
db4edbd
More NP work
chrisronline Feb 13, 2020
a5bb47d
Fix some tests
chrisronline Feb 13, 2020
32cb3d4
Merge in master
chrisronline Feb 14, 2020
243fa22
Fix broken test
chrisronline Feb 14, 2020
3592198
t push oMerge remote-tracking branch 'elastic/master' into np
chrisronline Feb 14, 2020
a5c5f26
Merge in master
chrisronline Feb 27, 2020
d4b5f32
Move over new telemetry changes, and fix other issues
chrisronline Feb 27, 2020
cc1af1a
Fix TODO item
chrisronline Feb 27, 2020
38bcbc5
Merge in master
chrisronline Mar 2, 2020
2556eb9
Reuse the same schema as elasticsearch module
chrisronline Mar 2, 2020
24c68bd
Use a singular config definition here
chrisronline Mar 2, 2020
b190853
Disable this for now
chrisronline Mar 3, 2020
7188464
Use the right method
chrisronline Mar 3, 2020
059863b
Use custom config again
chrisronline Mar 3, 2020
d779922
Tweak the config to make this optional
chrisronline Mar 3, 2020
f237dd4
Remove these
chrisronline Mar 3, 2020
b6d550f
Remove these unnecessary files
chrisronline Mar 4, 2020
b0ab817
Fix jest test
chrisronline Mar 4, 2020
906b866
Fix some linting issues
chrisronline Mar 4, 2020
048845d
Fix type issue
chrisronline Mar 4, 2020
be081ce
Merge in master
chrisronline Mar 4, 2020
9da2a63
Fix localization issues
chrisronline Mar 5, 2020
b9e7e48
Use the elasticsearch config
chrisronline Mar 5, 2020
3af5a23
Remove todos
chrisronline Mar 5, 2020
89ef31a
Fix this check
chrisronline Mar 5, 2020
41e55fc
Move kibana alerting over
chrisronline Mar 6, 2020
1226aa0
PR feedback
chrisronline Mar 6, 2020
88f5837
Merge remote-tracking branch 'elastic/master' into np
chrisronline Mar 6, 2020
44c8609
Merge remote-tracking branch 'elastic/master' into np
chrisronline Mar 9, 2020
7e187fd
Use new metrics core service
chrisronline Mar 9, 2020
179469f
Change config for xpack_api_polling_frequency_millis
chrisronline Mar 9, 2020
7f269f0
Make sure this is disabled for now
chrisronline Mar 9, 2020
543e755
Disable both
chrisronline Mar 9, 2020
70292ff
Update this to the new function
chrisronline Mar 9, 2020
2f164b3
Tighten up legacy api needs
chrisronline Mar 9, 2020
c1b047a
Check for existence
chrisronline Mar 9, 2020
ee8086b
Fix jest tests
chrisronline Mar 10, 2020
708d662
Merge remote-tracking branch 'elastic/master' into np
chrisronline Mar 11, 2020
44738ed
Cleaning up the plugin definition
chrisronline Mar 11, 2020
971e590
Create custom type in our plugin
chrisronline Mar 11, 2020
c2b360c
Revert this change
chrisronline Mar 11, 2020
39bdec1
Fix CI issues
chrisronline Mar 12, 2020
e4bb754
Merge remote-tracking branch 'elastic/master' into np
chrisronline Mar 12, 2020
eb542a0
Add these tests back
chrisronline Mar 12, 2020
2c768c2
Just use a different collector type
chrisronline Mar 12, 2020
f5576cb
Merge remote-tracking branch 'elastic/master' into np
chrisronline Mar 12, 2020
863b326
Merge remote-tracking branch 'elastic/master' into np
chrisronline Mar 13, 2020
28e288e
Handle errors better
chrisronline Mar 13, 2020
b719600
Merge remote-tracking branch 'elastic/master' into np
chrisronline Mar 16, 2020
0c2818a
Use custom type
chrisronline Mar 17, 2020
7d99bf1
PR feedback
chrisronline Mar 17, 2020
6340e5d
Fix type issues
chrisronline Mar 18, 2020
86a66f4
Merge remote-tracking branch 'elastic/master' into np
chrisronline Mar 20, 2020
492761b
PR feedback
chrisronline Mar 20, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 7 additions & 5 deletions src/legacy/core_plugins/telemetry/server/collection_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import { encryptTelemetry } from './collectors';
import { CallCluster } from '../../elasticsearch';
import { UsageCollectionSetup } from '../../../../plugins/usage_collection/server';
import { Cluster } from '../../elasticsearch';
import { ESLicense } from './telemetry_collection/get_local_license';

export type EncryptedStatsGetterConfig = { unencrypted: false } & {
Expand Down Expand Up @@ -70,7 +71,7 @@ export type LicenseGetter = (
interface CollectionConfig<T extends BasicStatsPayload> {
title: string;
priority: number;
esCluster: string;
esCluster: string | Cluster;
statsGetter: StatsGetter<T>;
clusterDetailsGetter: ClusterDetailsGetter;
licenseGetter: LicenseGetter;
Expand All @@ -79,7 +80,7 @@ interface Collection {
statsGetter: StatsGetter;
licenseGetter: LicenseGetter;
clusterDetailsGetter: ClusterDetailsGetter;
esCluster: string;
esCluster: string | Cluster;
title: string;
}

Expand Down Expand Up @@ -135,9 +136,10 @@ export class TelemetryCollectionManager {
): Promise<StatsCollectionConfig> => {
const { start, end } = config;
const server = config.unencrypted ? config.req.server : config.server;
const { callWithRequest, callWithInternalUser } = server.plugins.elasticsearch.getCluster(
collection.esCluster
);
const { callWithRequest, callWithInternalUser } =
typeof collection.esCluster === 'string'
? server.plugins.elasticsearch.getCluster(collection.esCluster)
: collection.esCluster;
const callCluster = config.unencrypted
? (...args: any[]) => callWithRequest(config.req, ...args)
: callWithInternalUser;
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/server/status/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
* under the License.
*/

export const KIBANA_STATS_TYPE = 'kibana_stats'; // kibana stats per 5s intervals
export const KIBANA_STATS_TYPE = 'oss_kibana_stats'; // kibana stats per 5s intervals
2 changes: 1 addition & 1 deletion x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"xpack.main": "legacy/plugins/xpack_main",
"xpack.maps": ["plugins/maps", "legacy/plugins/maps"],
"xpack.ml": ["plugins/ml", "legacy/plugins/ml"],
"xpack.monitoring": "legacy/plugins/monitoring",
"xpack.monitoring": ["plugins/monitoring", "legacy/plugins/monitoring"],
"xpack.remoteClusters": "plugins/remote_clusters",
"xpack.reporting": ["plugins/reporting", "legacy/plugins/reporting"],
"xpack.rollupJobs": "legacy/plugins/rollup",
Expand Down
8 changes: 3 additions & 5 deletions x-pack/legacy/plugins/monitoring/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { XPACK_INFO_API_DEFAULT_POLL_FREQUENCY_IN_MILLIS } from '../../server/lib/constants';

/**
* User-configurable settings for xpack.monitoring via configuration schema
* @param {Object} Joi - HapiJS Joi module that allows for schema validation
Expand Down Expand Up @@ -132,9 +130,9 @@ export const config = Joi => {
email_address: Joi.string().email(),
}).default(),
}).default(),
xpack_api_polling_frequency_millis: Joi.number().default(
XPACK_INFO_API_DEFAULT_POLL_FREQUENCY_IN_MILLIS
),
licensing: Joi.object({
api_polling_frequency: Joi.number().default(30001),
}),
agent: Joi.object({
interval: Joi.string()
.regex(/[\d\.]+[yMwdhms]/)
Expand Down
59 changes: 59 additions & 0 deletions x-pack/legacy/plugins/monitoring/index.js
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'),
Comment thread
chrisronline marked this conversation as resolved.
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(),
});
};
141 changes: 0 additions & 141 deletions x-pack/legacy/plugins/monitoring/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ uiRoutes
const globalState = $injector.get('globalState');
const storage = $injector.get('localStorage');
const showLicenseExpiration = $injector.get('showLicenseExpiration');

this.data = $route.current.locals.clusters;

$scope.$watch(
Expand Down
87 changes: 0 additions & 87 deletions x-pack/legacy/plugins/monitoring/server/__tests__/check_license.js

This file was deleted.

This file was deleted.

Loading