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] Synchronous setup and start methods #79457

Merged

Conversation

afharo
Copy link
Member

@afharo afharo commented Oct 5, 2020

Summary

Remove the async condition of the setup and start methods in the telemetry plugin.

Resolves #79452.

For maintainers

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-telemetry (Team:KibanaTelemetry)

@@ -131,18 +131,16 @@ export class TelemetryPlugin implements Plugin<TelemetryPluginSetup, TelemetryPl
};
}

public async start(core: CoreStart, { telemetryCollectionManager }: TelemetryPluginsDepsStart) {
public start(core: CoreStart, { telemetryCollectionManager }: TelemetryPluginsDepsStart) {
const { savedObjects, uiSettings, elasticsearch } = core;
this.savedObjectsClient = savedObjects.createInternalRepository();
const savedObjectsClient = new SavedObjectsClient(this.savedObjectsClient);
this.uiSettingsClient = uiSettings.asScopedToClient(savedObjectsClient);
this.elasticsearchClient = elasticsearch.client;
Copy link
Member

Choose a reason for hiding this comment

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

  1. I am slightly worried about any side affects that might result from not awaiting handleOldSettings. Telemetry might be enabled/disabled inside this function yet if we are not awaiting it other functions might not pick up the right value. What do you think?

  2. Can we move all the above (savedObjectsClient and uiSettingsClient from line 136) to the handleOldSettings function? Since it is an async function these sync methods will not block the main thread when called.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah! Makes sense! I think we had all the private clients because we used to instantiate the collectors in this plugin. But now they live in kibana_usage_collection, so it makes sense to only use them where appropriate.

I'll push an update in a sec!

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@afharo afharo requested a review from Bamieh October 6, 2020 10:24
Copy link
Member

@Bamieh Bamieh left a comment

Choose a reason for hiding this comment

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

Awesome, I love this solution.

@afharo afharo merged commit 4ed1cb3 into elastic:master Oct 6, 2020
@afharo afharo deleted the telemetry/sync-setup-and-start-methods branch October 6, 2020 11:46
afharo added a commit to afharo/kibana that referenced this pull request Oct 6, 2020
# Conflicts:
#	src/plugins/telemetry/server/plugin.ts
afharo added a commit that referenced this pull request Oct 6, 2020
…79642)

# Conflicts:
#	src/plugins/telemetry/server/plugin.ts
gmmorris added a commit that referenced this pull request Oct 8, 2020
…into feature/task_manager_429

* 'feature/task_manager_429' of github.com:elastic/kibana: (158 commits)
  Add license check to direct package upload handler. (#79653)
  [Ingest Manager] Rename API /api/ingest_manager => /api/fleet (#79193)
  [Security Solution][Resolver] Simplify CopyableField styling and add comments (#79594)
  Fine-tunes ML related text on Metrics UI (#79425)
  [ML] DF Analytics creation wizard: ensure job creation possible when model memory lower than estimate (#79229)
  Add new "Add Data" tutorials (#77237)
  Update APM telemetry docs (#79583)
  Revert "Add support for runtime field types to mappings editor. (#77420)" (#79611)
  Kibana request headers (#79218)
  ensure missing indexPattern error is bubbled up to error callout (#79378)
  Missing space fix (#79585)
  remove duplicate tab states (#79501)
  [data.ui] Lazy load UI components in data plugin. (#78889)
  Add generic type params to search dependency. (#79608)
  [Ingest Manager] Internal action for policy reassign (#78493)
  [ILM] Add index_codec to forcemerge action in hot and warm phases (#78175)
  [Ingest Manager] Update open API spec and add condition to agent upgrade endpoint (#79579)
  [ML] Hide Data Grid column options when histogram charts are enabled. (#79459)
  [Telemetry] Synchronous `setup` and `start` methods (#79457)
  [Observability] Persist time range across apps (#79258)
  ...
@lukeelmers lukeelmers added the Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc label Oct 1, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Telemetry release_note:fix Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.9.3 v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Start lifecycle of "telemetry" plugin wasn't completed in 30sec
5 participants