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

[Monitoring] Correctly type kibana config #112146

Closed
neptunian opened this issue Sep 14, 2021 · 4 comments · Fixed by #125467
Closed

[Monitoring] Correctly type kibana config #112146

neptunian opened this issue Sep 14, 2021 · 4 comments · Fixed by #125467
Assignees
Labels
Epic: Stack Monitoring TypeScript Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services

Comments

@neptunian
Copy link
Contributor

neptunian commented Sep 14, 2021

Currently the config has a getter that we use and pass in the string of the property config name, but it's typed to always return a string or undefined which is not always the case.

@botelastic botelastic bot added the needs-team Issues missing a team label label Sep 14, 2021
@neptunian neptunian added the Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services label Sep 14, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/logs-metrics-ui (Team:logs-metrics-ui)

@botelastic botelastic bot removed the needs-team Issues missing a team label label Sep 14, 2021
@matschaffer matschaffer self-assigned this Feb 14, 2022
@matschaffer
Copy link
Contributor

matschaffer commented Feb 15, 2022

So I was looking at how infra plugin handles config (cc @weltenwort to confirm that this is a reasonable plugin to copy from) and it's quite different.

I suspect in order to get good typing of how monitoring plugin handles configs, we'll have to switch away from the config.get API in favor of accessing the config object directly, like on

const compositeSize = libs.configuration.alerting.inventory_threshold.group_by_page_size;

@matschaffer
Copy link
Contributor

I guess the other option might be to at least switch our config.get('key') calls to config.get<T>('key')

I'll try that out and see if it's worth the gain compared with the larger refactoring away from config.get

@matschaffer
Copy link
Contributor

I think

if (key === 'server.uuid') {
return this.legacyShimDependencies.instanceUuid;
eliminates the option of a generic since that will always return a string.

I'll see what happens if I start swapping out config.get for config: MonitoringConfig but I think the blast radius of the change will increase quite a bit so I'll increase the issue size to medium.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Epic: Stack Monitoring TypeScript Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants