Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telemetry uses es client provided from start contract #67279

Closed
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/plugins/telemetry/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export class TelemetryPlugin implements Plugin {
const config$ = this.config$;
const isDev = this.isDev;

registerCollection(telemetryCollectionManager, elasticsearch.dataClient);
const router = http.createRouter();

registerRoutes({
Expand All @@ -109,6 +108,7 @@ export class TelemetryPlugin implements Plugin {
this.logger.warn('Unable to update legacy telemetry configs.');
}

registerCollection(telemetryCollectionManager, core.elasticsearch.legacy.client);
this.fetcherTask.start(core, { telemetryCollectionManager });
}

Expand Down
14 changes: 7 additions & 7 deletions x-pack/plugins/telemetry_collection_xpack/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@
*/

import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from 'kibana/server';
import { TelemetryCollectionManagerPluginSetup } from 'src/plugins/telemetry_collection_manager/server';
import { TelemetryCollectionManagerPluginStart } from 'src/plugins/telemetry_collection_manager/server';
import { getClusterUuids, getLocalLicense } from '../../../../src/plugins/telemetry/server';
import { getStatsWithXpack } from './telemetry_collection';

interface TelemetryCollectionXpackDepsSetup {
telemetryCollectionManager: TelemetryCollectionManagerPluginSetup;
interface TelemetryCollectionXpackDepsStart {
telemetryCollectionManager: TelemetryCollectionManagerPluginStart;
}

export class TelemetryCollectionXpackPlugin implements Plugin {
constructor(initializerContext: PluginInitializerContext) {}

public setup(core: CoreSetup, { telemetryCollectionManager }: TelemetryCollectionXpackDepsSetup) {
public setup(core: CoreSetup) {}

public start(core: CoreStart, { telemetryCollectionManager }: TelemetryCollectionXpackDepsStart) {
telemetryCollectionManager.setCollection({
esCluster: core.elasticsearch.dataClient,
esCluster: core.elasticsearch.legacy.client,
Copy link
Contributor Author

@mshustov mshustov May 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@afharo do you know a reason why it wouldn't work if we move setCollection to the start lifecycle?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I bet there's a point in the code where we are trying to read the telemetry from the setup lifecycle step (on top of my mind

bulkUploader.start(plugins.usageCollection);
but there might be more).

I can try to dig deeper on it :)

Copy link
Contributor Author

@mshustov mshustov May 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where we are trying to read the telemetry from the

Ha. Good to know, thanks! I will try to move this piece of the code in start lifecycle. That definitely shouldn't be in setup, since telemetry API might be called by other plugins during setup.

I can try to dig deeper on it :)

I will ping you if I didn't fix it with ^^^

title: 'local_xpack',
priority: 1,
statsGetter: getStatsWithXpack,
clusterDetailsGetter: getClusterUuids,
licenseGetter: getLocalLicense,
});
}

public start(core: CoreStart) {}
}