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

[Usage collection] Make schema mandatory #79999

Merged
merged 7 commits into from
Oct 26, 2020

Conversation

afharo
Copy link
Member

@afharo afharo commented Oct 8, 2020

Summary

Now that all the existing collectors have a schema, let's change the TS definition to enforce every collector to include a schema definition (only for UsageCollectors).

In addition to that:

  • Add a bit of TS documentation to each property in CollectorOptions
  • Add schema to the still-in-legacy collector localization in the legacy file src/plugins/telemetry/schema/legacy_plugins.json (we might need a follow up issue to move that plugin out of the legacy dir)
  • Fix TS not allowing to provide additional properties in the CollectorOptions to extend the Collector class.
  • Remove use of any due to the issue fixed in the previous point

Checklist

Delete any items that are not applicable to this PR.

For maintainers

default_admin_email: { type: 'text' },
},
},
async fetch(this: Collector<EmailSettingData | undefined>) {
Copy link
Member Author

Choose a reason for hiding this comment

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

TS's fancy way of specifying the expected type for this. It doesn't affect the arguments.

@afharo afharo force-pushed the usage_collection/make-schema-mandatory branch from b00f7c8 to ef8188e Compare October 8, 2020 15:20
public makeStatsCollector = <
T,
U,
O extends CollectorOptions<T, U> = CollectorOptions<T, U> // Used to allow extra properties (the Collector constructor extends the class with the additional options provided)
Copy link
Member Author

Choose a reason for hiding this comment

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

This is to allow x-pack/plugins/monitoring/server/kibana_monitoring/collectors/get_settings_collector.ts to send the additional method getEmailValueStructure without TS complaining about it.

The logic inside the Collector class actually allows doing that.

In a follow-up PR I'll update the types inside the Collector class to better define the this context in the isReady, fetch and formatForBulkUpload methods. It requires some mocks to be updated in tests (production logic is good as it is for now), and I don't want to make the scope of this PR explode 🙂

@afharo afharo marked this pull request as ready for review October 8, 2020 17:48
@afharo afharo requested review from a team as code owners October 8, 2020 17:48
@afharo afharo requested a review from a team October 8, 2020 17:48
@elasticmachine
Copy link
Contributor

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

Copy link
Contributor

@chrisronline chrisronline left a comment

Choose a reason for hiding this comment

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

LGTM for stack monitoring!

Copy link
Member

@lukeelmers lukeelmers left a comment

Choose a reason for hiding this comment

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

App arch docs change LGTM (not sure why the generated markdown changed, but I'm not seeing anything concerning)

@TinaHeiligers
Copy link
Contributor

@Bamieh we'll need to take care of this PR for @afharo.

@Bamieh
Copy link
Member

Bamieh commented Oct 18, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

merge conflict between base and head

Copy link
Contributor

@TinaHeiligers TinaHeiligers left a comment

Choose a reason for hiding this comment

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

Adds `UsageCollectorOptions` to `collector_set.test.ts`
@TinaHeiligers TinaHeiligers self-requested a review October 19, 2020 19:25
Copy link
Contributor

@TinaHeiligers TinaHeiligers left a comment

Choose a reason for hiding this comment

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

LGTM

@TinaHeiligers TinaHeiligers requested a review from Bamieh October 19, 2020 21:09
@Bamieh
Copy link
Member

Bamieh commented Oct 21, 2020

@elasticmachine merge upstream

@Bamieh
Copy link
Member

Bamieh commented Oct 26, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

distributable file count

id before after diff
default 48076 48077 +1
oss 28590 28591 +1

History

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

@Bamieh Bamieh merged commit 38c6d1f into elastic:master Oct 26, 2020
Bamieh pushed a commit to Bamieh/kibana that referenced this pull request Oct 26, 2020
Co-authored-by: Ahmad Bamieh <[email protected]>
Co-authored-by: Christiane (Tina) Heiligers <[email protected]>
Co-authored-by: Kibana Machine <[email protected]>
# Conflicts:
#	src/plugins/usage_collection/server/collector/collector_set.test.ts
#	x-pack/plugins/monitoring/server/kibana_monitoring/collectors/get_settings_collector.ts
jloleysens added a commit to jloleysens/kibana that referenced this pull request Oct 26, 2020
…arm-phase-to-formlib

* 'master' of github.com:elastic/kibana:
  [Trigger Actions UI] Properly unmount app (elastic#81436)
  skip flaky suite (elastic#81576)
  skip flaky suite (elastic#78373)
  [Security Solution] Fix styling of EditDataProvider content (elastic#81456)
  [Search] Error Alignment 2 (elastic#80965)
  [APM] Unskip test (elastic#81574)
  [ML] Fix partition value selection on the Single Metric Viewer (elastic#81585)
  cleaning up expression service types (elastic#80643)
  Fix suggestions dropdown for query input (elastic#80990)
  [Usage collection] Make `schema` mandatory (elastic#79999)
  [ILM] Update show/hide data tier logic on cloud (elastic#81455)
  added brace import to advanced settings (elastic#81458)
  chore(NA): add spec-to-console and plugin-helpers as devOnly dependencies
Bamieh added a commit that referenced this pull request Oct 26, 2020
* [Usage collection] Make `schema` mandatory (#79999)

Co-authored-by: Ahmad Bamieh <[email protected]>
Co-authored-by: Christiane (Tina) Heiligers <[email protected]>
Co-authored-by: Kibana Machine <[email protected]>
# Conflicts:
#	x-pack/plugins/monitoring/server/kibana_monitoring/collectors/get_settings_collector.ts

* eslint fix

Co-authored-by: Alejandro Fernández Haro <[email protected]>
@afharo afharo deleted the usage_collection/make-schema-mandatory branch November 2, 2020 11:29
@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.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants