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] Separate the license retrieval from the stats in the usage collectors #57332

Merged
merged 13 commits into from
Feb 25, 2020

Conversation

afharo
Copy link
Member

@afharo afharo commented Feb 11, 2020

Summary

Separate the license retrieval from the stats fetchers in the usage collectors. This way we can allocate and understand where the logic fails and still have the right license information even when other info might be failing to be retrieved.

Fixes #56967

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@afharo afharo added Feature:Telemetry v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.7.0 Team:Pulse labels Feb 11, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/pulse (Team:Pulse)

@afharo afharo requested a review from Bamieh February 11, 2020 16:03
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.

Direction looks good!

I have a few suggestions:

  1. We cannot be calling xpack APIs from OSS. To solve this see (2).
  2. Let us define getLicense as part of the collectionManager api just like getStats and cluster uuids. This way we can still have the implementation decoupled from where the data is fetched from (monitoring/oss/xpack/others).
  3. I dont think we should really worry about the performance cost of calling the license api. Telemetry is called a few times per day at max.

One idea is to use the license API to register the license fetching instead of depending on our own implementation (in the license_manager plugin) We can open a separate issue/PR for this one though.

@afharo afharo requested a review from a team February 21, 2020 18:26
@afharo afharo changed the title [Telemetry] Merge OSS and XPack usage collectors [Telemetry] Separate the license retrieval from the stats in the usage collectors Feb 21, 2020
@afharo afharo requested a review from Bamieh February 21, 2020 18:33
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.

LGTM, thanks! i did not pull the code locally to test it

@@ -141,7 +169,17 @@ export class TelemetryCollectionManager {
return;
}

return await collection.statsGetter(clustersDetails, statsCollectionConfig);
const stats = await collection.statsGetter(clustersDetails, statsCollectionConfig);
const licenses = await collection.licenseGetter(clustersDetails, statsCollectionConfig);
Copy link
Member

Choose a reason for hiding this comment

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

can we group them in 1 promise.all so we dont have to wait for them sequentially?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call! Just pushed the update :)

return {
...(license ? { license } : {}),
...stat,
collectionSource: collection.title,
Copy link
Member

Choose a reason for hiding this comment

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

👍

@afharo
Copy link
Member Author

afharo commented Feb 24, 2020

Anyone in the @elastic/stack-monitoring team can have a quick look at these changes? Thank you :)

@afharo
Copy link
Member Author

afharo commented Feb 24, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

Copy link
Contributor

@igoristic igoristic left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@afharo afharo merged commit 506268c into elastic:master Feb 25, 2020
@afharo afharo deleted the telemetry/merge-oss-and-xpack-collectors branch February 25, 2020 10:31
afharo added a commit to afharo/kibana that referenced this pull request Feb 25, 2020
…e collectors (elastic#57332)

* [Telemetry] Merge OSS and XPack usage collectors

* Create X-Pack collector again

* Separate the license retrieval from the stats

* Fix telemetry tests with new fields

* Use Promise.all to retrieve license and stats at the same time

* Fix moment mock

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
afharo added a commit that referenced this pull request Feb 25, 2020
…e collectors (#57332) (#58450)

* [Telemetry] Merge OSS and XPack usage collectors

* Create X-Pack collector again

* Separate the license retrieval from the stats

* Fix telemetry tests with new fields

* Use Promise.all to retrieve license and stats at the same time

* Fix moment mock

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
jloleysens added a commit to jloleysens/kibana that referenced this pull request Feb 25, 2020
…re/files-and-filetree

* 'master' of github.com:elastic/kibana: (174 commits)
  [SIEM] Fix unnecessary re-renders on the Overview page (elastic#56587)
  Don't mutate error message (elastic#58452)
  Fix service map popover transaction duration (elastic#58422)
  [ML] Adding filebeat config to file dataviz (elastic#58152)
  [Uptime] Improve refresh handling when generating test data (elastic#58285)
  [Logs / Metrics UI] Remove path prefix from ViewSourceConfigur… (elastic#58238)
  [ML] Functional tests - adjust classification model memory (elastic#58445)
  [ML] Use event.timezone instead of beat.timezone in file upload (elastic#58447)
  [Logs UI] Unskip and stabilitize log column configuration tests (elastic#58392)
  [Telemetry] Separate the license retrieval from the stats in the usage collectors (elastic#57332)
  hide welcome screen for cloud (elastic#58371)
  Move src/legacy/ui/public/notify/app_redirect to kibana_legacy (elastic#58127)
  [ML] Functional tests - stabilize typing during df analytics creation (elastic#58227)
  fix short url in spaces (elastic#58313)
  [SIEM] Upgrades cypress to version 4.0.2 (elastic#58400)
  [Index management] Move to new platform "plugins" folder (elastic#58109)
  [kbn/optimizer] disable parallelization in terser plugin (elastic#58396)
  [Uptime] Delete useless try...catch blocks (elastic#58263)
  [Uptime] Use scripted metric for snapshot calculation (elastic#58247) (elastic#58389)
  [APM] Stabilize agent configuration API (elastic#57767)
  ...

# Conflicts:
#	src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.tsx
@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:skip Skip the PR/issue when compiling release notes Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Telemetry] report license in oss
6 participants